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 ..
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
|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
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;
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|
Suppose if I need to update a column, how you do that using cursor?
List down the data types in the db2 database.
How do we specify index to include or not during bind process.
Explain an outer join?
What are the benefits of using the db2 database?
What technique is used to retrieve data from more than one table in a single SQL statement?
What's the Maximum Length of SQLCA and what's the content of SQLCABC?
How can you display the current date & current time ?
How to retrieve rows from a db2 table in embedded sql?
Highlight all the advantages that are attached to a package.
What is a predicate?
What happens to the PLAN if index used by it is dropped?