The following embedded SQL example returns the square roots of the integers 0 through 10:
SET a=0
WHILE a<11 {
&sql(SELECT SQRT(:a) INTO :b)
IF SQLCODE'=0 {
WRITE !,"Error code ",SQLCODE
QUIT }
ELSE {
WRITE !,"The square root of ",a," = ",b
SET a=a+1 }
}