ALLOCATE
The ALLOCATE statement allows you to define and allocate host variables.
General Format
EXEC SQL [ AT Database ]
 
  ALLOCATE Host-Variable [ Variable-Type ]
 
END-EXEC
Syntax Rules
1. Host-Variable must be defined as USAGE HANDLE in DATA DIVISION.
2. Variable-Type is a numeric data-item or literal that specifies the type of the item to allocate. It must reflect one of the java.sql.Types constant values (http://java.sun.com/javase/6/docs/api/constant-values.html#Types.sql). If omitted, iscobol.jdbc.allocate_type setting is considered.
General Rules
1. Database identifies the active connection that will execute the query and must be previously defined using a Format 4 DECLARE statement.
Examples
Allocate is an Oracle specific SQL stmt. This sample allocates a cursor handle, uses it and releases it at the end.
exec sql allocate :cur-hndl end-exec.
 
exec sql execute
   begin
        open :cur-hndl for select * from emp;
   end;
end-exec.
 
exec sql fetch :cur-hndl into :empno,:ename
end-exec.
 
exec sql free :cur-hndl
end-exec.