tomblanchard
Programmer
Hi, I am fairly new to oracle.
I have written a function that returns a sql statement that I would like to execute and return the results.
I have another function that I can execute the statement with, I so far have no idea of how to put this together.
This is the one that returns a sql statement:
and this is the one that executes it:
If I execute the first one and paste my results into the second one it executes and returns the expected result.
However, I cannot figure ont how to just take what is in x and put it into the next function I need to execute and return the result from that.
I would like to just execute it in the first one and return the XmlType from the first function or have a function that calls the first one, gets the result, passes it to the second and returns the xmltype.
Any help would be much appreciated.
I have written a function that returns a sql statement that I would like to execute and return the results.
I have another function that I can execute the statement with, I so far have no idea of how to put this together.
This is the one that returns a sql statement:
Code:
CREATE OR REPLACE function fnMyFunc1(var_in IN varchar2) return varchar2
as
x varchar(32767);
BEGIN
SELECT fnMyFunc2(var_in) into x from dual;
return x;
end;
and this is the one that executes it:
Code:
create or replace function fnExecX(sql_in IN varchar2) return XmlType
as
x XmlType;
Begin
EXECUTE IMMEDIATE (fnExecV(sql_in)) into x;
return x;
end;
If I execute the first one and paste my results into the second one it executes and returns the expected result.
However, I cannot figure ont how to just take what is in x and put it into the next function I need to execute and return the result from that.
I would like to just execute it in the first one and return the XmlType from the first function or have a function that calls the first one, gets the result, passes it to the second and returns the xmltype.
Any help would be much appreciated.