Re: example of Create Function

Поиск
Список
Период
Сортировка
От Roberto (SmartBit)
Тема Re: example of Create Function
Дата
Msg-id 001901c279f4$1cba2ea0$1501a8c0@NoteBook
обсуждение исходный текст
Ответ на example of Create Function  ("Roberto (SmartBit)" <roberto@smartbit.inf.br>)
Список pgsql-general
>
> Your example is not possible with any PL in PostgreSQL versions prior to
7.3
> (currently in beta testing). However, in 7.3, using PL/pgSQL it looks like
this:

by the way, when does it will be done???


>
> CREATE OR REPLACE FUNCTION my_proc(TIMESTAMP)
> RETURNS SETOF payments
> AS '
> DECLARE
>     rec RECORD;
> BEGIN
>     FOR rec IN SELECT * FROM payments
>     WHERE r_date_payment BETWEEN $1 AND CURRENT_TIMESTAMP LOOP
>        /*here I can do any check for each row of SELECT above!! */


     would I be able to change the value of field? like:
          IF r_value < 0 THEN
             r_value = r_value*-1;


>        RETURN NEXT rec; /* Each RETURN NEXT command returns a row */
>     END LOOP;
>     RETURN;
> END;
> ' LANGUAGE 'plpgsql';
>
> See:
>
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.htm
l
> and
>   http://developer.postgresql.org/docs/postgres/xfunc-tablefunctions.html
>
> HTH,
>
> Joe
>
>


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

Предыдущее
От: Tommi Maekitalo
Дата:
Сообщение: Re: 7.1.3 : pg_dumpall does not work for me
Следующее
От: pilsl@goldfisch.at
Дата:
Сообщение: Re: 7.1.3 : pg_dumpall does not work for me