Home » SQL & PL/SQL » SQL & PL/SQL » Error with function.
Error with function. [message #8792] Thu, 25 September 2003 14:10 Go to next message
Dushm
Messages: 11
Registered: September 2002
Junior Member
I am trying to create a simple function :

Create Or Replace FUNCTION sfc_add
( v_id IN Number
)
RETURN BOOLEAN IS

BEGIN
DECLARE
vDt DATE;

BEGIN

SELECT L_DATE
INTO vDt
FROM SFC_NUMBER ;

RETURN TRUE;

END;
END;
/

I get the error saying table/view doesn't exists.
SQL> show errors
Errors for FUNCTION sfc_add:

LINE/COL ERROR
-------- -----------------------------------------------------------------
12/15 PL/SQL: SQL Statement ignored
14/21 PL/SQL: ORA-00942: table or view does not exist

When i change the table name from SFC_NUMBER to DUAL then the function is creating with out any errors.

Any clue why it's unable to find the table SFC_NUMBER.

I am able to see the table if i log into database using sqlplus.And also i am able to insert/update into that table using sqlplus.

Any help whould be greatly appreciated.
Re: Error with function. [message #8795 is a reply to message #8792] Thu, 25 September 2003 14:25 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
It sounds like that table is in another schema than the one creating the function. If so, the owner of that table will need to directly grant you the privilege to SELECT from the table (the privilege you have from a role does not apply in PL/SQL).
Previous Topic: about the function of case statement
Next Topic: Resolving dense_rank ties
Goto Forum:
  


Current Time: Thu Mar 28 06:28:02 CDT 2024