This discussion is archived
5 Replies Latest reply: Oct 31, 2013 9:48 AM by jschellSomeoneStoleMyAlias RSS

String to Varchar2 - from java to PL/SQL procedure

793073 Newbie
Currently Being Moderated

Hi,

 

I got Java-WS web service generated from WSDL. This service calls procedure in PL/SQL pkg through Java Code generated (ORAData, ORADataFactory) from DB (11g) in Jdeveloper 11.

 

This procedure got as input PL/SQL record. But all VARCHAR2 parameters of this record are passed to DB empty...

 

This thing works at 10g DB.

 

Do you got any idea, where is problem?

 

THX

 

K.

  • 1. Re: String to Varchar2 - from java to PL/SQL procedure
    rp0428 Guru
    Currently Being Moderated

    You need to provide more explanation and an example of what you mean.

     


  • 2. Re: String to Varchar2 - from java to PL/SQL procedure
    793073 Newbie
    Currently Being Moderated

    I generated Java code from PL/SQL procedure in DB. It's procedure, which has one input parameters - record of few atributes VARCHAR2, TIMESTAMP, NUMBER...

     

    I call this procedure by this Java. I set each atribute of this record. All Numbers and Timestamps are passed to DB correct, but all VARCHAR2s are empty...

     

    ---

     

    requestType = new InWSRecType();
    String konzument = "test";

    requestType.setKonzument(konzument); // this atribute is passed into pl/sql procuder as null

     

    requestType.setRok(new BigDecimal(reqData.getRok()));

     

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

     

    Timestamp datumOd = new Timestamp(reqData.getDatumOd().toGregorianCalendar().getTimeInMillis());

     

    // call plsql api
    OutWSRespRecType responseType = InWS.method1(requestType);
  • 3. Re: String to Varchar2 - from java to PL/SQL procedure
    rp0428 Guru
    Currently Being Moderated
    I call this procedure by this Java. I set each atribute of this record. All Numbers and Timestamps are passed to DB correct, but all VARCHAR2s are empty...

    Well that code doesn't set any timestamp data into the type instance at all.

     

    Also I notice that when setting the number you actually create a NEW BigDecimal directly into the type instance.

     

    But for the string you only use a reference:

    requestType.setKonzument(knozument);

    Do some more tests. Set the string by creating a NEW string directly into the type instance:

    requestType.setKonzument("test");
  • 4. Re: String to Varchar2 - from java to PL/SQL procedure
    793073 Newbie
    Currently Being Moderated

    rp0428 wrote:

     

    I call this procedure by this Java. I set each atribute of this record. All Numbers and Timestamps are passed to DB correct, but all VARCHAR2s are empty...

    Well that code doesn't set any timestamp data into the type instance at all.

     

    Also I notice that when setting the number you actually create a NEW BigDecimal directly into the type instance.

     

    Timestamp reqData.getDatumOd() is XMLGregorianCalendar, which contains date parsed from request XML.

    rp0428 wrote:

     

     

    But for the string you only use a reference:

    requestType.setKonzument(knozument);

    Do some more tests. Set the string by creating a NEW string directly into the type instance:

    requestType.setKonzument("test");

    I try this aproach too, but it doesn't work.


    This same aproach worked, when I used OC4J container and 10g DB and java 1.4. I rewrite new webservice for Weblogic in 1.5 Java, but it doesn't work...

     

  • 5. Re: String to Varchar2 - from java to PL/SQL procedure
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated

    > I got Java-WS web service generated from WSDL. This service calls procedure in PL/SQL pkg through Java Code generated (ORAData, ORADataFactory) from DB (11g) in Jdeveloper 11.

     

    There are way to many possible failure points in that.  You can start by writing a test that uses JDBC directly with dummy hard coded data to call the proc. (No web service, no EE containers, etc.)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points