# OTL 4.0, OTL defined exceptions

# OTL defined exceptions

The following OTL exceptions can be raised by the OTL stream functions:

Code=32000: Incompatible data types in stream operation

- Cause: The data type of a variable used in the current stream operation is not compatible with the declared stream format
- Action: Check placeholders and declarations of their data types

Code=32001: Row must be full for flushing output stream

- Cause: Stream is open for output and has a format of output rows. An output row is a tuple of all output variables put together. The current output row is not filled yet but the flush function is invoked. The stream buffer cannot be flushed until the current row of the output buffer is full.
- Action: Fill the row first, then flush the stream.

Code=32004: Not all input variables have been initialized

- Cause: stream has input variables but not all the variables have been initialized. An attempt to read data from the stream was made.
- Action: Assign all input variables first.

Code=32004: No input variables have been defined in SQL statement

- Cause: Stream has no input variables. An attempt to write objects into the stream via one of the operator << was made.
- Action: Do not call the operator << for streams which have no input variables defined.

Code=32005: Input string value is too large to fit into the buffer

- Cause: Stream is open for output, e.g. an INSERT statement. The actual string value is larger than the buffer size, e.g. "123456789" is the string and the placeholder was defined as :f2<char[5]>
- Action: Truncate the input string or increase the size of the buffer of the placeholder <char[10]>

Code=32007: Input otl_long_string value is too large to fit into the buffer

- Cause: Stream is open for output, e.g. an INSERT statement. The actual otl_long_string is larger than the buffer size, defined by set_max_long_size(), e.g. "123456789" is the long string and the following function call was made set_max_long_size(5).
- Action: Truncate the input long string or increase the size of the max long size: set_max_long_size(100)

Code=32007: PL/SQL table size is too large (>32767)

- Cause: Size of PL/SQL.table to be declared in otl_stream is too large.
- Action: The maximum size of PL/SQL table is limited to 32767 elements.

Code=32008: Writing CLOB/BLOB in stream mode: actual size is greater than specified

- Cause: Actual number of bytes to be written into the LOB stream is greater than specified in the otl_lob_stream::set_len() function.
- Action: Actual number of bytes to be written into the LOB stream should match the number, specified in the set_len() function.

Code=32009: Closing CLOB/BLOB in stream mode: actual size is not equal to specified size

- Cause: When otl_lob_stream::close() is called, it turns out that the number of bytes, written into the LOB stream, does not match the number of bytes, specified in otl_lob_stream::set_len().
- Action: Actual number of bytes to be written into the LOB stream should match the number, specified in the set_len() function

Code=32010: CLOB/BLOB stream is not open for writing

- Cause: An attempt was made to write into the LOB stream, which was not initialized for writing.
- Action: LOB stream that is not open for writing, cannot be used for writing.

Code=32011: CLOB/BLOB stream is not open for reading

- Cause: An attempt was made to read from the LOB stream, which was not initialized for reading.
- Action: LOB stream that is not open for reading, cannot be used for reading.

Code=32012: First session must be started with session_begin()

- Cause: An attempt to call otl_connect::session_reopen() was made, before calling session_begin().
- Action: Change the logic of the program to call session_begin() first, and only after that to call session_reopen().

Code=32013: Invalid bind variable declaration

- Cause: There was a typo in the bind variable declaration, e.g. :var<date>, instead of :var<timestamp>.
- Action: Correct the typo and try again.

Code=32014: No stored procedure was found

- Cause: Stored procedure name, being passed into otl_stream::create_stored_proc_call, cannot be found in the Oracle data dictionary.
- Action: Correct the stored procedure name, and try again.

Code=32015: Unsupported data type

- Cause: Datatype of parameter of the stored procedure, specified in otl_stream::create_stored_proc_call, is unsupported.
- Action: PL/SQL tables, as stored procedure parameters, are not supported by create_stored_proc_call(). Also, if a stored procedure, which returns a reference cursor as an output parameter, has INOUT, or OUT parameters, is not supported by create_stored_proc_call(). What is supported by create_stored_proc_call() is as follows: (1) stored procedures with scalar input/output paramaters; (2) a stored procedure with scalar input parameters only, which returns a reference cursor as an output parameter, or as a stored function, returning a reference cursor as a return value.

Code=32016: Unsupported procedure type

- Cause: Stored procedure name, being passed into otl_stream::create_stored_proc_call, is of unsupported type..
- Action: For more detail, see this.

Code=32017: Stream buffer size can't be > 1 in this case

- Cause: In case if varchar_long, raw_long are used in a combination with OTL/OCIx, the only allowed stream buffer size is 1.

In case if clob, blob are used in a combination with OTL/OCIx, the only allowed stream buffer size for INSERTs or UPDATEs is 1. Though, buffer sizes, larger than 1, are allowed for SELECT statements.

This exception gets raised when the above limitations are violated.

- Action: Set the buffer size to 1.

Code=32018: ODBC / DB2 CLI function name is not recognized. It should be one of the following: SQLTables, SQLColumns, SQLProcedures, SQLColumnPrivileges, SQLTablePrivileges, SQLPrimaryKeys, SQLProcedureColumns, SQLForeignKeys

- Cause: A stream is being instantiated with a call to ODBC / DB2 CLI that returns a description of a system table catalog, or a description of table columns (see appendix B for more detail). The function name was not recognized as one from the list above.
- Action: Check the spelling of the function name that is being passed into the stream, fix it, recompile the program, and try again.

Code=32019: otl_stream::operator>>() should have been called before otl_stream::operator int()

