Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unwanted spaces in CHAR

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
I have something Java code like the following to use JDBC Connection to call a PL/SQL proceudre on Oracle 8i.

The problem is with the CHAR field, when char is not null, then result1 becomes something like 32K of spaces!!
when it is null, it is returned as null!

Is there some sort of configuration in Oracle to stop this from happening? Note that the VARCHAR to get returned properly regardless of whether the value is null or not.

Code:
sCall.setString(MyConstant.STOREPROCEDURE_PARAM_CRITERION, Criterion);
sCall = jdbcConnection.prepareCall(???);

sCall.registerOutParameter(MyConstant.STOREPROCEDURE_PARAM_CODE, Types.CHAR);          
            sCall.registerOutParameter(MyConstant.STOREPROCEDURE_PARAM_DESCR, Types.VARCHAR);                 

sCall.executeQuery();

result1   = sCall.getString(STOREPROCEDURE_PARAM_CODE);
result2   = sCall.getString(STOREPROCEDURE_PARAM_DESCR);

Anyone know what is wrong please?
 
Btw, a .trim() in the PL/SQL could not resolve the problem
FYI, the Unicode returned is -1 and is of type Space Separator.

Anyone have any clues what is going on here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top