Please help me to resolve this error.
CREATE OR REPLACE FUNCTION MYCURSOR () RETURNS VARCHAR AS $$
declare
cur1 refcursor;
col_name varchar (10) ;
hstoredata hstore;
BEGIN
col_name = 'id';
OPEN cur1 FOR execute('select * from datas.tb where id =2');
loop
fetch cur1 into hstoredata;
if not found then
exit ;
end if;
Raise Notice '%',hstoredata -> col_name ;
end loop;
close cur1;
return 'r';
END;
$$ LANGUAGE plpgsql
When i try to execute this query it is showing me the error as
ERROR: Unexpected end of string CONTEXT: PL/pgSQL function "mycursor" line 15 at FETCH ********** Error ********** ERROR: Unexpected end of string SQL state: XX000 Context: PL/pgSQL function "mycursor" line 15 at FETCH