Retrieves a number value 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.
Ora8.bdh
Ora8GetInt( in hStmt : number, in sSqlVar : string, in nIndex : number optional): number;
Retrieved long value
Parameter | Description |
---|---|
hStmt | Statement handle. |
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 value assigned to an array place holder or fetching data from multiple rows. It can be one of the following:
|
var ghEnv0 : number; ghError0 : number; ghStmt0 : number; ghSvcCtx0 : number; dcltrans transaction TMain var nAge : number; sName : string; begin Ora8Init(ghEnv0, OCI_DEFAULT); Ora8HandleAlloc(ghEnv0, ghError0, OCI_HTYPE_ERROR); Ora8Logon(ghEnv0, ghSvcCtx0, "user", "password", "orclnet2"); Ora8HandleAlloc(ghEnv0, ghStmt0, OCI_HTYPE_STMT); Ora8StmtPrepare(ghStmt0, sqlSelect, OCI_NTV_SYNTAX); Ora8Bind(ghStmt0, ":1", SQLT_INT); Ora8SetInt(ghStmt0, ":1", 25); Ora8Define(ghStmt0, 1, SQLT_CHR, 32); Ora8Define(ghStmt0, 2, SQLT_INT); Ora8StmtExecute(ghSvcCtx0, ghStmt0); while Ora8StmtFetch(ghStmt0, 1, 1) do sName := Ora8GetString(ghStmt0, "1"); nAge := Ora8GetInt(ghStmt0, "2"); write(sName, 32); write(nAge, 5); writeln; end; Ora8HandleFree(ghStmt0, OCI_HTYPE_STMT); Ora8Logoff(ghSvcCtx0); Ora8HandleFree(ghError0, OCI_HTYPE_ERROR); Ora8HandleFree(ghEnv0, OCI_HTYPE_ENV); end TMain; dclsql sqlSelect: SELECT * FROM persons WHERE age > :1;
Howard 33Michael 44Bobby 61Sara 38