I created a procedure with dynamic sql,but cannot run it successfully.
create or replace procedure getdata(string par1, results out cursor)
as
declare sqlBase varchar2(100);
begin
sqlBase := 'open '||results|| ' for select * from studetns';
end;
After running, the following error message pops up:
PLS-00306, wrong number or types of arguments in call to '||'
I just need to filter data by some parameters ,but some parameters may be null or empty, so I need to filter dynamic. like if(par1 is not null) then ........ so here I need to use dynamic sql. in C# programe, use cursor to return result. like here ,I use cursor type to open select statements.
but in sql editor, I get right sql statement.
Can Somebody help me with this?