Respected Sir
This is srinvas.
I have been working with Postgresql and have created tables,constraints and so on.
Now i am writing stored functions using refcursor and the stored function have created successfully. But i have problem to validate the parameters passed in the call function..
The query in function returns all the rows with the following statement.
open refcursor for 'select statement'; // without parameters validation
Now i want to validate the parameters and add those validations to the above select query to restrict the output when the parameter is not null.
Example:
if parameter1 is not null then
sqlstring := sqlstring || ' where num=1';
else
sqlstring:= ' ';
end if
open refcursor for ' select statement ' || sqlstring; // Query should be .... select * from table_name where num=1;
When i used the above statements and execute the function it's not returning the data even the parameter validation is true(num=1 is existing).
Please help on above issues and also let me know how to diplay string values (sqlstring).
Example :-(in oracle)
dbms_output.put_line(sqlstring);
I would be very greatful if you could accelerate your reply.
Thank you
Best Regards
Srinivas