skip to main content

Embedded SQL Statements : FREE

FREE
The FREE statement releases the memory associated to a cursor or prepared statement.
General format
EXEC SQL [AT Database]
  FREE Host-Variable
Syntax rules
1.
Host-Variable must be defined as USAGE HANDLE in DATA DIVISION.
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
This sample allocates a cursor handle, uses it and releases it at the end. Allocate is an Oracle specific SQL statement.
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
Prepare a statement to insert a row, execute it and free the handle.
working-storage section.
77 cmd handle.
procedure division.
exec sql
        "insert into cust_table values (2010,'Evan Raymond','New York')"
exec sql
exec sql
     free :cmd

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