Select in function?

Поиск
Список
Период
Сортировка
От Alfonso Peniche
Тема Select in function?
Дата
Msg-id 3A8097CB.D578BA8E@iteso.mx
обсуждение исходный текст
Ответы Re: Select in function?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: Select in function?  (andrew@modulus.org)
Список pgsql-general
I have the following function:

CREATE FUNCTION RegistrarDesconexion( integer )
RETURNS integer
AS '
    BEGIN
        UPDATE BitacoraConexion
        SET Desconexion = CURRENT_TIMESTAMP
        WHERE IdBitacoraConexion = $1;
        SELECT Desconexion FROM BitacoraConexion
        WHERE IdBitacoraConexion = $1;
        IF FOUND THEN
            RETURN 1;
        ELSE
            RETURN 0;
        END IF;
    END;'
LANGUAGE 'plpgsql';

and if I run:
select registrardesconexion (5);

I get the following error:
ERROR:  unexpected SELECT query in exec_stmt_execsql()

I don't know what's wrong, though I assume it's saying I'm not allowed
to use the select statement where it is.

Any ideas or comments.

Thanx.


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

Предыдущее
От: Warren Vanichuk
Дата:
Сообщение: Deadlock and aborted queries..
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump crash