Subject RE: [IBO] Generators and row selections
Author Don Schoeman
Aahhhh, this makes sense. Thanks for your help! (Norman, Svein and Riho)

-----Original Message-----
From: Norman Dunbar [mailto:ndunbar@...]
Sent: 07 August 2001 11:14
To: 'IBObjects@yahoogroups.com'
Subject: RE: [IBO] Generators and row selections


Don,

>> Hi Norman, the trigger doesn't check for a null value before inserting
the
>> new value.

this is the source of your problem then - you need to test for null, and
only get the generator number if null is detected - something like :

...
BEGIN
IF (NEW.CUST_ID IS NULL) THEN
NEW.CUST_ID = GEN_ID(CUST_ID_GEN, 1);
END

(Off top of head so be prepared for possible syntax errors - I'm mainly
doing Oracle SQL these days (if I can be excused for mentioning such words
on this list) and I get confused !)

You are grabbing a number via the generator links and then, on insert,
grabbing another which overwrites the first.

Norman.

----------------------------------------------------------------------------
----
Norman Dunbar EMail: NDunbar@...
Database/Unix administrator Phone: 0113 289 6265
Lynx Financial Systems Ltd. Fax: 0113 201 7265
URL: http://www.LynxFinancialSystems.com
----------------------------------------------------------------------------
----




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/