Home » SQL & PL/SQL » SQL & PL/SQL » how to pass parameters dynamically
how to pass parameters dynamically [message #37087] Wed, 16 January 2002 14:59 Go to next message
Nina
Messages: 113
Registered: March 2000
Senior Member
I have a procedure that accepts two parameters. One of the parameters needs to be changed so that it is passed dynamically. This is the function:

package_name.record_name.Function_name(package_a.record_a.column_namea,package_b.record_b.column_nameb);

I need to be able to pass package_b.record_b.column_nameb dynamically. So that before I call this function, I will open/fetch/close a cursor. Depending on what a particular column value fetched by this cursor I get, I want to be able to change the logic of what is going to be passed to the second parameter (i.e package_b.record_b.column_nameb).

I tryed to put a logic before this function and after I opened/fetched/closed the above-mentioned cursor:

if package_name.cursor_name.record_name.variable_name = 'Y' then
package_b.record_b.column_nameb := DATE
ELSE
package_c.record_c.column_namec := DATE;
Then I tryed to pass this DATE to the function as a parameter, but got errors.
Is there a way to pass - depending on what cursor fetches, either package_b.record_b.column_nameb OR
package_c.record_c.column_namec ?

thank you in advance
Re: how to pass parameters dynamically [message #37090 is a reply to message #37087] Wed, 16 January 2002 20:11 Go to previous message
Satish Shrikhande
Messages: 167
Registered: October 2001
Senior Member
Nina ,
Now make me clear few things
are you going to prepare any sql statement inside the function , i almost got you .

Now listen just pass the vlue to the function whatver it is , ok and inside the function take care of it .
if you wanna to use b column if input value is Y and c if N .

s := "select ***** "
if input value = 'Y ' then
l:= " b ="|| date
else
l:= " c ="|| date
end if
s : = s || l

i think u didn't get me .
Previous Topic: Trigger and rollback..
Next Topic: loop
Goto Forum:
  


Current Time: Fri Mar 29 02:02:58 CDT 2024