SQL iQuery Script Built-in Functions

Find String in Session Variable

Find, Findi, Scan, Scani

The find() built-in functions return the position of the pattern in the searched data beginning at the starting position for an optional length.
The FIND() and SCAN() built-in functions are synonyms--either may be used. The suffix FINDi and SCANi indicate that the scan should be case insensitive.

Syntax

The SCAN/SCANi built-in functions scans parameter 2 for the pattern specified on parameter 1. The SCAN() is case-sensitive, whereas SCANI() is case-insensitive.

Parameters

  1. The pattern to be searched for.
  2. The Session Variable that is searched.
  3. The starting position within the Session Variable (2nd parameter) to begin the scan.
  4. The number of bytes from the start position to scan.
-- Find IBM in the company name
if (scani('ibm',&company) > 0);
 -- Do special processing for IBM
else;
 -- Handle other situations
endif;