Problem: I had an SP to call which takes a param Date. I called this via JDBC with a valid Java Date, but it refused to save the time fields I supplied.
When preparing the SP for calling I did as follows,
mightySp('paramName',:paramName);
When supplying the parameter, I gave as follows,
tempPlsqlBlock.declareParameter(new SqlParameter("paramName", Types.DATE));
Solution: Instead of calling with param type Date, call with String and convert to date in the Java layer.
When preparing the SP for calling I used the TO_DATE method and convert the String to an Oracle Date as follows,
mightySp('paramName',TO_DATE(:paramName,'yyyy/mm/dd:hh:mi:ssam')
When supplying the parameter, I gave as follows,
tempPlsqlBlock.declareParameter(new SqlParameter("paramName", Types.VARCHAR));
0 comments »




0 Comments
Be the first to comment!