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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Working with temp tables in PL/SQL process

753504Feb 24 2010 — edited Feb 24 2010
So I’m trying to write a process in PL/SQL and I’m having some difficulty. Here’s what I need to do:

- Create some temp tables
- Put data in them
- Use the data in the temp tables to populate the main report table
- Drop the temp tables

I’m running into some problems when I try to create the tables. If I do it like I would in SQL Server:

SELECT Field1, Field2
INTO TempTable1
FROM


Then I get an error saying TempTable1 doesn’t exist. If I say:

CREATE TABLE TempTable1 AS
SELECT Field1, Field2
FROM


Then I get “Found CREATE, Expecting CASE or another statement”. I know that in order to truncate or drop tables in a PL/SQL I have to use EXECUTE IMMEDIATE. Do I need to do the same thing for creating a table? If that’s the case, how would I use execute immediate on a multi-line query with apostrophe’s in it?

Thanks!
This post has been answered by thomaso on Feb 24 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2010
Added on Feb 24 2010
6 comments
5,576 views