Re: Starting with pl/pgsql..

Поиск
Список
Период
Сортировка
От Josh Jore
Тема Re: Starting with pl/pgsql..
Дата
Msg-id Pine.BSO.4.44.0207060748590.13956-100000@kitten.greentechnologist.org
обсуждение исходный текст
Ответ на Starting with pl/pgsql..  (Terry Yapt <yapt@technovell.com>)
Список pgsql-novice
Ok so I don't know a thing about Oracle. If you didn't already notice them
there are multiple docs on techdocs.postgresql.org on porting from oracle.

Now your function:

>                 Table "pepe"
>  Column |         Type          | Modifiers
> --------+-----------------------+-----------
>  a      | numeric(2,0)          | not null
>  b      | character varying(50) |

> -- Function: x(int4, int4)
> CREATE FUNCTION "x"("int4", "int4") RETURNS "int4" AS '  DECLARE

You may want to avoid the use to double-quoting your identifiers. Without
the quotes PostgreSQL will fold the case to the default lower case and
you're restricted to single word identifiers. With quotes you can go and
create identifiers like "BiCap" or even "multiple words". I'll just define
that as a problem waiting to happen. I wouldn't go there unless you had
some real reason to force case sensitivity.

>      inicio alias for $1;
>      final alias for $2;
>      --
>      texto varchar;
>   BEGIN
>     FOR X IN inicio..final LOOP
>        texto := "ESTE ES: " || X;

Again double quotes. Substitute single quotes instead. Use double quotes
for identifiers and single quotes for identifiers. You are already in a
single-quoted section so quote the single quote ala:

texto := ''ESTE ES: '' || X;

>        INSERT INTO pepe VALUES (X, texto);
>     END LOOP;
>   END;
> ' LANGUAGE 'plpgsql';

Josh




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

Предыдущее
От: Andrew McMillan
Дата:
Сообщение: Re: Carraige Return issue
Следующее
От: Terry Yapt
Дата:
Сообщение: Re: Starting with pl/pgsql..