Describes select-list items for SQL queries. This function returns internal data type description and size information for a specified select-list item.
If it is used without specifying the select-list item, all select-list items of the SELECT statement are described and OraDefine function calls are performed implicitly in order to define an output variable for each select-list item of a SQL query. In this case, no values are returned in the out parameters and the select-list items are bound as strings regardless of the Oracle internal data type. The functions listed below can be used to retrieve values from the program variable that is defined for the select-list item.
Ora.bdh
OraDescribe( in cCursor : cursor, in nPosition : number optional, out nDBSize : number optional, out nDBType : number optional, out sColName : string optional, inout nNameLen : number optional, out nDisplaySize : number optional, out nPrecision : number optional, out nScale : number optional, out nNullOk : number optional ): boolean;
true if successful
false otherwise. In this case, you can use the OraOciError function to retrieve the Oracle OCI error code
Parameter | Description |
---|---|
cCursor | Cursor associated with a database connection |
nPosition | Position index of the select-list item in the SQL query (optional). Position indices start at 1 for the first (leftmost) select-list item. |
nDBSize | Variable receiving the maximum size of the column, as stored in the Oracle data dictionary (optional) |
nDBType | Variable receiving the data type code of the select-list item (optional). See Oracle data types for detailed information |
sColName | Variable receiving the column name of the specified select-list item (optional) |
nNameLen | Size of the variable receiving the column name (optional). After the function call, this parameter contains the actual length of the column name |
nDisplaySize | Variable receiving the maximum display size of the select-list item if the select-list item is returned as a character string (optional) |
nPrecision | Variable receiving the precision of numeric select-list items (optional). The precision is the total number of digits of a number. |
nScale | Variable receiving the scale of numeric select-list items (optional) |
nNullOk |
Variable receiving an indicator whether null values are permitted.
|
var hConnection : number; cCursor : cursor; dcltrans transaction TMain var nDBSize, nDBType, nNameLength, nDisplaySize : number; nPrecision, nScale, nNullOk : number; sColumnName : string; begin OraLogon(hConnection, "user", "password", "orclnet2"); OraOpen(cCursor, hConnection); OraParse(cCursor, sqlSelect); nNameLength := sizeof(sColumnName); OraDescribe(cCursor, 2, nDBSize, nDBType, sColumnName, nNameLength, nDisplaySize, nPrecision, nScale, nNullOk); write("maximum column size = "); write(nDBSize); writeln; write("column data type = "); write(nDBType); writeln; write("column name = "); write(sColumnName); writeln; write("name length = "); write(nNameLength); writeln; write("display size = "); write(nDisplaySize); writeln; write("precision = "); write(nPrecision); writeln; write("scale = "); write(nScale); writeln; write("NULL values : "); if nNullOk = 0 then write("not permitted") else write("permitted") end; writeln; OraExec(cCursor); OraClose(cCursor); OraLogoff(hConnection); end TMain; dclsql sqlSelect: SELECT * FROM accounts;
maximum column size = 22 column data type = 2 column name = BALANCE name length = 7 display size = 40 precision = 36 scale = 2 NULL values : permitted