Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037318Openbravo ERPZ. Otherspublic2017-11-17 10:302023-05-02 09:24
jainsapna581 
Triage Platform Base 
urgentcriticalalways
newopen 
107
3.0PR17Q1.1 
 
Google Chrome
My Openbravo Tab
Packaging and release
No
0037318: function which returns table
We are creating a function which returns table and able to export and package it in functional state. But when we install this module, we get below error for the procedure and procedure does not get created.

[java] 55489 WARN - SQL Command failed with: ERROR: cannot use RETURN QUERY in a non-SETOF function
[java] Position: 1596
[java] 55497 WARN - -- END
[java] -- -----------------------------------------------------------------------
[java] -- FUNCTION API_GETDATA
[java] -- -----------------------------------------------------------------
[java] CREATE OR REPLACE FUNCTION API_GETDATA(pcs OUT NUMERIC, quantity OUT NUMERIC)
[java]

Is there any way or alternative for such procedures where we need to return a table from procedures
1. Create the below function

CREATE OR REPLACE FUNCTION api_getdata()
  RETURNS TABLE(pcs integer, quantity integer) AS
$BODY$
/******************************************************************************/
BEGIN
  RETURN QUERY select count(*) as pcs,round(qtyonhand,2) as quantity
from api_data;
END ; $BODY$
  LANGUAGE plpgsql VOLATILE


2. package it and install in other environment
No tags attached.
causes feature request 0052297 new Triage Platform Base Add SETOF return value 
Issue History
2017-11-17 10:30jainsapna581New Issue
2017-11-17 10:30jainsapna581Assigned To => Triage Finance
2017-11-17 10:30jainsapna581Web browser => Google Chrome
2017-11-17 10:30jainsapna581Modules => My Openbravo Tab
2017-11-17 10:30jainsapna581Regression level => Packaging and release
2017-11-17 10:30jainsapna581Triggers an Emergency Pack => No
2023-04-29 01:33axelmercadoRelationship addedcauses 0052297
2023-05-02 09:24aferrazAssigned ToTriage Omni OMS => Triage Platform Base

There are no notes attached to this issue.