Dave Tolls wrote:Can you post the full error you get?
CHARs are fixed length, and I expect your CHAR parameter is the max length for one, which is too large to fit in your table column.
By the way, why are you defining the VARCHAR2 column in terms of bytes and not characters?
Brian Tkatch wrote:Does the SP work from the console via EXEC?
Dave Tolls wrote:I've never used a CHAR field so I'm not sure how you would actually tell it to only send a single character.
Dave Tolls wrote:
It works fine because your CHAR is defined as 20 characters long.
The one coming into the SP via Java is 32767 characters long (it seems), because there's nothing there to say otherwise.
Now, I've never used a CHAR field so I'm not sure how you would actually tell it to only send a single character.
Brian Tkatch wrote:
Dave Tolls wrote:I've never used a CHAR field so I'm not sure how you would actually tell it to only send a single character.
CHAR(1). CHAR is the same as VARCHAR2, but with implicit padding. But you knew that. What am i missing?
Dave Tolls wrote:
Brian Tkatch wrote:
Dave Tolls wrote:I've never used a CHAR field so I'm not sure how you would actually tell it to only send a single character.
CHAR(1). CHAR is the same as VARCHAR2, but with implicit padding. But you knew that. What am i missing?
The JDBC side.
How do you actually tell that the Java String supplied is only 1 character and should not be padded.
It seems that the driver is interpreting the CHAR as CHAR(32767).
To be honest, this does ring a bell of a driver bug from years ago.
Dave Tolls wrote:Now, of course, my next question is going to be, does this have to be a CHAR?
The column it's going into isn't a CHAR so I'm not sure why you are using one.
If it does, then my next suggestion is to simply hack the input down to 32 characters when you do the assignment in the SP.
I am using Oracle 12c db and ojdbc7.jar to connect to it. Below is the java code
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |