Hi Experts,
I have setup a heterogenous service from Oracle database to SQL SERVER and want to call a procedure through the DB_LINK. I am able to directly query the table from sql server but when I try to use the procedure, it gives "INVALID IDENTIFIER".
CREATE PROCEDURE usera.proc_1
@FromDate datetime,
@ToDate datetime
AS
SET XACT_ABORT ON
select count(status) TotalOrders, country,
status =
CASE status
WHEN 'I' THEN 'Invalid'
WHEN 'S' THEN 'New'
WHEN 'P' THEN 'In Process'
ELSE 'Other'
END
from usera.table1 WITH (NOLOCK)
where DeliveredTime BETWEEN @FromDate AND @ToDate
AND status != 'F'
group by country, status
order by country, status
SQL> select count(0) from usera.table1@HET_LINK.WORLD;
This works
whereas
declare
pendord_rc sys_refcursor;
lv_ord_cnt NUMBER;
lv_country VARCHAR2(100);
lv_status VARCHAR2(100);
begin
pendord_rc := "usera".proc_1@HET_LINK.WORLD;
loop
fetch pendord_rc into lv_ord_cnt, lv_country, lv_status;
EXIT WHEN pendord_rc%NOTFOUND;
end loop;
end;
/
ERROR at line 7:
ORA-06550: line 7, column 16:
PLS-00201: identifier 'usera.PROC_1@HET_LINK.WORLD' must be declared
ORA-06550: line 7, column 2:
PL/SQL: Statement ignored
Any idea what I might be doing wrong?
Regards
Himanshu