Solved

Form crash in Julian date conversion

Posted on 2009-07-15
1
622 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Listener Not Starting 11 65
run sql script from putty 4 168
oracle numeric condition check 4 35
subtr returning incorrect value 8 63
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to recover a database from a user managed backup

740 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