![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
Why do all of you Indians behave so rude and ALWAYS TOP-POST? |
![]() |
| Thread Tools | |
| Display Modes | |
| |