Search This Blog

Monday, June 17, 2013

SQR Commands

1. Example of Rpad

let $COUNTRY = 'USA'

Below example adds spaces at the end.
Rpad($COUNTRY,6,' ') ==> USA   
                                       1 2 3 4 5 6

Rpad($COUNTRY,6,z) ==> USA  z z z
                                       1 2 3 4 5 6

Rpad($COUNTRY,3,z) ==> USA
                                       1 2 3

2. on-error command:

begin-sql on-error=Procedure-name

end-sql

The procedure will act as error handler and will have below code.
Whenever a runtime error occurs, the dynamic error message will be displayed.

begin-procedure Procedure-name
display 'Database error occurred'
display $sql-error
end-procedure ! Procedure-name

No comments: