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?
Answers were Sorted based on User's Feedback
Answer / yuvaevergreen
>>Cursors are memory structures used to handle multiple
rows at a time.
>>Though,select statement can fetch only multiple rows, we
cannot handle multiple rows using host variables.
Basic difference would be single row handling and multiple
rows handling.
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / 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 |
What is null value in db2?
Is the primary key a clustered index?
What is -904 sql code? How to resolve it?
What is the advantage in De-normalizing tables in DB2?
What is sqlcode -811?
7 Answers Accenture, CTS, TCS,
how to copy the host variables from ps file into cobol program other than include statement
How connect db2 database to datastage?
What is meant by dclgen?
why should we bind the DB2 program . What if we did not BIND a BD2 program ??
9 Answers Infosys, TCS, Xansa,
How do you concatenate the firstname and lastname from emp table to give a complete name?
Which component is responsible for db2 startup and shutdown?
Where are plans stored?