Embedded SQL overview

Embedded SQL is a superset of Transact-SQL that lets you place Transact-SQL statements in application programs written in languages such as COBOL and C.

Embedded SQL is a product that enables you to create programs that access and update Adaptive Server data. Embedded SQL programmers write SQL statements directly into an application program written in a conventional programming language such as C or COBOL. A preprocessing program—the Embedded SQL precompiler—processes the completed application program, resulting in a program that the host language compiler can compile. The program is linked with Open Client Client-Library before it is executed.

Embedded SQL is one of the two programming methods Sybase provides for accessing Adaptive Server. The other programming method is the call-level interface. With the call-level interface, you place Client-Library calls directly into an application program and then link with Client-Library.

You can place Embedded SQL statements anywhere in a host program and mix them with host language statements. All Embedded SQL statements must begin with the keywords exec sql and end with end-exec.

You can use host variables in Embedded SQL statements to store data retrieved from Adaptive Server and as parameters in Embedded SQL statements; for example, in the where clause of a select statement. In Dynamic SQL, host variables can also contain text for Embedded SQL statements.