You can issue SQL statements either interactively or from within an application program.
Interactive SQL
When you use interactive SQL to enter a request or to change data, you get immediate results. This is the typical way of entering ad hoc statements.
For example, you might want to identify all employees who live in Boston. This SQL statement would return a table that includes the last name and first name of all employees residing in Boston:
select emp_lname, emp_fname
from employee
where city = 'Boston';
Embedded SQL
You can embed SQL statements in host application programs. With embedded SQL, the program receives the result of the request and acts on it, displays it, or prints it. For example, this embedded SQL statement returns to a COBOL program the last name and first name for employees living in the city requested by the program:
exec sql
select emp_lname, emp_fname
into :emp_lname, :emp_fname
from employee
where city = :city_in
end-exec
|
Copyright © 2014 CA.
All rights reserved.
|
|