SQL LTRIM scalar function in DB2 for i SQL

SQL LTRIM scalar function in DB2 for i SQL
SQL LTRIM scalar function in DB2 for i SQL, sql function, db2 sql, ibmi db2
SQL LTRIM scalar function in DB2 for i SQL

LTRIM

The LTRIM function removes all of the characters that are passed in the trim-expression from the starting of the passed string expression. The search is done by comparing each byte in trim-expression to the byte at the starting of string-expression.

Syntax

LTRIM(string-expression, trim-expression(<optional>)

Example

SELECT LTRIM ('793ABCD123', '793'),      
    LTRIM ('793ABCD123', '321'),         
    LTRIM ('123123333ABC11', '123'),     
    LTRIM ('123321', '213'),             
    LTRIM ('ABC123 ', '321'),            
    LTRIM ('[[-52]]', '- []'),           
    LTRIM ('...#A..#AR', '#.'),          
   hex( LTRIM (X'D010D011D012', X'D010'))
 FROM SYSIBM.SYSDUMMY1                   

Output

LTRIM       LTRIM       LTRIM           LTRIM   LTRIM    LTRIM    LTRIM       HEX   
ABCD123     793ABCD123  ABC11                   ABC123   52]]     A..#AR      11D012

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain