Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic cursor ?
forgot the select database link name befor for loop:
"Maija-Leena" <kangasmaki_at_jippii.fi> wrote in message
news:lrmii.34$t62.12_at_read3.inet.fi...
> Hi,
>
> I need to declare a cursor that selects from a table via database link but
I
> don't know the name of the link before I select it from another table. How
> do I declare the cursor ? Can I use dynamic sql ?
>
> set serveroutput on
>
> DECLARE
> db_link_name VARCHAR2(50);
> CURSOR cur1 IS SELECT col1 FROM table1_at_db_link_name;
>
> BEGIN
> SELECT link_name INTO db_link_name FROM link_table;
> FOR cur IN cur1 LOOP
> ...
> END LOOP;
> END;
> /
>
>
> Regards,
>
> Maija-Leena
>
>
Received on Tue Jul 03 2007 - 02:01:50 CDT
![]() |
![]() |