Embedded SQLJ statements
To identify Embedded SQLJ statements to the SQLJ translator, each SQLJ statement must begin with #sql. The SQLJ translator recognizes #sql and translates the statement into Java™ code.
SQL statements
Embedded
SQLJ supports SQL statements at the SQL92 Entry level, with the following
additions:
- The EXECUTE PROCEDURE statement, for calling SPL routines and user-defined routines
- The EXECUTE FUNCTION statement, for calling stored functions
- The BEGIN...END block
SQL statements must appear within curly braces, as follows:
#sql
{
create table customer
(
customer_num serial(101),
fname char(15),
lname char(15),
company char(20),
address1 char(20),
address2 char(20),
city char(15),
state char(2),
zipcode char(5),
phone char(18),
primary key (customer_num)
)
};
An SQL statement that is not enclosed within curly braces will generate a syntax error.
SQL statements are case insensitive (unless delimited by double quotes) and can be written in uppercase, lowercase, or mixed-case letters. Java statements are case sensitive.