Previous Topic: Assignment StatementNext Topic: CASE Statement


Example

An assignment statement example follows. In the example that follows, logic that is not shown (for space considerations) is indicated by three vertically arranged periods.

 .
 .
 .
 DECLARE mySalary, yourSalary decimal(15,0) DEFAULT 1000000.;
 DECLARE errorClass char(2);
 DECLARE sqlStateLocal char(5);
 .
 .
 .
 SET errorClass = SUBSTR(sqlStateLocal, 1, 2);
 .
 .
 .
 SET mySalary = yourSalary * 2;
 .
 .
 .