plsql - PL/SQL:How to make sure a function exists? -


well, facing "insufficient privileges" problem while running pl/sql function:

here steps followed: in windows command prompt logged in follows:

code:

sqlplus / sysdba 

i got sql> prompt on there , tried grant privilige on function "age" follows:

code:

 sql> grant execute on age scott; 

where, age function name , scott user

i'm referring following documentation:

http://www.techonthenet.com/oracle/grant_revoke.php

i got error ora-0402: function body doesn't exist. how can save function body before issuing grant ?

please !

to ensure proper grant issued use qualified [schema].[object] name when referring function. otherwise you're relying on public synonyms pointing right object. function must exist before can grant though may not in valid state. can't issue grants on objects don't exist (well besides catch execute any grant that's special database role).

for example if schema foobar , function name age issue:

grant execute on foobar.age scott 

also, when using function make sure either:

  1. there public synonym pointing function and no local synonym exists hides public synonym
  2. or .. there local synonym function (eg scott has local synonym pointing foobar.age)
  3. or ... refer function qualified name (eg call via foobar.age()

to check if function valid can query all_objects , check status column:

select status all_objects owner = 'foobar'   , object_type = 'function'   , object_name = 'age' 

Comments