Home » SQL & PL/SQL » SQL & PL/SQL » How I execute package in function and procedure?
How I execute package in function and procedure? [message #222966] Wed, 07 March 2007 01:27 Go to next message
victoryhendry
Messages: 95
Registered: January 2007
Location: Bangalore
Member

How I execute package in function and procedure?


plea cheak that's correct or not??

sql>execute package_name.functionName(parameter values);
sql>execute package_name.procedureName(parameter values);
Re: How I execute package in function and procedure? [message #222969 is a reply to message #222966] Wed, 07 March 2007 01:29 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
What happens if you execute it?
Re: How I execute package in function and procedure? [message #222984 is a reply to message #222966] Wed, 07 March 2007 02:16 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
well the function execution will definitely fail
execute package_name.functionName(parameter values);

Here's what happens when you run your code (but of course, you already tried this, didn't you)
SQL> create or replace function f_test(p_vc in varchar2) return varchar2 as
  2  begin
  3    return p_vc;
  4  end;
  5  /

Function created.

SQL> exec f_Test('a');
BEGIN f_Test('a'); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'F_TEST' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
And here's what you need to do to execute a stand alone function or a packaged function in SQL*Plus
SQL> variable v varchar2(20);
SQL> exec :v := f_test('a');

PL/SQL procedure successfully completed.

SQL> print v;

V
--------------------------------
a
Previous Topic: Complex query hangs when selecting from table where fresh data is inserted
Next Topic: Analytic Functions - LAG
Goto Forum:
  


Current Time: Sat Dec 10 18:26:10 CST 2016

Total time taken to generate the page: 0.12812 seconds