Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

private synonym created on table not working in function

SudhirJul 2 2008 — edited Jul 2 2008
hi,

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2008
Added on Jul 2 2008
4 comments
179 views