Re: SELECT INTO

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: SELECT INTO
Дата
Msg-id 200211131152.45462.dev@archonet.com
обсуждение исходный текст
Ответ на SELECT INTO  ("Roberto de Amorim" <roberto@smartbit.inf.br>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Adam Witney
Дата:
Сообщение: Re: Can not connect to the database
Следующее
От: "Henrik Steffen"
Дата:
Сообщение: Re: Upgrade to dual processor machine?