Java Expressions in SQLJ Code

Three categories of Java expressions are used in SQLJ code: host expressions, context expressions, and result expressions.

Host Expressions

Java host expressions are used to pass arguments between your Java code and SQL operations. The most basic kind of Java host expression consists of a Java identifier called a host variable. Java identifiers used as host variables or in a host expression can represent any of the following:

local variables

declared parameters

class fields

static or instance method calls

Let's consider some examples.

Suppose that you want to use three input host variables to update the name and address of the customer specified by the customer_id. The following code could be used:

 String custid="11111"; ...

Get e-Commerce Applications Using Oracle8i and Java from Scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.