Solved

Form crash in Julian date conversion

Posted on 2009-07-15
1
632 Views
Last Modified: 2013-12-19
Wheh I run this output in toad its ok. But when I run this in oracle forms 10g the form crashes.

In the form the field exp_date is date datatype. What might be the problem.

I also tried running with datatype datetime and giving a format mask of
DD-MON-YYYY HH24:MI:SS PM. Buit still oracle forms crashes. How to fix it? Thanks in advance
:rbc_irradiation_dtl.original_exp_date := to_char(TO_DATE(2000 + TO_NUMBER(SUBSTR(:rbc_irradiation_dtl.original_exp_date,1,3)) || '0101', 'yyyyddmm')
       + TO_NUMBER(SUBSTR(:rbc_irradiation_dtl.original_exp_date,4,3)) -1
       + TO_NUMBER(SUBSTR(:rbc_irradiation_dtl.original_exp_date,7,2)) / 24
       + TO_NUMBER(SUBSTR(:rbc_irradiation_dtl.original_exp_date,9,2)) / 1440,'DD-MON-YYYY HH24:MI:SS PM');
 
----------------------
select  to_char(TO_DATE(2000 + TO_NUMBER(SUBSTR('0092372359',1,3)) || '0101', 'yyyyddmm')
       + TO_NUMBER(SUBSTR('0092372359',4,3)) -1
       + TO_NUMBER(SUBSTR('0092372359',7,2)) / 24
       + TO_NUMBER(SUBSTR('0092372359',9,2)) / 1440,'DD-MON-YYYY HH24:MI:SS PM') as standard_date from dual

Open in new window

0
Comment
Question by:anumoses
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 24860019
when you use the outer TO_CHAR,  that converts the date to a string so it can be formatted.

from your previous questions I thought that is what you wanted
you can't actually format a DATE, only a string representing a date can have a format.

simply remove the outer to_char and then do your formatting with forms attributes


select TO_DATE(2000 + TO_NUMBER(SUBSTR('0092372359',1,3)) || '0101', 'yyyyddmm')
       + TO_NUMBER(SUBSTR('0092372359',4,3)) -1
       + TO_NUMBER(SUBSTR('0092372359',7,2)) / 24
       + TO_NUMBER(SUBSTR('0092372359',9,2)) / 1440 as standard_date from dual
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question