SQL iQuery Script Built-in Function

Index

LEN / STRLEN

Return Length of Session Variable Contents

The LEN() or STRLEN() built-in functions return the length of the data stored in the Session Variable.

Syntax

The LEN() or STRLEN() built-in functions return the number of characters stored in the identified Session Variable. It can be used on an assignment, conditional or looping statement. 

Parameters

  1. A session variable whose length is returned.
select upc INTO &UPC
FROM products
WHERE itemNbr = 3741;

if (&SQLState < '02000');
if (len(&UPC) = 12);
// do 12-position UPC processing here
elseif (len(&upc) = 13);
// do 13-position UPC processing here
  else;
// handle the rest here.
endif;
endif;