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
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 |
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 |
How many types of page locks can be held in db2?
How to resolve -818 sql code in DB2?
select distinct(empid),distinct(dept),name from EMP will the above query work?
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?
What is FREEPAGE and PCTFREE in TABLESPACE creation?
What are the disadvantages of using VARCHAR?
What is netezza database?
What is a db2 collection?
How is a typical DB2 batch program executed ?
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?
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'
What are PACKAGES ?