Re: Explicit Cursor and Insert Into table question
Date: Sat, 26 Apr 2008 09:51:58 -0700
General Fear wrote:
> I am using 10g.
> I am running a test. I want to create an explicit cursor. Then I want
> to put the data that is in the cursor into a table. The problem is
> that the table has a lot of fields. I could put the data into
> variables then use the insert into command.
> Is there an better way to use explicit cursors and put that data into
> a table? I tried searching the net but the examples did not help.
No Oracle version.
And the explanation is far from clear.
What about the following doesn't do what you are asking?
CURSOR c IS
SELECT * FROM all_tables;
FOR r IN c LOOP
INSERT INTO t (table_name) VALUES (r.table_name);
That said from your explanation of what you are trying to do an explicit cursor, and procedural code, is abou the least efficient way to solve the problem. Far better would be:
INSERT INTO t SELECT table_name FROM all_tables; COMMIT;
-- Daniel A. Morgan Oracle Ace Director & Instructor University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Sat Apr 26 2008 - 11:51:58 CDT