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

which authority can be granted to group of users using the GRANT stmt? A) SYSCTRL B) SYSADM C) DBCTRL D) DB ADM

3 Answers   Accenture,


How to define the data items to receive the fetch items for the SQL?

2 Answers  


is it possible to get -811 error when you use cursors. why?

2 Answers   IBM,


What is difference between rollback and commit?

0 Answers  


How to find schema of a table in db2?

0 Answers  






Describe the elements of the SELECT query syntax?

3 Answers  


Explain the use of the WHERE clause?

1 Answers  


How to find last record before record through SQLRPGLE?

1 Answers   IBM,


How would one remove old reorg information from the DB2 catalog?

2 Answers  


What does the RUNSTATS Utility do?

4 Answers  


db2 query I have one table with the following details. SNO SNAME DOJ ------ -------------------- ---------- 10 KRISH 2007-03-19 20 REDDY 2007-05-19 30 RRRRR 2007-05-19 40 BBBBB 2008-05-19 50 CCCCC 2009-05-19 60 JJJJJ 2009-05-19 70 JJJJJ 2004-05-19 i want the output in the following format:( no of students joined in each year(no nedd to consider about month and date) year count --------- ---------- 2004 1 2007 3 2008 1 2009 2

9 Answers   TCS,


My SQL is not performing well. Describe how will you fine tune it?

1 Answers   Accenture,


Categories