Java Reference
In-Depth Information
The only difference between using a
Clob
and a string is that you must load the
Clob
into a
Clob
type.
Note
Calling the
Clob getString()
method will pass a funny-looking string of
text that denotes a
Clob
object. Therefore, calling the
Clob
object's
getAs-
ciiStream()
method will return the actual data that is stored in the
Clob
.
Although
Clob
s are fairly easy to use, they take a couple of extra steps to prepare.
It is best to plan your applications accordingly and try to estimate whether the database
fields you are using might need to be
CLOB
s due to size restrictions. Proper planning
will prevent you from going back and changing standard string-based code to work
with
Clob
s later.
13-14. Invoking Stored Procedures
Problem
Some logic that is required for your application is written as a database-stored proced-
ure. You require the ability to invoke the stored procedure from within your applica-
tion.
Solution
The following block of code shows the PL/SQL that is required to create the stored
procedure that will be called by Java. The functionality of this stored procedure is very
minor; it simply accepts a value and assigns that value to an
OUT
parameter so that the
program can display it:
create or replace procedure dummy_proc (text IN VARCHAR2,
msg OUT VARCHAR2)
as
begin
-- Do something, in this case the IN parameter value
is assigned to the OUT parameter