| From: | Alfonso Peniche <alfonso(at)iteso(dot)mx> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Select in function? |
| Date: | 2001-02-07 00:33:15 |
| Message-ID: | 3A8097CB.D578BA8E@iteso.mx |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2001-02-07 00:35:14 | Re: pg_dump crash |
| Previous Message | Matt Friedman | 2001-02-07 00:05:16 | How to unlock a table? |