SELECT is causing a runtime error when used in stored functions: State=42601, Err=7, Msg=ERROR: query has no destination for result data; - Mailing list pgsql-general

From Lothar Bongartz
Subject SELECT is causing a runtime error when used in stored functions: State=42601, Err=7, Msg=ERROR: query has no destination for result data;
Date
Msg-id B07320D7702B46A9838BA1E8DF87DB9D@NOAH
Whole thread Raw
Responses Re: SELECT is causing a runtime error when used in stored functions: State=42601, Err=7, Msg=ERROR: query has no destination for result data;  (Raymond O'Donnell <rod@iol.ie>)
List pgsql-general

It would be great, if you give me a hint on a problem I am having.

 

When I am using "SELECT" in a prepared function called through ODBC / C++ interface, I am getting a runtime Error:

 

State=42601, Err=7, Msg=ERROR: query has no destination for result data;

 

Example:

CREATE OR REPLACE FUNCTION MyTest

(

      IN OUT      v_1 int

 

) AS $$BEGIN

 

      SELECT v_1 = 1;

 

END;$$ LANGUAGE plpgsql

 

 

I can get rid of the error message, when I am changing to Postgres Syntax

      v_1 := 1;

 

However I have no solution for selecting several vars from a table:

Example (which works without problem in MS SQL and MySQL):

 

      SELECT v_ps = sex,

             v_pl = lng,

             v_pa = age,

             v_pr = reg,

             v_pg = grp

         FROM pref

         WHERE memb_id = v_id;

 

How can I get rid of the "query has no destination for result data"?

 

Your help is much appreciated.

 

Kindest regards

 

 

Lothar Bongartz

 

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Constraint exclusion issue
Next
From: Raymond O'Donnell
Date:
Subject: Re: SELECT is causing a runtime error when used in stored functions: State=42601, Err=7, Msg=ERROR: query has no destination for result data;