in the CURSOR declare statement, if i am using an where
clause and trying to compare the value with a host-varialble.

EXEC SQL DECLARE C1 CURSOR FOR
SELECT DEPTNO, DEPTNAME, MGRNO
FROM DEPARTMENT
WHERE ADMRDEPT = :ADM-DEPT
Where would i need to provide value to this host-variable in
the where clause. how could i pass value to this
host-variable to check it.

Answers were Sorted based on User's Feedback



in the CURSOR declare statement, if i am using an where clause and trying to compare the value with..

Answer / mandar panse

Before opening this cursor thru OPEN <cursor_name>. because
when we open the cursor, it fetches all matching records
from table and stores them in buffer. so it evaluates that
where clause while opening the cursor.

Is This Answer Correct ?    8 Yes 1 No

in the CURSOR declare statement, if i am using an where clause and trying to compare the value with..

Answer / nagendra

before open cursor we can populate that value
ex move 1220 to adb-dept

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More DB2 Interview Questions

how to get duplicate records from tables?write qurey for this?

4 Answers   ANZ,


What is the use of reorg in db2?

0 Answers  


when does the SQL statement gets executed when you use cursor in the application programming ?

3 Answers   IBM,


What is alias in db2?

0 Answers  


What is an asychronous write?

1 Answers  


File not opened because library is *PROD and debug is UPDPROD(*NO). ? what may be the reason? how to solve it..?

0 Answers   Infosys,


Is the primary key a clustered index?

0 Answers  


can any one give the list of some important sql abend codes which r frequently asked in interviews?

2 Answers  


When can an insert of a new primary key value threaten referential integrity?

2 Answers   Mind Tree,


What is a DBRM, PLAN ?

3 Answers  


Why PS file called Physical seqential file?How to sore data in sequential file and ESDS file? What is the use of DBRM,PLAN,package and Collection.

1 Answers  


select 100 records from million records ?

2 Answers   Verizon,


Categories