5. Embedded QUEL : Basic Structure of EQUEL Programs
 
Share this page                  
Basic Structure of EQUEL Programs
A typical EQUEL application performs the following steps:
Connect with a database.
Execute queries against the database.
Disconnect from the database.
In general, you can mix EQUEL and host language statements. Specific restrictions are discussed in this chapter. The following example shows a simple EQUEL program that retrieves and prints the salary and name for employee 23:
begin program
##     ename        character_string (26)
##     sal            float
##     /* connect... */
##     ingres "personnel"
##     /* execute queries... */
##     range of e is employee
##     retrieve (sal = e.salary, ename = e.empname)
##         where e.empnum = 23
##     {
                print ename, sal
##     }
##     /* disconnect */
##     exit
end program