dbTalk Databases Forums  

About Java Stored Procedure

comp.databases.oracle.server comp.databases.oracle.server


Discuss About Java Stored Procedure in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sameer
 
Posts: n/a

Default About Java Stored Procedure - 09-12-2006 , 04:43 AM






One of the fields of a table is having NUMBER datatype.
The values stored in this field are the values represented using long
number representation of a date. [The long values represent the
specified number of milliseconds since the standard base time known as
"the epoch", namely January 1, 1970, 00:00:00 GMT.]

A java function to convert this long value to string is:

static String Long2String(long ldate) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(ldate);
int day=cal.get(Calendar.DAY_OF_MONTH);
int month=cal.get(Calendar.MONTH)+1;
int year = cal.get(Calendar.YEAR);
String strDate= day+"/"+month+"/"+year;
return strDate;
}

I am new to Java Stored Procedure.
How to use this as a java stored procedure in the database.
Can I query the database using this function?
-sameer


Reply With Quote
  #2  
Old   
sybrandb
 
Posts: n/a

Default Re: About Java Stored Procedure - 09-12-2006 , 05:20 AM







Sameer wrote:
Quote:
One of the fields of a table is having NUMBER datatype.
The values stored in this field are the values represented using long
number representation of a date. [The long values represent the
specified number of milliseconds since the standard base time known as
"the epoch", namely January 1, 1970, 00:00:00 GMT.]

A java function to convert this long value to string is:

static String Long2String(long ldate) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(ldate);
int day=cal.get(Calendar.DAY_OF_MONTH);
int month=cal.get(Calendar.MONTH)+1;
int year = cal.get(Calendar.YEAR);
String strDate= day+"/"+month+"/"+year;
return strDate;
}

I am new to Java Stored Procedure.
How to use this as a java stored procedure in the database.
Can I query the database using this function?
-sameer

1 You don't need a JSP for this purpose, as Oracle dates are expressed
in DAYS, an you can add and subtract with (fractions) of dates
2 If you are new to JSP you need to read the documentation on JSP.
You should NOT ask questions here.
You have a history of asking RTFM questions, please stop being lazy.

--
Sybrand Bakker
Senior Oracle DBA



Reply With Quote
  #3  
Old   
Sameer
 
Posts: n/a

Default Re: About Java Stored Procedure - 09-12-2006 , 05:37 AM



Dear Sir,
Just tell me how to deal with this NUMBER field which was stored as a
date to retrieve the actual date and having date datatype so that
queries can be fired.
As you said that java stored procedure is not required.
-Sameer

sybrandb wrote:
Quote:
Sameer wrote:
One of the fields of a table is having NUMBER datatype.
The values stored in this field are the values represented using long
number representation of a date. [The long values represent the
specified number of milliseconds since the standard base time known as
"the epoch", namely January 1, 1970, 00:00:00 GMT.]

A java function to convert this long value to string is:

static String Long2String(long ldate) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(ldate);
int day=cal.get(Calendar.DAY_OF_MONTH);
int month=cal.get(Calendar.MONTH)+1;
int year = cal.get(Calendar.YEAR);
String strDate= day+"/"+month+"/"+year;
return strDate;
}

I am new to Java Stored Procedure.
How to use this as a java stored procedure in the database.
Can I query the database using this function?
-sameer


1 You don't need a JSP for this purpose, as Oracle dates are expressed
in DAYS, an you can add and subtract with (fractions) of dates
2 If you are new to JSP you need to read the documentation on JSP.
You should NOT ask questions here.
You have a history of asking RTFM questions, please stop being lazy.

--
Sybrand Bakker
Senior Oracle DBA


Reply With Quote
  #4  
Old   
sybrandb
 
Posts: n/a

Default Re: About Java Stored Procedure - 09-12-2006 , 06:29 AM




Sameer wrote:
Quote:
Dear Sir,
Just tell me how to deal with this NUMBER field which was stored as a
date to retrieve the actual date and having date datatype so that
queries can be fired.
As you said that java stored procedure is not required.
-Sameer
Please stop *TOP-POSTING*!!!!
Why do all of you Indians behave so rude and ALWAYS TOP-POST?
Something wrong with your fingers?
And, secondly, if you can't understand my explanation, please go back
to primary school and learn to watch a clock and to calculate with
hours.
I'm not going to do YOUR work FOR FREE!!

No regards at all

--
Sybrand Bakker
Senior Oracle DBA



Reply With Quote
  #5  
Old   
Steve Howard
 
Posts: n/a

Default Re: About Java Stored Procedure - 09-12-2006 , 08:30 AM



sybrandb wrote:
Quote:
Why do all of you Indians behave so rude and ALWAYS TOP-POST?
Oh man, I think someone's going to lose a body part when the responses
start flowing in for this one...



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.