SELECT INTO

From: "Roberto de Amorim" <rbamorim(at)ig(dot)com(dot)br>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SELECT INTO
Date: 2002-11-12 13:14:07
Message-ID: 003e01c28a4d$61e508b0$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

Browse pgsql-general by date

  From Date Subject
Next Message frank_lupo 2002-11-12 13:46:44 psql write in vbs download now
Previous Message Savita 2002-11-12 12:40:09 pgadmin II problem