2010/10/31 Alexander Farber <alexander.farber@xxxxxxxxx>: > Thanks Pavel, but I have an SQL procedure and not plpgsql? it's not possible in sql. But plpgsql is same level like stored procedures language from mysql. > > On Sun, Oct 31, 2010 at 9:34 AM, Pavel Stehule <pavel.stehule@xxxxxxxxx> wrote: >>> But how can I detect that the UPDATE has failed in my SQL procedure? >>> >> >> see: http://www.postgresql.org/docs/8.4/interactive/plpgsql-control-structures.html >> near to end of page > >>> Â Â Â Âcreate or replace function update_pref_users(id varchar, >>> Â Â Â Â Â Âfirst_name varchar, last_name varchar, female boolean, >>> Â Â Â Â Â Âavatar varchar, city varchar, last_ip inet) returns void as $$ >>> >>> Â Â Â Â Â Â Â Âupdate pref_users set >>> Â Â Â Â Â Â Â Â Â Âfirst_name = $2, >>> Â Â Â Â Â Â Â Â Â Âlast_name = $3, >>> Â Â Â Â Â Â Â Â Â Âfemale = $4, >>> Â Â Â Â Â Â Â Â Â Âavatar = $5, >>> Â Â Â Â Â Â Â Â Â Âcity = $6, >>> Â Â Â Â Â Â Â Â Â Âlast_ip = $7 >>> Â Â Â Â Â Â Â Âwhere id = $1; >>> >>> Â Â Â Â Â Â Â Â-- XXX how to detect failure here? XXX >>> >>> Â Â Â Â Â Â Â Âinsert into pref_users(id, first_name, last_name, >>> Â Â Â Â Â Â Â Â Â Âfemale, avatar, city, last_ip) >>> Â Â Â Â Â Â Â Â Â Âvalues ($1, $2, $3, $4, $5, $6, $7); >>> Â Â Â Â$$ language sql; > > -- > Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general