Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to insert pivot data into a table

user7188033Nov 24 2015 — edited Nov 25 2015

I have a Pivot data which I need to insert into a table. I can get the data inserted into the desired table if I run it as SQL, but When I try to run it as Stored procedure, data does not get inserted. Here is my query:


Begin

Delete from TEMP_PIVOTTABLE;

with pivot_data as (

SELECT  COL1,COL2,COL13,COL4 FROM TEMP_TABLE1

)

Insert into TEMP_PIVOTTABLE (COL1,COL2,COL13,COL4)  -- I AM GETTING SYNTAX ERROR (EXPECTED, SELECT)

select * from pivot_data

PIVOT

(

sum (COL3) FOR COL2 IN ('Client','Yes','No')

)

order by COL1;

END;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2015
Added on Nov 24 2015
14 comments
1,341 views