SQL1:
select regno from student where regno **like 'ABCD%'**
This is running successfully. But how can I write like 'ABCD%' dynamically?
For example:
CREATE OR REPLACE FUNCTION check_regno(refcursor, character varying)
RETURNS refcursor AS
$BODY$
begin
select regno from student where regno $1
return $1;
end;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
Now I want to pass $1 as like 'ABCD%' i.e.:
select check_regno(f1, "like 'ABCD%'")
This will give error at $1
:
Please suggest how to achieve this.