Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: 10046/10079 Tracing understanding - SOLVED
Jared,
But now think about this from the driver perspective, when you call this procedure from java you simply define type of the second parameter and that it is output parameter, without specifying expected length of the data.
I.e. you call stmt.registerOutParameter(3,Types.VARCHAR);
Oracle JDBC driver has no idea about what will be the maximal length of the output parameter, so it reserves space for a maximal possible char string (32k).
When you call this procedure from pl/sql, pl/sql engine knows maximal length of the string that you expect, because you have defined length for the variable that will hold out parameter (v1 and v2).
As for original problem, you can set maximal expected length of the parameter, if you will use OracleCallableStatement instead of CallableStatement and use this function:
void registerOutParameter(int paramIndex, int sqlType, int scale, int maxLength)
Special Oracle version of registerOutParameter for registering CHAR, VARCHAR, LONG, RAW and LONG RAW columns.
For example:
OracleCallableStatement stmt =
(OracleCallableStatement)conn.prepareCall ("begin ? := mychar(?,?,?);
end;");
stmt.registerOutParameter(1,Types.CHAR); stmt.setString(2,"this is a test"); stmt.registerOutParameter(3,Types.CHAR, 0, 50); stmt.registerOutParameter(4,Types.CHAR, 0, 50);
Output:
JDBC driver version is 10.1.0.3.0
Return length is: 50
Trimmed string is: this is a test
Trimmed string length is: 14
On 8/4/05, Jared Still <jkstill_at_gmail.com> wrote:
> Yes, but even so, PL/SQL does not pad the CHAR input parameter out to 32k.
-- Edgar callto://edgar.chupit -- http://www.freelists.org/webpage/oracle-lReceived on Thu Aug 04 2005 - 13:30:03 CDT
![]() |
![]() |