SELECT INTO - Mailing list pgsql-general

From Roberto de Amorim
Subject SELECT INTO
Date
Msg-id 005a01c28afe$dc72ea00$04c8a8c0@Desenvolvimento
Whole thread Raw
Responses Re: SELECT INTO
Re: SELECT INTO
List pgsql-general
Hi all

I'm tring to do some trigger and I must use a SELECT INTO,
look this:

CREATE OR REPLACE FUNCTION f_lancamentos_pagos() RETURNS opaque AS
'  DECLARE V_VALUE NUMERIC(12,2);
  DECLARE V_PAYMENT TIMESTAMP;
begin
       if tg_op = ''INSERT'' then
            SELECT INTO V_PAYMENT "DATE_PAYMENT",
                                      V_VALUE "VALUE"
            FROM  "PAYMENTS"
            WHERE
              "ID" = NEW.ID;

            ....
        end if
end'
LANGUAGE plpgsql;

but, when this function is called I'm getting the following error message:
ERROR: parser: parse error at or near ''''''

but if do it in 2 SELECTs it runs normally..


            SELECT INTO V_PAYMENT "DATE_PAYMENT"
                        FROM  "PAYMENTS"
            WHERE
              "ID" = NEW.ID;

            SELECT INTO V_VALUE "VALUE"
                      FROM  "PAYMENTS"
            WHERE
              "ID" = NEW.ID;


so, if I want get 10 columns, must I do 10 SELETCs???

thats wrong there??


Roberto de Amorim - +55 48 346-2243
Software engineer at SmartBit Software
Delphi and Interbase consultant
roberto@smartbit.inf.br



pgsql-general by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: Upgrade to dual processor machine?
Next
From: "Henrik Steffen"
Date:
Subject: Re: Upgrade to dual processor machine?