Coalesce() function in Sql

The DB2 Coalesce  function returns the value of the first non-NULL expression. The Coalesce  function takes a comma separated list of arguments which are evaluated in the order in which they are specified and returns the first non-NULL value found. Syntax : Coalesce(expr1, expr2, …., expr_n) Example : Assume that Score1 and Score2 are  columns in table Grades

SQL Get Diagonstics

The Get Diagnostics statement provides diagnostic information about the last SQL statement (other than a Get Diagnostics statement) that was executed. Example: Exec Sql Update Cusmas set City = ‘CHICAGO’ where CusNbr = 1; Exec Sql Get Diagnostics Condition 1 :MsgText = MESSAGE_TEXT;   If the update statement was successful then MsgText will have something

%ScanR() – Scan Reverse for Characters

%SCANR returns the last position of the search argument in the source string, or 0 if it was not found. Syntax: %SCANR(search argument : source string { : start { : length } } ) %SCANR is similar to %SCAN. They differ only in the direction of the search • The “start position” represents the