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!

Global Temporary Tables and Truncate

user546710Feb 18 2011 — edited Feb 18 2011
Hi all,

I am having SQL script like this. First, It will truncate the Temp_emp and then, it will load data from big_table.
Whenever, i run this script from SQL prompt, data inserted into the Temp_emp is doubled. What may be the reason. Am i missing anything
concet of Global Temporary Tables and Truncate ?

*.SQL File starts here*

BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE Temp_emp';
END;
/

INSERT INTO Temp_Temp
SELECT col1,col2,col3,col4,col5
FROM
( SELECT col1,col2,col3,col4,col5 FROM big_table bt
WHERE bt.ROWID IN (SELECT MAX(ROWID) FROM big_table
GROUP BY col1,col2 )
) ;

/

*.SQL File ends here*

Thanks in advance,
Pal
This post has been answered by earth on Feb 18 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2011
Added on Feb 18 2011
2 comments
277 views