FUNCTION default_refcursor
RETURN SYS_REFCURSOR
AS
v_refcursor SYS_REFCURSOR;
BEGIN
OPEN v_refcursor FOR
SELECT * FROM DUAL WHERE 1 = 2;
RETURN v_refcursor;
END default_refcursor;
the above is cursor from oracle which I have to convert into PostgreSQL (below)
CREATE OR REPLACE FUNCTION prod.common_func_sql$default_refcursor()
RETURNS REFCURSOR
AS
$BODY$
DECLARE
v_refcursor REFCURSOR;
v_refcursor$ATTRIBUTES aws_oracle_data.TCursorAttributes := ROW (FALSE, NULL, NULL, NULL);
BEGIN
v_refcursor := NULL;
OPEN v_refcursor FOR
Select 1 where 1=2 ;
v_refcursor$ATTRIBUTES := ROW (TRUE, 0, NULL, NULL);
RETURN v_refcursor;
END;
$BODY$
LANGUAGE plpgsql;
I am getting an error as <unnamed portal 1>. Can anyone highlight what changes are needed, please? The code mentioned in lower section is not working can someone give suggestions?