get value after updating table

From: "Alain Roger" <raf(dot)news(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: get value after updating table
Date: 2007-03-26 19:38:07
Message-ID: 75645bbb0703261238i531e44b0yf7242c9e664906b9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I wrote a function which should update a table field.
However, i would like somehow to control that update was done.
for that i was thinking to return a boolean : true is update was done, false
if an error happened.

however, i can i do that ? I mean how can i know if UPDATE has been
correctly executed ?

here is my function :
CREATE OR REPLACE FUNCTION sp_a_005("login" "varchar", pwd "varchar")
RETURNS boolean AS
$BODY$

DECLARE

BEGIN
UPDATE accounts
SET account_pwd = $2
WHERE account_login = $1;
RETURN;

END;

--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2007-03-26 20:06:55 Re: get value after updating table
Previous Message Jesse Cleary 2007-03-26 19:29:36 Could not create relation: File exists error