Calling function in a procedure [message #313266] |
Fri, 11 April 2008 05:03  |
virmahi
Messages: 266 Registered: April 2008 Location: India
|
Senior Member |
|
|
Hi,
I am new to oracle.
Please let me know how to call a function in a procedure. I know calling procedure within procedure just by giving the procedure name along with arguement values.
I have a function that will take values from the procedure and will return a numeric value to a variable defined in the procedure.
CREATE OR REPLACE PROCEDURE proc1(p_tab IN VARCHAR2, p_col IN VARCHAR2) IS
BEGIN
p_tab VARCHAR2(50):= 'employee';
p_col VARCHAR2(50):= 'sal';
retval := CALL FUNCTION fun(p_tab, p_col);--PLEASE CORRECT THIS.
END proc1;
I have to pass two values to the function fun and get its value in retval for further calculation in procedure.
The above code is only a pseudocode, please correct the calling function statement in the above procedure.
Thanks,
Mahi
[Updated on: Fri, 11 April 2008 05:05] Report message to a moderator
|
|
|
Re: Calling function in a procedure [message #313271 is a reply to message #313266] |
Fri, 11 April 2008 05:07   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
OK, forget about your custom function for a moment. How would you populate a variable with the return from a 'normal' function i.e. an Oracle supplied function (say Length or Instr)
|
|
|
Re: Calling function in a procedure [message #313275 is a reply to message #313266] |
Fri, 11 April 2008 05:15   |
rajatratewal
Messages: 507 Registered: March 2008 Location: INDIA
|
Senior Member |
|
|
Why don't you study some basics before posting it on the forum.
I think this is just a simple thing you can easily find on net.
Have you used google for it??
retval := CALL FUNCTION fun(p_tab, p_col);--Please use Google
|
|
|
|
|