Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Server > Re: Explicit Cu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 16472 of 17248
Post > Topic >>

Re: Explicit Cursor and Insert Into table question

by DA Morgan <damorgan@[EMAIL PROTECTED] > Apr 26, 2008 at 09:51 AM

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.
No DDL.
No DML.
And the explanation is far from clear.
What about the following doesn't do what you are asking?

DECLARE
  CURSOR c IS
  SELECT * FROM all_tables;
BEGIN
   FOR r IN c LOOP
     INSERT INTO t
     (table_name)
     VALUES
     (r.table_name);
   END LOOP;
   COMMIT;
END;
/

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 Wa****ngton
damorgan@[EMAIL PROTECTED]
 (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
 




 3 Posts in Topic:
Explicit Cursor and Insert Into table question
General Fear <richmari  2008-04-25 19:13:42 
Re: Explicit Cursor and Insert Into table question
DA Morgan <damorgan@[E  2008-04-26 09:51:58 
Re: Explicit Cursor and Insert Into table question
William Robertson <wil  2008-04-27 04:08:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 0:52:00 CDT 2008.