Form crash in Julian date conversion

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

Question by:anumoses
1 Comment
LVL 73

Accepted Solution

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle 12c patching 1 88
Oracle Public Synonyms and Privileges 2 66
Oracle SQL Select unique values from two columns 4 55
PL SQL Search Across Columns 4 39
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

831 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