Re: sintax???

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: sintax???
Дата
Msg-id Pine.BSF.4.21.0102011749010.19125-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на sintax???  (Alfonso Peniche <alfonso@iteso.mx>)
Список pgsql-general
On Thu, 1 Feb 2001, Alfonso Peniche wrote:

> I have the following:
>
> CREATE FUNCTION RegistrarConexion(char(8),char(16),char(20))
> RETURNS integer
> AS '
>         DECLARE ret integer;
>
>         BEGIN
>                 INSERT INTO BitacoraConexion(username, IPmaquina,
> nombremaquina, conexion)
>                 VALUES ($1, $2, $3, CURRENT_TIMESTAMP);
>
>                 SELECT INTO ret
> currval('bitacoraconex_idbitacoracon_seq');
>
>                 RETURN ret;
>         END;'
> LANGUAGE 'plpgsql';
>
> and if I execute this file I get the following error:
>
> psql:SPRegConex.sql:20: ERROR:  parser: parse error at or near
> "bitacoraconex_idbitacoracon_seq"
>
> I asume it's due to a sintax error having to do with "currval", but I
> can't find what the proper sintax would be for 'plpgsql' for getting the
> last sequence value assigned (I even tried

I believe the problem is that you need to escape the single quotes,
otherwise it thinks you're ending the function text.  Try
currval(''bitacoraconex_idbitacoracon_seq'');



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

Предыдущее
От: Alfonso Peniche
Дата:
Сообщение: sintax???
Следующее
От: Hunter Hillegas
Дата:
Сообщение: Update Log