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

How many types of page locks can be held in db2?

0 Answers  


How to resolve -818 sql code in DB2?

2 Answers   Cap Gemini,


select distinct(empid),distinct(dept),name from EMP will the above query work?

2 Answers   CTS,


Can a unique index have more than one null value? If not, what error code is given if an attempt is made to insert more than one null value?

3 Answers  


What is FREEPAGE and PCTFREE in TABLESPACE creation?

1 Answers  






What are the disadvantages of using VARCHAR?

3 Answers  


What is netezza database?

0 Answers  


What is a db2 collection?

0 Answers  


How is a typical DB2 batch program executed ?

1 Answers  


in GDG: is it poosible to copy records from a file which utilizes some 100 cylinders to a gdg whose model is defined as trk(1,0) and also it possible to copy 100 bytes file to 80 bytes file?

1 Answers   IBM,


what will be the output of the below given query, if no matching records are found : (a.) 0 (b.) null (c.) error select Avg(salary) from TableA where Deptno = 'insurance'

10 Answers   Amdocs,


What are PACKAGES ?

3 Answers  


Categories