Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Transactions
Date: Aug 26 1999 2:04PM

David Owen writes:
 > At 04:13 PM 25/08/99 -0700, Michael Peppler wrote:
 > >Roger Hall writes:
 > > > 
 > > > Hi,
 > > > 
 > > > I was wondering if anyone could explain the following, or point me at
 > > > an example or document that explains what I'm doing wrong. The following
 > > > code runs fine. I run it as a normal user and so the select gives me
 > > > a couple of permission denied errors and then my error saying 'OUCH'.
 > > > If I un-comment the two transaction lines, I still get the two permission
 > > > errors, but my 'OUCH' error no longer gets output.
 > >
 > >What I think happens is that when you have a begin tran the
 > >transaction is automatically rolled back when you hit an error, so the 
 > >raiserror is never called (in this case).
 > >
 > >Although I may be completely wrong, of course!
 > I think you are! :-)  I have written a lot of code that depends on that
 > _not_ happening.  An example is loading a data warehouse.  It is more
 > efficient to try and insert a row, and, if it is already there, to trap the
 > error and then proceed to update it than to test for its existanc before
 > inserting or updating.  However, I cannot explain _why_ you do not get the
 > 'OUCH', if you were to run this directly through isql, you would get the
 > behaviour you expect.

I did run it through isql (well, sqsh) and got the same behaviour as
through ct_sql(). This is normal as the behaviour shoudn't be client

Now WRT testing after vs. before inserts I do that all the time too,
and also within transactions. Maybe it's a question of the severity of 
the error... I don't know what this might be!

Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-
Sybase on Linux mailing list: