In the procedure below myItc will return a single value of a dblink which is stored in a table. I want to then use it to dynamically query a table using the link(as in the lines that are commented out). How do I do it through a procedure?
CREATE OR REPLACE PROCEDURE getWorkOrderDetail (i_dispatchId IN dispatch_interaction.confirmation_number%TYPE,
o_WorkOrderDetailCur OUT NOCOPY RefCursorType) IS
myItc VARCHAR2 := ‘@’ || getMyItcLink(i_corp);
BEGIN
OPEN o_workOrderDetailCur FOR
SELECT (hh.first_name||' '||hh.last_name) custName,
(stnum||' '||street_prefix||' '||stname||' '||street_suffix||':'||city_town) address,
itc_house house,
itc_cust cust,
.
.
.
FROM dispatch_interaction di,
.
.
-- wipmaster@itcplay.world wm,
-- wipordcomms@itcplay.world wc
wipmaster"&myItc" wm,
wipordcomms"&myItc" wc
WHERE
.
.
.
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getWorkOrderDetail;
CREATE OR REPLACE PROCEDURE getWorkOrderDetail (i_dispatchId IN dispatch_interaction.confirmation_number%TYPE,
o_WorkOrderDetailCur OUT NOCOPY RefCursorType) IS
myItc VARCHAR2 := ‘@’ || getMyItcLink(i_corp);
BEGIN
OPEN o_workOrderDetailCur FOR
SELECT (hh.first_name||' '||hh.last_name) custName,
(stnum||' '||street_prefix||' '||stname||' '||street_suffix||':'||city_town) address,
itc_house house,
itc_cust cust,
.
.
.
FROM dispatch_interaction di,
.
.
-- wipmaster@itcplay.world wm,
-- wipordcomms@itcplay.world wc
wipmaster"&myItc" wm,
wipordcomms"&myItc" wc
WHERE
.
.
.
EXCEPTION
WHEN OTHERS THEN
RAISE;
END getWorkOrderDetail;