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 |
What are the different types of base tables?
what are bind concepts in db2 cobol?
Where is the access path logic created by the DB2 Optimizer stored?
How do you declare a host variable (in COBOL) for an attribute named emp-name of type VARCHAR(25) ?
Is it Possible to read from PS file and write it to database by using dynamic sql(execute immediate)
What is the connection string to connect to the DB2 Database ?
Lot of updates have been done on a table due to which indexes have gone haywire. What do you do?
How to resolve -803 sql code in DB2?
How can the duplicate values be eliminated from db2 select?
What do you mean by NOT NULL? When will you use it?
Which command is used to connect to a database in DB2 ? Give the Syntax.
What information is held in SYSIBM.SYSCOPY?