Hello Roland, 
Supposing that you want to select from table A and insert into B /or any ather table/. 
here is
a samll example :

DECLARE
  TYPE id_type          IS TABLE OF A.id%TYPE;
  t_id           id_type;
BEGIN
  SELECT id
  BULK COLLECT INTO t_id FROM A where id > 10 ;
   
    FORAll  id IN t_id.FIRST .. t_id.LAST
       insert into B(id) values(t_id(id));
    commit ; 
   
END;
/

HTH. Milen 
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 15. August 2003 13:39
An: Multiple recipients of list ORACLE-L
Betreff: Question about cursors


Hallo,

I would like to get a goood example on how to do this in a pl/sql block,  maybe this 
is too simple but I cant get it work.

I would like to  do a select from table A, like this

select  id from A
where id > 10

This sql statement gives me about 10 rows. I want those rows(the id) to be inserted in 
a table called A.
I woul dlike to use variables to store al the id's that the sql gets me.

so the values to be inserted in the table should be for instance

11
12
13
14
15
16
17
18
19
20


How can I do this, using a cutsor I guess. Please give me an example.

Thanks in advance


Roland


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Kulev, Milen
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to