Retrieves a string either from the program variable that is bound with the specified place holder in the SQL statement or PL/SQL block, or from the output variable that is defined for the specified select-list item in the SQL query. This function is used to retrieve values from both scalar and array program variables that are defined for the specified select-list item.
If this function is used to retrieve one of the following data types, the retrieved value is automatically converted to a string:
Ora.bdh
OraGetString( in cCursor : cursor, in sSqlVar : string, in nIndex : number optional): string;
Retrieved string, containing at most 253 characters. If the string to be retrieved consists of more than 253 characters, it is automatically cut off at the corresponding position.
Parameter | Description |
---|---|
cCursor | Cursor associated with a database connection |
sSqlVar |
This parameter can be one of the following:
注: In the latter case, the column
number has to be passed to the function as a string.
|
nIndex |
Index or row number (optional). This parameter has to be passed to the function whenever retrieving a string assigned to an array place holder or fetching data from multiple rows. It can be one of the following:
|
var hConnection : number; cCursor : cursor; dcltrans transaction TMain var nAge : number; sName : string; begin OraLogon(hConnection, "user", "password", "orclnet2"); OraOpen(cCursor, hConnection); OraParse(cCursor, sqlSelect); OraBind(cCursor, ":1", SQLT_INT); OraSetInt(cCursor, ":1", 25); OraDefine(cCursor, 1, SQLT_CHR, 32); OraDefine(cCursor, 2, SQLT_INT); OraExec(cCursor); while OraFetch(cCursor) do sName := OraGetString(cCursor, "1"); nAge := OraGetInt(cCursor, "2"); write(sName, 32); write(nAge, 5); writeln; end; OraClose(cCursor); OraLogoff(hConnection); end TMain; dclsql sqlSelect: SELECT * FROM persons WHERE age > :1;
Howard 33Michael 44Bobby 61Sara 38
OraArrayFetch.bdf, OraSample.bdf