View previous topic :: View next topic |
Author |
Message |
Catherine Beginner
Joined: 30 Aug 2006 Posts: 32 Topics: 15 Location: Chennai
|
Posted: Wed Jul 01, 2009 4:30 am Post subject: -438 sqlcode |
|
|
Hi,
Im getting -438 SQLCODE while inserting a row in DB2 table. Can you please help me why is this error occuring. Imnt able to underatand the description provided for this sqlcode
Thanks
Catherine |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Jul 01, 2009 4:38 am Post subject: |
|
|
I imagine that there is an INSERT TRIGGER associated with your table.
If there was no text provided in the DSNTIAR output, then the trigger creator was rather lazy.
Search you sysibm tables for the trigger associated with your table,
and determine, from the trigger ddl - sqlstate may help - why your INSERT was invalid. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Jul 01, 2009 5:11 am Post subject: |
|
|
I have updated my previous post. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
Catherine Beginner
Joined: 30 Aug 2006 Posts: 32 Topics: 15 Location: Chennai
|
Posted: Wed Jul 01, 2009 7:51 am Post subject: |
|
|
Hi dina,
Thanks very much for info |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Jul 01, 2009 12:31 pm Post subject: |
|
|
Quote: |
Errors when executing triggers: Severe errors that occur during the execution of triggered SQL statements are returned with SQLCODE -901, -906, -911, and -913 and the corresponding SQLSTATE. Non-severe errors raised by a triggered SQL statement that is a SIGNAL SQLSTATE statement or that contains a RAISE_ERROR function are returned with SQLCODE -438 and the SQLSTATE that is specified in the SIGNAL SQLSTATE statement or the RAISE_ERROR condition. Other non-severe errors are returned with SQLCODE -723 and SQLSTATE 09000
|
_________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Jul 01, 2009 12:57 pm Post subject: |
|
|
dbzTHEdinosauer,
Am I interpreting it wrong? I understood that even in triggers you should be using raise_error function or SIGNAL SQLSTATE statement to get the error of -438. what am I missing here?
Kolusu |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Jul 01, 2009 1:15 pm Post subject: |
|
|
Triggers and Stored Procs, when they SIGNAL - setting the SQLSTATE - will automatically generate a -438 sqlcode (or +438 if first two of sqlstate are 00 or 01).
When someone attempts an insert on a table, that has an insert trigger, if the trigger wishes to 'create an error', the SIGNAL sqlstate is used - which automatically sends a -438. When a trigger can generate more than one error or to differentiate between different triggers, different sqlstates can be used (along with an info text) so that people will know what trigger they violated.
upon finish of the stored proc or trigger (return to the sql statement - INSERT in this case), the sql statement originally executed will return an SQLCODE of -438.
I hope that I have interpreted your question properly. The TS did not know why -438 was returned for the INSERT. I suggested interrogation of triggers on the table in question. I failed to mention that stored procs should also have been searched. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Jul 01, 2009 1:30 pm Post subject: |
|
|
dbzTHEdinosauer,
Thanks. My DB2 knowledge is getting rusty
kolusu |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Jul 01, 2009 3:13 pm Post subject: |
|
|
Tell you a little story:
while back I was consulting at a site where my contract was to make a modification whereby a value of zero would not be allowed as a column value, an error that was happening in 'certain' cases. A little research showed me that the idiots at this site had 19 modules that would make an insert of the row and 43 would do an update - to include this column. I showed management that by use of a trigger, we could not only enforce this validation rule, but isolate the code that did not provide proper validation. a 3 month budgeted project was finished in 3 weeks. I remember -438 because I was the point man for -438 sqlcodes comming out of testing.
my contract was eventually extended to cover 18 months. so, I remember -438's. I have forgotten a lot of other negative sqlcodes that I have had to research; but night and day for over a week I slept, ate and drank -438. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
|
|