Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-29531 Error - and the method is declared both PUBLIC and STATIC

Re: ORA-29531 Error - and the method is declared both PUBLIC and STATIC

From: jfk2001 <jkstexas2001_at_yahoo.com>
Date: 14 Mar 2005 10:30:04 -0800
Message-ID: <1110825004.891056.278020@o13g2000cwo.googlegroups.com>


Thank you for your assistance. I made a minor change because it was truncating the date to the nearest hour.

Jeff

Here it the code, in case anyone else needs similar functionality.

Java Source

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "TimeZoneFormatter" AS

 import java.util.TimeZone;
 import java.sql.Timestamp;
 import java.text.SimpleDateFormat;

 public class TimeZoneFormatter {

 public static String Convert(String clientTimezone, Timestamp clientDate)
 {
 SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/DD/yyyy HH:mm:ss");
 //DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);  TimeZone timeZoneClient = TimeZone.getTimeZone(clientTimezone);  dateFormatter.setTimeZone(timeZoneClient);

 return dateFormatter.format(clientDate);

}
}

PL/SQL Wrapper

CREATE OR REPLACE function TimeZoneFormatter (ClientTimezone varchar2, ClientDate Date)
return varchar2 as
language java
name 'TimeZoneFormatter.Convert(java.lang.String, java.sql.Timestamp) return java.lang.String';

SQLPLUS Output

select sysdate, TimeZoneFormatter('Europe/Paris', sysdate) from dual;

SYSDATE



TIMEZONEFORMATTER('EUROPE/PARIS',SYSDATE) 03-14-05 12:28:31
03/14/2005 19:28:31

1 row selected. Received on Mon Mar 14 2005 - 12:30:04 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US