Friday, June 19, 2009

(Tutorial : SQL) DECLARE CURSOR statement

Similar in function to HLL file declarations (F-specs or FD's)
-No processing actually takes place - just definition

Host variables may be included in the statement

Created using an embedded SELECT command
-most SELECT clauses may be used - ORDER BY, GROUP BY, etc
Must be declared before being referenced

Sample:
C/EXEC SQL
C+ DECLARE empcsr CURSOR FOR
C+ SELECT nbr, nam, sal
C+ FROM emp
C+ WHERE dpt = :dept
C+
C/END-EXEC


You Might Also Want To Visit The Following Tutorial Posts:
AS/400 For Dummies
AS/400 Tutorial
SQL/400 Tutorial
Query/400 Tutorial


No comments:

Post a Comment