- Cause: One of the otl_stream::operators >>() should have been called before calling otl_stream::operator int(). Operator int() works only for streams that have some output (SELECT statements, stored procedures returning result sets, etc.). Otherwise, the meaning of operator int() is not defined, so the operator returns incorrect values, or values that do not make any sense, and do not reflect anything meaningful. Therefore, this exception gets thrown as a warning, when an attempt is made to call operator int() before any operators >>() are called. That is, before anything was read from the stream, and yet, operator int() is called, which does not make any sense, because the operator returns an "end-of-file" (eof) status of the stream, after something is supposed to be read from the stream. The difference in semantic between operator int() and eof() is that eof() should be called before anything is read from the stream, and operator int() should be called after something is read from the stream. In other words, operator int() returns a deferred end-of-file status of the stream, for example:
  while(s>>f1>>f2){ // operator int() gets called here AFTER
  // two opeators >>() get called in the loop condition
  ....
  }
  versus the typical use of otl_stream::eof():
  while(!s.eof()){ // eof() gets called BEFORE something gets read from the stream
  s>>f1>>f2; // operators >> get called AFTER the eof() status was checked
  }
- Action: Change the logic of the program so that operator int() would be called only after some calls to operators >>() have already been made, or so that operator int() would not be called at all. Also, it is a good idea to use otl_stream::eof() instead of implicit calls to operator int().

Code=32020: otl_stream_read_iterator: otl_stream is not open

- Cause: The stream the iterator is attaching to is not open .
- Action: OTL stream read iterator cannot be attached to a stream that was not opened yet. Make sure that the program logic is correct, and it does not try to attact to a closed stream.

Code=32021: otl_stream_read_iterator: PL/SQL table and 'refcur' parameters are not supported

- Cause: Specified features are not supported.
- Action: If you need to use "refcurs" or PL/SQL tables, use the OTL stream interface.

Code=32022: otl_stream_read_iterator: otl_stream cannot be described

- Cause: otl_stream_read_iterator (in attach() or in describe()) calls otl_stream::describe_out_vars() under the covers. When describe_out_vars() returns a 0 pointer back to the caller function, it normally means that the underlying stream cannot desribe its output structure. Typically, this happens in the case of a stored procedure returning an implcit result set (ODBC, DB2-CLI), or a stored procedure that returns a referenced cursor (Oracle).
- Action: The stream output structure can be normally described after the execution of the underlying stored procedure. Therefore, the OTL stream read iterator should be attached to the stream after the execution of the stored procedure. Change your code accordingly.

Code=32023: otl_stream_read_iterator: position is out of range

- Cause: OTL stream read iterator template class provides a JDBC-like getter interface, which identifies output variables by their relative positions: 1,2,3,... This exception gets thrown when the specified "pos" parameter (in get() functions or in is_null() function) is out of range.
- Action: Make sure that the specified pos is within the range. The whole set of output variables of the underlying stream can be describe by calling otl_stream_read_iterator.htm::describe().

Code=32024: otl_stream_read_iterator: incompatible types in get()

- Cause: The data type of a variable used in the current get() operation is not compatible with the declared stream format.
- Action: Make sure the data types are compatible.

Code=32025: otl_stream::operator int() is not supported in the LOB stream mode

- Cause: operator int() is not supported in the LOB stream mode.
- Action: An attempt was made to call operator int() in the LOB stream mode.

Code=32026: otl_stream_read_iterator: get(otl_lob_stream*&) function can only be used if otl_stream::set_lob_stream_mode(true) had been called before the iterator was attached to the stream

- Cause: otl_stream_read_iterator can only be used when the underlying otl_stream is in te LOB stream mode..
- Action: Set the underlying stream to the LOB stream mode.

Code=32027: otl_stream_read_iterator: : variable name is not recognized

- Cause: OTL stream read iterator template class provides a JDBC-like getter interface, which identifies output columns / variables by their names This exception gets thrown when the specified "var_name" parameter (in get() functions or in is_null() function) is not recongnized.
- Action: Make sure that the specified name is among the output columns / variables. The whole set of output variables of the underlying stream can be described by calling otl_stream_read_iterator.htm::describe().

Code=32028: Unsupported column data type

- Cause: OTL stream finds a column in a SELECT statement / stored procedure call (ODBC, DB2 CLI) / reference cursor (Oracle) of an unsupported data type. For example, OTL does not support Oracle Objects.
- Action: Make sure that the data types of the all columns of your SELECT statement are supported by OTL. otl_exception::var_info contains info on which column exactly has an unsopprted data type.

Code=32029: RAW value cannot be read with otl_lob_stream, use otl_long_string instead

- Cause: OTL stream read iterator template class can't read a raw value with otl_lob_stream.
- Action: otl_long_string needs to be used instead.

Code=32030: otl_stream is already open

- Cause: OTL stream was already open when otl_stream::open() was called on the same stream.
- Action: Before opening a stream, make sure that it's not already open by calling otl_stream::good() on the stream:
  if(!my_str.good()){
  // stream is not open

Code=32031: otl_connect is already connected

- Cause: OTL connect object was already connected to the database when otl_connect::rlogon() was called on the same object.
- Action: Before connecting an otl_connect object to the database, make sure that the object is not already connected:
  if(!my_connect.connected){
  // connect object is not connected

Prev Contents Go Home

Copyright © 1996, 2007, Sergei Kuchin, email: skuchin@ispwest.com, skuchin@gmail.com
.

Permission to use, copy, modify and redistribute this document for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies.