Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Question about cursors
Since both tables can't be called A, I will use A and B:
You can do this without a cursor:
begin
insert into B select id from A where id > 10;
end;
/
HTH,
Mike
roland.skoldblom@ ica.se To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Sent by: cc: ml-errors_at_fatcity Subject: Question about cursors .com 08/15/2003 07:39 AM Please respond to ORACLE-L
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: roland.skoldblom_at_ica.se 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: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Fri Aug 15 2003 - 08:10:06 CDT
(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: Michael Boligan INET: michael.boligan.b_at_bayer.com 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: ListGuru_at_fatcity.com (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).