0

I have a JDBC program to which uses a CallabaleStatement object to set and register IN/OUT parameters for the stored procedure.

I have used ArrayDescriptors and oracle.sql.ARRAY object and set it as an input parameter with the user-defined datatype.

The User defined datatype is TYPE CharArray1 IS TABLE OF CHAR(7). During the executing the error, I receive is "invalid pattern name my-object".

I set the input in the following way:

ArrayDescriptor ad = ArrayDescriptor.createDescriptor("<package-name>.CharArray1", conn);
ARRAY arr = new ARRAY(ad, conn, new String[]{"1"});
callableStatement.setArray(3, arr );

where conn is my Connection Object. I have checked the Execute permission for the package-name for the Datatype CharArray1. I have removed the package-name and checked, the error remain the same.

Thanks in advance. Please advise me as to what I'm doing wrong here.

1 Answer 1

0

Try to switch CHAR to VARCHAR2(7 char)

10
  • My functionality needs it to be a table of char(7). I can not make database changes. I need to make the Java code to keep up. Commented Jul 31, 2014 at 17:32
  • But you send only 1 byte, try to add 6 white spaces. When you finish the project read some Thomas Kyte books, he wants us NOT TO USE the CHAR type over the VARCHAR2 type. There is no advantages.
    – neshkeev
    Commented Jul 31, 2014 at 17:40
  • It is not necessarily that I will be adding 1 everytime. The number of character can be "12345", for example. Commented Jul 31, 2014 at 17:43
  • Anyway you have to watch that you pass 7 byte(not characters, one character can take several bytes) and add white spaces if necessary.
    – neshkeev
    Commented Jul 31, 2014 at 17:45
  • Agreed which I will take care. The values that come to this will definitely not be more than 7 byte. But, I feel that is not the concern here. I would like to know, if there are any changes to the way I'm passing the parameter to the CallableStatement. Commented Jul 31, 2014 at 17:48

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.