EDB OCL Connector, version 13.1.4.2 is certified with OTL 4.0. To use OTL supported datatypes and for other OTL specific behaviour, OTL environment variable should be defined on the shell before running OTL based app. The value of OTL is not important, just it should be defined. For example: You can export OTL=TRUE for conditional execution of scenarios which are related to OTL.
EDB OCL Connector is certified with the following OTL features:
Connect, disconnect, commit and rollback using otl_connect.
Constant SQL Statements (A SQL statement is constant if it does not have any bind variables) using static function otl_cursor::direct_exec. It includes most DDL statements like CREATE TABLE and CREATE PROCEDURE/FUNCTION.
SQL Statements with bind variable using otl_stream class. It includes most DML statements like SELECT, UPDATE, DELETE, INSERT, and PROCEDURE/FUNCTION calls.
Date/Time data types using otl_datetime.
Raw/Long Raw data types using otl_long_string.
Ref Cursors using otl_refcur_stream.
Examples
Connect and Login
The following code demonstrates how to initialize OCL and connect to a database using tnsnames.ora based connection string:
CREATE TABLE, INSERT, and SELECT
The following code demonstrates the use of otl_cursor::direct_exec to create a table and then insert a row in this table. You can then use otl_stream to retrieve the inserted row.
UPDATE
The following code demonstrates the use of bind parameters in an UPDATE statement:
Stored Procedure
The following code demonstrates how to create a stored procedure using otl_cursor::direct_exec and then call it using otl_stream:
Function
The following code demonstrates how to create a function using otl_cursor::direct_exec and then call it using otl_stream:
Note
This example is using emp table in the edb sample database.
REF CURSOR
The following code demonstrates how to create a package with a procedure that returns three REF CURSORs as OUT parameters and then calls it:
Note
This example is using emp table in the edb sample database.