SQL iQuery Script Built-in Function

Index

isDDE and isNull

Checks a Session Variable from a FETCH for Decimal Data Errors or Null Value

The ISDDE() (is Decimal Data Error Flag Set On) built-in functions can check a Session Variable used as the target of an input operation, such as SELECT INTO or VALUES INTO for a decimal data error.

The ISNULL() (is Null Indicator Returned) built-in functions can check a Session Variable used as the target of an input operation, such as SELECT INTO or VALUES INTO to see if a NULL was returned for the value.

Syntax

The ISDDE() built-in function checks the returned value from a SELECT INTO to see if the Decimal Data Error Flag was returned for the value. It returns true if the DDE is set on, otherwise it returns false.
The ISNULL() built-in function checks the returned value from a SELECT INTO to see if the returned value is NULL. It returns true if the NULL Indicator for the value is set on, otherwise it returns false.

Parameters

  1. The name of an iQuery Session Variable to be checked.
for each 
  select item, itemdesc,sum(qtySold)
    INTO &ITEM, &DESC, &TOTALSold
    FROM orders S 
    left outer join itemmast I 
         on S.ITEM = I.ITEMNBR
    GROUP BY S.item,I/itemdesc
    ORDER BY S.ITEM;

  if isNull(&Desc);
    eval &itemDesc = '**Item Not Found**';
  endif;

  call postSales('&item','&Desc', &totalSold);
endfor;

The FOR EACH loop reads through the selected rows and returns 3 columns. If the JOIN produces a NULL value for the Item Description column, the iQuery Script sets the Item Description to '**Item Not Found**' and then calls an SQL procedure to log the total sales.