On Wednesday 13 Nov 2002 10:24 am, Roberto de Amorim wrote:
> 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"
I think perhaps it should be:
SELECT INTO V_PAYMENT,V_VALUE "DATE_PAYMENT","VALUE"...
> so, if I want get 10 columns, must I do 10 SELETCs???
If you want 10 columns, you might prefer to select into a record variable and
reference the columns as required.
http://www.postgresql.org/idocs/index.php?plpgsql-statements.html
--
Richard Huxton