On Mon,  3 Dec 2001 11:01:23 +0100, Joern Reder wrote:
> But if it would work, as it should (in my opinion and like it does in 
> any other dbms I know), I can write the following code, which is much 
> more elegant and more effective than explicite checking of conditions:
> 
>   begin work
> 
>   update table y
>   insert into table z
> 
>   try
>       insert into table x
>       commit
> 
>   catch pk_constraint_violation
>       update table x
>       commit
> 
>   catch the rest
>       rollback
>       print error message

You can do it with one check:

try
    if( ! update table x )
        insert into table x
    commit
catch all
    rollback
    print error messge

Surely your application ought to know whether it should be doing an insert
or an update anyway?


-- 
        Peter Haworth   [EMAIL PROTECTED]
Bare feet magnetize sharp metal objects so they point upward from the floor,
especially in the dark.

Reply via email to