private synonym created on table not working in function
SudhirJul 2 2008 — edited Jul 2 2008hi,
I have created a private synonym on a table.
now i am trying to create a function below is the code of the same.
FUNCTION party_name(p_cntr_id NUMBER)
RETURN VARCHAR2 AS
v_cust_name VARCHAR2(100);
v_cust_no varchar2(100);
BEGIN
select occ.cust_no
into v_cust_no
from ops_cust_cntr occ
where occ.ID = p_cntr_id;
SELECT party_name
INTO v_cust_name
FROM hz_parties -- this is the table on which synonym is created .
WHERE party_id = v_cust_no;
RETURN (v_cust_name);
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END party_name;
it is giving the message
SQL> sho errors;
Errors for FUNCTION PARTY_TEST:
LINE/COL ERROR
-------- -----------------------------------------------------------------
12/1 PL/SQL: SQL Statement ignored
14/6 PL/SQL: ORA-00942: table or view does not exist
but when i run
SELECT party_name
FROM hz_parties;
it is giving me the data.
Please advice.
Regards
Sudhir.