What error I will get if my select query gives multiple
row while executing a Cobol-DB2 program.How can I solve it
without using a cursor.

Answers were Sorted based on User's Feedback



What error I will get if my select query gives multiple row while executing a Cobol-DB2 program.H..

Answer / nitin sharma

Hi,

You will get -811 SQLCODE if more than one rows will be
returned by your query.

To avoid this you can also use FETCH FIRST 1 ROWS ONLY in
your query like

SELECT * FROM EMP
FETCH FIRST 1 ROWS ONLY;

Hope this helps.

Nitin

Is This Answer Correct ?    11 Yes 0 No

What error I will get if my select query gives multiple row while executing a Cobol-DB2 program.H..

Answer / dedu

-811 ERROR CODE

Is This Answer Correct ?    6 Yes 0 No

What error I will get if my select query gives multiple row while executing a Cobol-DB2 program.H..

Answer / mangesh

Thanks Debu & Santy

Is This Answer Correct ?    5 Yes 1 No

What error I will get if my select query gives multiple row while executing a Cobol-DB2 program.H..

Answer / santy

u will get -811 error code.

this will b solve in different way. first u have to find
out y this error comes.
exmple :-
If u r selecting the address of the emp with help of
Name key, then may b same name contain 2 different address,
as per the business need, it may contain 1 defualt address
and other is alternet address.
So as per the business need find out that which address
u want to select, and as per this need u can use one flag
veriable to differentiate these 2 address. make the change
as per above in ur table. with the help of solution u can
solve the above problem without using the cursor.

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More DB2 Interview Questions

What is the physical storage length of the data types date, time, and timestamp?

0 Answers  


What if , we failed to mentioed null indicator in sql select query , that may retrieve null value ?

2 Answers   Cap Gemini,


if any of the column names is provided wrong, where do you get the error(during precompilation or during Bind)

3 Answers  


What is runstats and reorg in db2?

0 Answers  


How can you split a table in to exactly half?

7 Answers   HSBC,






How is the SUBSTR keyword used in sql?

1 Answers  


when we are tying to update a table having 100 rows. if the program abends when updating 51 row . how to start updating again from the 51 row .what was the logic

2 Answers   TCS,


I have a subprogram B calling from mainprogram A.I have opened a cursor in A ,Can i fetch the same cursor in subprogram B , If yes , Please explain the reason?

1 Answers   HeadStrong,


how to unload different table data into different gdg files/ vsam files.

3 Answers  


What is IMAGECOPY ?

6 Answers  


What is sqlcode -811?

7 Answers   Accenture, CTS, TCS,


Cursors can be declared in both working-storage & procedure division, agreed. But is there any difference? If could you please suggest what is the difference

0 Answers  


Categories