Home » SQL & PL/SQL » SQL & PL/SQL » confusion in passing parameters to function (oracle 10g)
confusion in passing parameters to function [message #421034] Thu, 03 September 2009 15:12 Go to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
hi, in my client database i found something new to me about how procedure is calling a function.

see below example , in pkg_abc, fnc_abc is function. its been called by passing 5 parameters. but in function there are only 3 parameters given.

here function is called

  l_r:= PKG_ABC.fnc_abc
             (l_id_src, 
             l_w_id_src,
              l_id_dest,
              l_wid_dest,
            l_rep_or_copy);



this is function

 FUNCTION FNC_abc(
  p_id       number ,
  p_id_dest  number ,
  p_id_dest  number )
  
  RETURN NUMBER IS


can we pass parameters like this?? does it work? and how parameters will be assigned if i do this way??

Re: confusion in passing parameters to function [message #421040 is a reply to message #421034] Thu, 03 September 2009 16:03 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Have you tried it? Did it work? What do you think your tests mean?
Re: confusion in passing parameters to function [message #421056 is a reply to message #421034] Fri, 04 September 2009 00:23 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Quote:
can we pass parameters like this?


No.

regards,
Delna
Re: confusion in passing parameters to function [message #421057 is a reply to message #421056] Fri, 04 September 2009 00:26 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
delna.sexy wrote on Thu, 03 September 2009 22:23
Quote:
can we pass parameters like this?


No.

regards,
Delna


Prove it!
Re: confusion in passing parameters to function [message #421058 is a reply to message #421057] Fri, 04 September 2009 00:43 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Quote:
FUNCTION FNC_abc(
p_id number ,
p_id_dest number ,
p_id_dest number )


Calling that function is later case.
First of all, does your function compiles with two arguments having same name?

regards,
Delna
Re: confusion in passing parameters to function [message #421071 is a reply to message #421034] Fri, 04 September 2009 02:19 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You cannot pass 5 parameters into a function that is defined as accepting 3 parameters - the code doing the call would fail to compile.

Assuming that your code has compiled, the most likely situation is that you have an overloaded function - ie two functions in a package that have the same name but different sets of parameters.
icon14.gif  Re: confusion in passing parameters to function [message #421773 is a reply to message #421071] Thu, 10 September 2009 07:46 Go to previous messageGo to next message
Nitesh-Jyotirmay
Messages: 7
Registered: September 2009
Location: Delhi INDIA
Junior Member

Use default value for two Parameter and pass rest of three parameter from function with named method.
Re: confusion in passing parameters to function [message #421778 is a reply to message #421773] Thu, 10 September 2009 07:59 Go to previous messageGo to next message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
Help2Nitesh wrote on Thu, 10 September 2009 13:46
Use default value for two Parameter and pass rest of three parameter from function with named method.


And that answers the original question how?
Re: confusion in passing parameters to function [message #421816 is a reply to message #421034] Thu, 10 September 2009 15:47 Go to previous messageGo to next message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
Excuse me...

I'd like to see it in code that compiles and works please.

Someone create a test case to show this. Indeed, it sounds cool but I would be disturbed to see it actually work because I have no clue yet how to interpret its meaning.

Kevin
Re: confusion in passing parameters to function [message #421852 is a reply to message #421816] Fri, 11 September 2009 02:55 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'd like to see a test case too, but I don't think we will.
Previous Topic: SPOOL IN PL/SQL BLOCK
Next Topic: SQL Query to get date ranges from a list of dates
Goto Forum:
  


Current Time: Sun Dec 04 10:31:42 CST 2016

Total time taken to generate the page: 0.04399 seconds