Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Cursor with variable database link
In article <38C630D0.2FD0302_at_post.ch>,
Braendle Pascal <braendlepa_at_post.ch> wrote:
> I'm trying to make a cursor using a database link as a variable.
>
> example:
> cursor c_emp is
> select * from emp_at_V_NODE;
>
> how can I do this?
>
> -- Pascal Braendle
>
>
In 8.0 and before you cannot use a 'cursor' but you can use the dbms_sql package to dynamically execute a query and get the results. You'll not be using a plsql cursor but rather an API to prepare, execute, fetch and get the columns back.
In Oracle8i, release 8.1 it would look like:
declare
type rc is ref cursor;
c rc;
begin
open c for 'select * from t@' || v_node;
loop
fetch c into ... exit when c%notfound;
--
Thomas Kyte tkyte_at_us.oracle.comOracle Service Industries
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Wed Mar 08 2000 - 06:59:24 CST
![]() |
![]() |