Re: get value after updating table

Поиск
Список
Период
Сортировка
От Martin Gainty
Тема Re: get value after updating table
Дата
Msg-id BAY133-DAV13AB3A2168861FE0D30F17AE6F0@phx.gbl
обсуждение исходный текст
Ответ на get value after updating table  ("Alain Roger" <raf.news@gmail.com>)
Список pgsql-general
roger-
you need an exception block as in...
CREATE OR REPLACE FUNCTION sp_a_005("login" "varchar", pwd "varchar")
  RETURNS boolean AS
$BODY$
BEGIN
 UPDATE...
EXCEPTION
 WHEN NO_DATA_FOUND
   RETURN FALSE
 WHEN PROGRAM_ERROR
   RETURN FALSE
 WHEN OTHERS
   RETURN FALSE
RETURN TRUE
END;
---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
---------------------------------------------------------------------------
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message -----
Sent: Monday, March 26, 2007 3:38 PM
Subject: [GENERAL] get value after updating table

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

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

Предыдущее
От: "Alain Roger"
Дата:
Сообщение: get value after updating table
Следующее
От: Ron
Дата:
Сообщение: A (hopefully) simple question re: secure pg <=> web application access