The DESCRIBE CURSOR data manipulation statement directs CA IDMS to return information about the result set associated with a received cursor into an SQL descriptor area.
Use this statement only in SQL that is embedded in a program.
Specifies the name of the cursor whose result set is to be described. The cursor must have been previously associated with a returned result set using the ALLOCATE CURSOR statement.
Specifies the SQL descriptor area where CA IDMS is to return information about the result set with which the cursor is associated.
Directs CA IDMS to use the named area as the descriptor area. descriptor-area-name must identify an SQL descriptor area.
The GET_EMPLOYEE_INFO procedure returns two result sets for a given EMP_ID:
Note: For more information about how to define this procedure, see the examples in CREATE PROCEDURE.
* Invocation of the procedure GET_EMPLOYEE_INFO.
exec sql
call GET_EMPLOYEE_INFO(1003)
end-exec
* The dynamic cursor 'RECEIVED_CURSOR' is associated with the first result set.
* The received cursor is in the open state.
exec sql
allocate 'RECEIVED_CURSOR' for procedure specific procedure
GET_EMPLOYEE_INFO
end-exec
* The 'RECEIVED_CURSOR' cursor info is being described
exec sql
describe cursor 'RECEIVED_CURSOR' structure
using sql descriptor SQLDA-AREA
end-exec
* The COVERAGE info is being processed.
* The statement is executed in a loop until the SQLSTATE indicates NO MORE DATA..
exec sql
fetch 'RECEIVED_CURSOR' into :BUFFER-COVER
using descriptor SQLDA-AREA
end-exec
* The dynamic cursor 'RECEIVED_CURSOR' is associated with the second result set.
* The received cursor is in the open state.
exec sql
close 'RECEIVED_CURSOR'
end-exec
. .
* The 'RECEIVED_CURSOR' info is being described
exec sql
describe cursor 'RECEIVED_CURSOR' structure
using sql descriptor SQLDA-AREA
end-exec
. . .
* The BENEFITS info is being processed
* The statement is executed in a loop until the SQLSTATE indicates NO MORE DATA
exec sql
fetch 'RECEIVED_CURSOR' into :BUFFER-BENEF
using descriptor SQLDA-AREA
end-exec
* Close the cursor
exec sql
close 'RECEIVED_CURSOR'
end-exec
|
Copyright © 2014 CA.
All rights reserved.
|
|