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 use Oracle temporary table and verify if it exists

578189May 17 2007 — edited May 17 2007
1. I got two errors on the following code.

ORA-06550: line 13, column 4:
PLS-00428: an INTO clause is expected in this SELECT statement

ORA-06550: line 17, column 3:
PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:

2. Can I include this code in the create view statement?

Thanks ahead, I am new to oracle dev world.

===========================================================
DECLARE
l_count NUMBER;

BEGIN

select count(*)
into l_count
from all_tables
where table_name like 'TEMP_SHOW_STAFF_2%';

if l_count > 0 then

select * from TEMP_SHOW_STAFF_2;

else

create global temporary table TEMP_SHOW_STAFF_2
(employee_id Number,
last_name varchar(10),
first_name varchar(10),
salary_amount varchar(10))
on COMMIT delete rows;


end if;

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2007
Added on May 17 2007
8 comments
3,503 views