Thursday, March 8, 2012

Olite: to_timestamp(...) not working

I am still running olite for an old version of OC4J. Turning on sensor values for in a BPEL process started throwing errors as the query used to to_timestamp(...) which was not working in my version of olite.

After going through Oracle Olite docs, this how I came up with a temp-fix.

- Created a Java Class.
import java.sql.*;
public class Formatter {
public static Timestamp to_X(String date, String format) {
return new Timestamp(System.currentTimeMillis());
}
}

- Loaded this class into olite
SQL> create java class using bfile ('C:\Oracle\10.1.3.1\OracleAS_1\bpel\bin', 'Formatter.class');

- Bound Formatter.to_X(...) to to_timestamp(...) in olite.
SQL> create or replace function to_timestamp(a varchar2, f varchar2)
return timestamp as language java
name 'Formatter.to_X(java.lang.String, java.lang.String) return java.sql.Timestamp';


- Do not forget a commit after this.

No comments: