OraSetFloat Function

Action

Assigns a floating-point value to the program variable that is bound to the specified place holder in the SQL statement or PL/SQL block. The place holder is identified by the name or the number specified in the SQL statement or PL/SQL block. This function is used to assign values to both scalar and array program variables.

Include file

Ora.bdh

Syntax

OraSetFloat( in cCursor : cursor,
             in sSqlVar : string,
             in fValue  : float,
             in nIndex  : number optional): 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
cCursor Cursor associated with a database connection
sSqlVar Name of the place holder in the SQL statement or PL/SQL block. This parameter must include the preceding colon identifying it as a place holder
fValue Float value that is assigned to the program variable that is bound to the specified place holder in the SQL statement or PL/SQL block
nIndex Array index (optional). For array binding operations, this parameter specifies the array index of the program variable

Example

var
  hConnection : number;
  cCursor     : cursor;

dcltrans
  transaction TMain
  var
    sName    : string;
    fBalance : float;
  begin
    OraLogon(hConnection, "user", "password", "orclnet2");
    OraOpen(cCursor, hConnection);
    OraParse(cCursor, sqlSelect);
    OraBind(cCursor, ":1", SQLT_FLT);
    OraSetFloat(cCursor, ":1", 2000.0);
    OraDefine(cCursor, 1, SQLT_CHR, 32);
    OraDefine(cCursor, 2, SQLT_FLT);
    OraExec(cCursor);
  
    while OraFetch(cCursor) do
      sName := OraGetString(cCursor, "1");
      fBalance := OraGetFloat(cCursor, "2");
      write(sName, 32); write(fBalance); writeln;
    end;

    OraClose(cCursor);
    OraLogoff(hConnection);
  end TMain;

dclsql
  sqlSelect:
    SELECT * FROM accounts WHERE balance > :1;

Output

Bob 13864.220000Pamela 4492.090000Richard 7309.580000

Sample scripts

OraSample.bdf