Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 658
  • Last Modified:

Form crash in Julian date conversion

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
anumoses
Asked:
anumoses
1 Solution
 
sdstuberCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now