OraFetchLong Function

Action

Fetches a portion of an Oracle LONG or LONG RAW column. This functions can be used to fetch amounts of data up to 64 KB, starting at any offset. This function uses the Oracle OCI oflng function to retrieve a long column in multiple pieces.

Note: To fetch a portion of a long column, you must call the OraFetch function before performing the OraFetchLong function call.

Include file

Ora.bdh

Syntax

OraFetchLong( in  cCursor     : cursor,
              in  nPosition   : number,
              in  nBufferSize : number,
              in  nDatatype   : number,
              out nReturnLen  : number
              in  nOffset     : number ): boolean;

Return value

  • true if successful

  • false otherwise. In this case, you can use the OraOciError function to retrieve the Oracle OCI error code

Parameter Description
sCursor Cursor associated with a database connection
nPosition Index position of the long column in the row. The first (and leftmost) column is position 1
nBufferSize Size of the buffer that receives the long column data
nDatatype Oracle external data type of the select-list item. See Oracle data types for a list of Oracle data types.
nReturnLen Number of bytes returned
nOffset Offset of the first byte to receive within the select-list item

Example

var
  hConnection : number;
  cCursor : cursor;

dcltrans
  transaction TMain
  var
    sBuffer : string(64000);
    nLength : number;
  begin
    OraLogon(hConnection, "user", "password", "orclnet2");
    OraOpen(cCursor, hConnection);
    OraParse(cCursor, sqlSelect);
    OraDefine(cCursor, 1, SQLT_LBI, 64000);
    OraExec(cCursor);
    OraFetch(cCursor);
    OraFetchLong(cCursor, 1, sizeof(sBuffer), SQLT_LBI, nLength, 0);
    OraGetValue(cCursor, "1", sBuffer, STRING_COMPLETE);
    write("image size = "); write(nLength); writeln;
    OraClose(cCursor);
    OraLogoff(hConnection);
  end TMain;

dclsql
  sqlSelect:
    SELECT bitmap FROM images;

Output

image size = 48703

See Also

Oracle's Programmer's Guide to Oracle Call Interface for Wrapped Oracle function: oflng