Home » SQL & PL/SQL » SQL & PL/SQL » give parameters into function
give parameters into function [message #194009] Wed, 20 September 2006 06:38 Go to next message
mape
Messages: 241
Registered: July 2006
Location: Slovakia
Senior Member
Hi

I don't know how to give parameters into call function?

in the procedure I have:

 for j in (select value into v_value 
           from table_param
           where param_id=1523 ) loop

    dbms_output.put_line(j. value);

  end loop;



Result are number for example: 10,0,5,30

I need to give these number to function:
   save_res(one => 10,
            two => 0,
            three => 5,
            four => 30);

How to do that?

Thanks


Re: give parameters into function [message #194053 is a reply to message #194009] Wed, 20 September 2006 09:53 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You could try something like this:

(untested)
DECLARE
  type ty_values is table of varchar2(50) index by binary_integer;

  t_values ty_values;
BEGIN

  SELECT value
  BULK COLLECT INTO t_values 
  FROM   table_param
  WHERE  param_id=1523;

  save_res(one =>   t_values(1)
          ,two =>   t_values(2)
          ,three => t_values(3)
          ,four =>  t_values(4));
END;

   
Re: give parameters into function [message #194185 is a reply to message #194009] Thu, 21 September 2006 02:26 Go to previous messageGo to next message
mape
Messages: 241
Registered: July 2006
Location: Slovakia
Senior Member
thanks
but your example is different, what I did mean.

The simply I need to give this result to function as input arguments.

Martin




Re: give parameters into function [message #194202 is a reply to message #194185] Thu, 21 September 2006 03:02 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Well, you're doing a fairly poor job of explaining why what I have provided isn't what you wanted.

In your example, you retrieved some values from a cursor, and said that you wanted to pass these values into a function.

I provided you with a way of getting a group of values at one from a cursor, and then referencing them to allow you to pass them to a function.

If this isn't what you wanted, it suggests that some clarification of the requirements on your part is in order.
Previous Topic: distinct *
Next Topic: package spec/body
Goto Forum:
  


Current Time: Fri Dec 09 00:17:39 CST 2016

Total time taken to generate the page: 0.05911 seconds