DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: DB Link issue

  1. #1
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865

    DB Link issue

    Hi-

    I am getting the following error because the connect string i have given is a cursor variable not actual db link name.
    select name into db_name from v$database@dbl_name;
    *
    ERROR at line 15:
    ORA-06550: line 15, column 8:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 15, column 8:
    PL/SQL: SQL Statement ignored

    Can some one help me how to pass the cursor variable in place of db link connect string?

    Here is my part of my code ...

    ...
    ...
    open dbl_cur;
    loop
    fetch dbl_cur into dbl_name;
    dbms_output.put_line('Fetched DB Link: '||dbl_name);
    begin
    select name into db_name from v$database@dbl_name;
    dbms_output.put_line('Connected to '|| db_name);
    end;
    exit when dbl_cur%NOTFOUND;
    end loop;
    close dbl_cur;

    Thanks in advanse.

    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Cool Execute Immediate

    Try this:
    Code:
    Sql_Str Varchar2(1000);
    ...
    ...
    Open Dbl_Cur;
    Loop
      Fetch Dbl_Cur Into Dbl_Name;
        Dbms_Output.Put_Line('Fetched Db Link: '||Dbl_Name);
        Begin
          Sql_Str:='Select Name From V$Database@'||Dbl_Name;
          Execute Immediate Sql_Str Into Db_Name;
          Dbms_Output.Put_Line('Connected To '|| Db_Name);
        End;
      Exit When Dbl_Cur%Notfound;
    End Loop;
    Close Dbl_Cur;
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  3. #3
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    Awesome !!! It's perfectly working ... Thanks Brwn.

    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width