Skip to content

Tag: oracle

Pivot row values matching a pattern into column names

I have data that look like this: I would like to pivot these data so that for each set of rows with the same OH_IDNR and with the same common/non-unique part of OCV_VNAME, these columns are returned: OH_IDNR The common part of OCV_VNAME (e.g., ‘response_part_0_script_0_’) – n. One column for each …

ORACLE SQL How to use custom function iside insert cte

I am trying to use function inside insert SQL, but I am getting error ORA-32034. Looks like that I couldn’t access this function in the cte. Maybe someone can help? Answer If the query containing the PL/SQL declaration section is not the top level query, the top-level query must include the WITH_PLSQL h…

Issue using to_date giving ORA-01722: invalid number

I am trying to pull together two fields to create a mm/dd/yyyy date field using case-when, and it keeps giving me error ORA-01722: invalid number. Answer The problem is Oracle applies the concatenation operators before it does the arithmetic. So the ELSE branch of your CASE statement: is going to execute some…