SELECT INTO

From: "Roberto de Amorim" <roberto(at)smartbit(dot)inf(dot)br>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SELECT INTO
Date: 2002-11-13 10:24:32
Message-ID: 005a01c28afe$dc72ea00$04c8a8c0@Desenvolvimento
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)smartbit(dot)inf(dot)br

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Verger Nicolas 2002-11-13 10:40:26 RE : RE : Stability problems
Previous Message Shridhar Daithankar 2002-11-13 10:00:15 Re: Upgrade to dual processor machine?