View previous topic :: View next topic
|
Author |
Message |
CIS777 Currently Banned New User
Joined: 16 Sep 2005 Posts: 6
|
|
|
|
EXEC SQL INSERT INTO T1 (C1, C2, C3, C4, C5) VALUES
(:HV1, :HV2, :HV3, :HV4, :HV5) END-EXEC.
Which of the following statements correctly describe what happens when the above statement is executed in PGM1?
A. The statement will succeed if each of the columns is defined as NOT NULL
WITH DEFAULT.
B. If an SQLCODE -803 is encountered, an update statement can be issued to modify the non-key columns of T1.
C. PGM1 will automatically be rolled back if the values for HV1 and HV2
already exist.
D. The statement will fail because only 5 of the 6 columns are specified.
E. The statement will return an SQLCODE -104. |
|
Back to top |
|
|
ikumar
New User
Joined: 02 Aug 2005 Posts: 81
|
|
|
|
i think it could be option B. |
|
Back to top |
|
|
reshma
New User
Joined: 10 Sep 2005 Posts: 9 Location: software engineer
|
|
|
|
i think option A is correct.option with -104 code is irrelevant. |
|
Back to top |
|
|
sandeep4u
New User
Joined: 12 Aug 2005 Posts: 32
|
|
|
|
Hi,
answer is option A......... |
|
Back to top |
|
|
ikumar
New User
Joined: 02 Aug 2005 Posts: 81
|
|
|
|
It is not necessary to have all the columns defined with "NOT NULL WITH DEFAULT" option. just "NOT NULL" is enough to execute as all the 5 columns are specified in VALUE clause.
If there are any other columns other than the 5 mentioned then only you need "WITH DEFAULT" option.
that is why i have chosen the answer B.
Please let me know if i am wrong... |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi CIS777!
For a moment forget about OPTION A.
Option B says " If an SQLCODE -803 is encountered, an update statement can be issued to modify the non-key columns of T1. "
-803 error occurs if any duplicate row is found. we should issue a update statement to modify KEY-COLUMNS (Not Non-Key columns) of T1 table. So this option is ruled out.
Option C says "PGM1 will automatically be rolled back if the values for HV1 and HV2 already exist. "
We dont know what are the key columns and we are not sure how the program is handling SQL abends for the given query. So we can't judge by this statement. So this is ruled out.
Option D says "The statement will fail because only 5 of the 6 columns are specified. "
we are not sure for this statement too as they didn't mention the number of columns here. Who knows the 6th column may allow nulls too. So this option is also ruled out.
Option E says "The statement will return an SQLCODE -104"
The given SQL statement is fine. So this too ruled outttttttt
Now the left over is option A. There is no harm if we code not null with Default. So guys, Option A is correct.
HTH, |
|
Back to top |
|
|
|