Dynamic SQL to call a function with RETURN value?
From: mwmann <mwmann_at_gmail.com>
Date: Mon, 27 Oct 2008 03:41:00 -0700 (PDT)
Message-ID: <b6667549-f08d-499e-9793-5a75e274d498@h60g2000hsg.googlegroups.com>
EXAMPLE TABLE: BATCH_FUNCTION
func_id function_name
FUNCTION test_positive(i_number IN NUMBER) RETURN BOOLEAN AS BEGIN
if(i_number >0) THEN
RETURN true;
else
RETURN false;
end if;
END test_positive; Received on Mon Oct 27 2008 - 05:41:00 CDT
Date: Mon, 27 Oct 2008 03:41:00 -0700 (PDT)
Message-ID: <b6667549-f08d-499e-9793-5a75e274d498@h60g2000hsg.googlegroups.com>
Hi
Please can someone help me out. I have done quite a bit of searching and 'trial and error' without much success. I have simplified the problem for readability, but a solution to this will allow me to solve my problem.
PROBLEM:
I have a table BATCH_FUNCTION which will contain records with various
existing DB functions, with parameters- (Return Type BOOLEAN).
In an Anonymous Block (lets say for example), if I had a list of the functions to call in a cursor (select function_name from batch_function), how would I call these functions with parameters, as well as be able to test the Return value in my Anonymous block?
I presume that Dynamic SQL is the way to go, but I have not been able to get it right.
EXAMPLE TABLE: BATCH_FUNCTION
func_id function_name
----------- --------------------- 111 test_positive(1)EXAMPLE FUNCTION
-----------------------------------------------------------------------------------------------------------
FUNCTION test_positive(i_number IN NUMBER) RETURN BOOLEAN AS BEGIN
if(i_number >0) THEN
RETURN true;
else
RETURN false;
end if;
END test_positive; Received on Mon Oct 27 2008 - 05:41:00 CDT