RsIsNull Function

Action

Checks whether the value from the internal result set, which is filled whenever a data generating SQL statement is executed (SELECT statement) no matter which database API (ORA, ODBC) has generated it, is null.

Include file

db.bdh

Syntax

RsIsNull( in sIdentifier : string,
          in nIndex      : number optional): boolean;

Return value

  • true if the value is null,
  • false otherwise.
Parameter Description
sIdentifier Identifier of the result data column.
nIndex Array index for the column item (optional).

Example

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

      if ( not RsIsNull("1")) then
        sName := RsGetString("1");
      end;

      fBalance := RsGetFloat("2");
      write(sName, 32); write(nAge, 5); writeln;
    end;

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

dclsql
  sqlSelect:
  SELECT * FROM persons WHERE age > :1;