Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: supplying dblink name to package at runtime

Re: supplying dblink name to package at runtime

From: <Charlie_Mengler_at_HomeDepot.com>
Date: Sun, 27 Oct 2002 13:43:22 -0800
Message-ID: <F001.004F4D68.20021027134322@fatcity.com>

The way I solved this problem is to create a useable "dummy" DB_LINK so that compiling the code will succeed.

The only minor gotcha is that what will result if/when a bogus dblink is passed into the code for real at run time.

HTH & YMMV HAND!

                                                                                                                                 
                      "Magaliff, Bill"                                                                                           
                      <Bill.Magaliff_at_le        To:       Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>             
                      ndware.com>              cc:                                                                               
                      Sent by:                 Subject:  supplying dblink name to package at runtime                             
                      root_at_fatcity.com                                                                                           
                                                                                                                                 
                                                                                                                                 
                      10/25/2002 10:09                                                                                           
                      AM                                                                                                         
                      Please respond to                                                                                          
                      ORACLE-L                                                                                                   
                                                                                                                                 
                                                                                                                                 




Hi,

I'm trying to incorporate a procedure in a package that needs to run using a
dblink name supplied at runtime. The dblink is used in the dml inside the procedure, but when I compile the package I get "ORA-00942 table or view does not exist" for all the sql referencing the dblink.

Here is a code snippet:

PROCEDURE CREATE_WC_OVER_DBLINK (
             DBLINK VARCHAR2) v_dblink VARCHAR2(100) := dblink;

BEGIN INSERT INTO mm_product_temp (rec, rec_old, name, is_disabled, is_workingcopy)
(SELECT mm_product_seq.nextval, rec, name, is_disabled, is_workingcopy
FROM mm_product_at_v_dblink
WHERE last_update IS null);

.....

END;
/

The ORA-00942 shows up for the line with the INSERT statement.

Looking for ideas as to how to do this. I saw a MetaLink forum posting indicating that the way to do this is to create a refcursor, then use a function to return the supplied sql to the refcursor, then open the refcursor, etc. etc.

Is this the only way to do it?

thanks

bill

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Magaliff, Bill
  INET: Bill.Magaliff_at_lendware.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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Charlie_Mengler_at_HomeDepot.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).
Received on Sun Oct 27 2002 - 15:43:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US