ALLBASE/SQL Reference Manual (36216-90216)

Chapter 8 255
Expressions
String Functions
Example 4
SELECT * FROM SYSTEM.TABLE
WHERE NAME = LTRIM ('?*', 'VENDORS?*???***')
AND OWNER = 'PURCHDB';
Returns the system table entry for PURCHDB.VENDORS
Example 5
SELECT TRIM (BOTH '?*' FROM '??**?*hello ?* world???*')
FROM SYSTEM.TABLE
WHERE NAME = 'VENDORS';
Returns 'hello ?* world'.
Scope
SQL Data Manipulation Statements
SQL Syntax
{ STRING_LENGTH (
StringExpression
)
SUBSTRING (
StringExpression
,
StartPosition,Length
)}
Parameters
STRING_LENGTH returns an integer indicating the length of the parameter. If
StringExpression
is a fixed length string type, STRING_LENGTH will
return the fixed length. If
StringExpression
is a variable length string,
the actual length of the string will be returned.
StringExpression
is an expression of a string type. See the "Expression" section in this
chapter for the syntax. The expression must be a CHAR, VARCHAR,
BINARY, VARBINARY, Long Binary, or Long VARBINARY data type.
For example, the following are acceptable:
VendorName
'Applied Analysis'
SUBSTRING(VendorName,1,10)
SUBSTRING returns the portion of the
SourceString
parameter which begins at
StartPosition
and is
Length
bytes long.
StartPosition
is an integer constant or expression. See the "Expression" section in this
chapter for this syntax.
Length
is an integer constant or expression. See the "Expression" section in this
chapter for this syntax. The following are examples of acceptable lengths:
5
STRING_LENGTH(VendorName)-28