Embedded SQL Examples

Embedded SQL statements are SQL statements written within application programming languages such as C and preprocessed by an SQL preprocessor before the application program is compiled. There are two types of embedded SQL: static and dynamic. This page contains some sample programs using Embedded SQL. All of these programs can also be copied from the directory ~miller/pub on cdf.toronto.edu.

Using sqlca

Using sqlstate (for questions on how to use sqlstate, contact drosu@cs.toronto.edu)

	
 Note: before you compile these programs, you need to create
 the following table and insert some tuples in it.

	--*************
	create table video(video_id int not null, \
                   video_title varchar(30), \
                   director varchar(20), \
                   primary key(video_id))

	insert into video values(100,'Titanic','John')
	insert into video values(200,'Mask','Mary')
	insert into video values(300,'Mary had a little lamb','Jim')
	--*************
Additional db2 embedded programs used in tutorial.