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.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can any one provide me the link for the db2 v7 & db2 v8 manual for Z/os? i need to know about the syntax of REORG in both versions & need to know the difference as well

1898


Mention the different locking levels that are available in db2.

730


What is explain in db2?

656


How can we read records for specific member in CL? AND rpg?

323


How can you classify the locks in db2?

721






How to run db2 command in windows?

749


Define declaration generator (dclgen).

760


Where can you declare a cursor in a cobol-db2 program?

676


Can you use max on a char column?

718


What is host variable?

683


Where do you specify them?

770


What is lock escalation in db2?

670


How will you return the number of records in table?

595


How do I import a csv file into db2?

650


What is dclgen in db2?

777