skip to main content

Embedded SQL Statements : ALLOCATE

ALLOCATE
The ALLOCATE statement allows to define and allocate host variables.
General Format
EXEC SQL [AT Database]
  ALLOCATE Host-Variable [Variable-Type]
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
        open :cur-hndl for select * from emp;
   end;
exec sql fetch :cur-hndl into :empno,:ename
exec sql free :cur-hndl

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left