I’m following this AWS Redsfhit documentation to create a stored procedure that returns a result set using a cursor, but I keep getting the following error:
Number of cells in the row (0) does not match number of headers (1) [ErrorId: 1-67d7d631-44e721da51cfca6a75a2bd27]
Here’s the stored procedure I created:
CREATE OR REPLACE PROCEDURE get_result_set (rs_out INOUT refcursor)
AS $$
BEGIN
OPEN rs_out FOR
SELECT * FROM sales;
END;
$$ LANGUAGE plpgsql;
And here’s how I’m invoking it:
BEGIN;
CALL get_result_set('mycursor');
FETCH ALL FROM mycursor;
COMMIT;
The error occurs after executing the CALL get_result_set('mycursor'); command.
I’ve verified that the sales table contains data, but I’m unsure what I’m doing wrong, as this is a very simple procedure based on the documentation.
salescontains data, and I'm selecting it all from the stored procedure..