Hi , I am posting some interview ques .
what is the use of cursors ? what is the diff between
select and cursor ? bith are used for data retrival ..
rite?
Answer Posted / reddy
cursors are used to retrieve multiple rows . Cussors will
retrieve one row at a time and save the data in the
hostvariables.For retreiving the 2 nd row, we need to
repeat the loop.the same process is continued at the end of
data.
select stmt will retrieve multiple rows at a time. assume
that there are 10 rows in a table.
EX: EXEC SQL
SELECT empno , ename into :hvempno ,:hvename from emp;
END EXEC;
Here the above sql query reults all the 10 rows. But , the
host variables will hold only one row of data.the remaining
9 rows will not be stored any where.
hope this may help u
| Is This Answer Correct ? | 4 Yes | 4 No |
Post New Answer View All Answers
Which isolation level provides maximum concurrency?
What is reorg and runstats in db2?
What is a bind card?
before altering a table is it necessary to lock ? if lock what is it ? how to do ? ifi want to lock a table what is that command ?
Why select is not preferred in embedded sql programs?
For a db2 column that is being defined as decimal (11, 2), discuss the cobol picture clause.
Which components manage deadlocks in db2?
How to retrieve rows from a db2 table in embedded sql?
What is the reason behind not using select * in embedded sql programs?
Differentiate between cs and rr isolation levels? Where do you specify them?
What r the comman abends in db2, jcl and cobol???????
File not opened because library is *PROD and debug is UPDPROD(*NO). ? what may be the reason? how to solve it..?
How to take backup of table in db2?
Explain dclgen.
How is deadlock resolved?