Subject | RE: [IBO] Generators and row selections |
---|---|
Author | Norman Dunbar |
Post date | 2001-08-07T09:13:33Z |
Don,
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
----------------------------------------------------------------------------
----
>> Hi Norman, the trigger doesn't check for a null value before insertingthe
>> 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
----------------------------------------------------------------------------
----