View previous topic :: View next topic
|
Author |
Message |
monasu1998
Active User
Joined: 23 Dec 2005 Posts: 176 Location: India
|
|
|
|
Hi All:
There is a Program which deletes records from a DB2 table.
If the table is empty (i.e. no records in the table) what will happen???
It will abend, or give any error?
If error that will be a SQL error o any other error code??
It was an interview question....
Thanks in Advance. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
It depends how the program deletes the records. Can you give us the SQL snippest from the program?
O. |
|
Back to top |
|
|
Prajesh_v_p
Active User
Joined: 24 May 2006 Posts: 133 Location: India
|
|
|
|
If you are using direct DELETE query to delete rows, there will not be any sql error if the table is empty. |
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Hi Monasu1998,
It all depends on the way the program's coded!
When a DELETE query is executed against an empty table, it returns an SQLCODE of +100, mind you this's not an error.
But, if your program has a piece of code like this (assuming the launguage to be COBOL):
IF SQLCODE = +100
PERFORM Z010-CALL-ABEND
END-IF.
and Z010-CALL-ABEND invokes the ABEND routine, the job will abend.
But for that interview question, "an SQLCODE of +100" would have been the best answer.
Cheers, Twissi. |
|
Back to top |
|
|
|