P10_STARTDATE Date Picker (YYYY-MM-DD) invalid number

All i have a form that inserts a row into the database one of the fields is defined as
P10_STARTDATE Date Picker (YYYY-MM-DD). This all works and the popup comes up and user selects the date and then inserts the row.
When the user clicks on the id column of the report it takes him to the update page which should load all the data from the database. All i get back is an error that says
ORA-01722: invalid number
If i update the table and set the startdate column to 0 and then click on the id column again to update the record it comes up and i can run the form to update it, why is it saying invalid number

Ben,
Can this be reproduced on htmldb.oracle.com?
What is the data type of the column associated with P10_STARTDATE?
Joel

Similar Messages

  • ORA-01722: invalid number caused with SQL using bind variable

    Hi,
    Im am hoping that someone can help me resolve a problem thats only just services and is being experienced on quite a few clients.
    our application uses C++ exes and makes OCI calls to the database.
    what has happened in the last week or so, there has been quite a few invalid number errors being received on a prod server but strangly enough we cannot reproduct the error on our UAT system.
    The sql is using bind variables and the information in the trace file shows that a number is being used for the bind variable, here is an extract from one trace file:
    for some schemas, the bind variable value is some currupted value, i think:
    oacdty=01 mxl=32(21) mxlc=00 mal=00 scl=00 pre=00
    oacflg=03 fl2=1206001 frm=01 csi=178 siz=32 off=0
    kxsbbbfp=9a8d62b8 bln=32 avl=03 flg=05
    value="Â*d"
    but on another schema, the value used is:
    Bind#0
    oacdty=01 mxl=32(32) mxlc=00 mal=00 scl=00 pre=00
    oacflg=03 fl2=1206001 frm=01 csi=178 siz=32 off=0
    kxsbbbfp=c5f92718 bln=32 avl=04 flg=05
    value="2101"
    however both produce invalid number errors.
    I am relatively inexperienced as a DBA so would appreciate as much help as i can get.

    Could you post your sql statement that is being run.
    Also post the query plan from your uat system and the one from your production system (They are likely to be different)
    You can export the stats from your production system and run them in your uat system. If you do this, then the execution plans should be the same on both systems(dbms_stats) and if you have the same data you should run into the same problem on uat as in production.
    The root cause of this type of problem is having a column in a table which holds values which are of different datatypes. Typically there is a condition in the where clause which indicates that for example only numeric columns should be retrieved from the column which holds multiple data types. However since the optimizer is free to rewrite the query any way it sees fit, (It does not necessarily execute in the order the sql statement is written) it does not filter this data first, and therefore you hit non-numeric data and run into the invalid number error.
    You can use little techniques like using an inline view with rownum in the column list, to perform the first filter. This ensures that the inline view is executed on its own, rather than being merged (materialized) with the rest of the query.
    A quick temporary solution is to use a comparison like to_char(column_name) = variable
    Make sure your comparisons are correct and it doesn't negatively impact on performance of the query

  • TO_CHAR to convert date getting 'Invalid number' error

    I am trying to convert a static date value using TO_CHAR function but I can't believe I am not able to do it such a simple conversion.
    //Obviously this is easy and everyone would like to give this as an example and this is what I see everwhere on Google and it works.
    SELECT TO_CHAR(sysdate, 'YYYY-MM-DD') FROM DUAL;
    How can I make it work like this?
    SELECT TO_CHAR('2010-JUN-23', 'YYYY-MM-DD') FROM DUAL;
    I keep getting "Invalid number" error. I changed my constant date to different formats but none works.

    Your first literal is not a date, assuming you didn't set NLS_DATE_FORMAT.
    So the code should have been
    SELECT TO_CHAR(to_date('2010-JUN-23','YYYY-MON-DD'), 'YYYY-MM-DD') FROM DUAL;
    Please note DATEs are always converted to VARCHAR2 when you SELECT them, using NLS_DATE_FORMAT.
    When you use a DATE string literal it ias always implicitly converted to a real date, by using NLS_DATE_FORMAT.
    So if you want all your dates formatted as YYYY-MON-DD, you need to set NLS_DATE_FORMAT to that mask.
    Sybrand Bakker
    Senior Oracle DBA

  • ORA-01722: invalid number error - column data type is date

    Hi all,
    When I perform this statement everything is ok, but some of clientbirthday values are null:
    select d.id, d.name, d.contragenttypeid, d.reestrtypeid, d.clientbirthday
    from creator.contragent d
    where d.contragenttypeid = 3
      and d.reestrtypeid in (2,4) When I'm trying to get "d.clientbirthday is not null" I receive error:
    select d.id, d.name, d.contragenttypeid, d.reestrtypeid, d.clientbirthday
    from creator.contragent d
    where d.contragenttypeid = 3
      and d.reestrtypeid in (2,4)
      and d.clientbirthday is not null ORA-01722: invalid number
    What is wrong? Why does it say "number" when clientbirthday column datatype is date ?

    Can you make a desc creator.contragent

  • Invalid Number Error for Decimal Field While Loading Data

    I am loading a delimited text file using the SQL* loader however I am reciving an error in my decimal fields. When a decimal field only has leading zeros before the decimal point I receive invalid number error. Below will clarify:
    i.e.) 00000000.30 [*Invalid number*]
    i.e.) 00046567.45 [*Valid number*]
    i.e.) 00000001.00 [*Valid number*]
    I've tried setting the precision/scale in the table, tried declaring it a decimal field instead of number, none of these methods fixed the issue. Any help I would really appreciate.
      POLICY_NUMBER             NUMBER,
      EFFECTIVE_DATE     DATE "YYYYMMDD"          NULLIF EFFECTIVE_DATE = '',
      TRANSACTION_DATE     DATE "YYYYMMDD",
      TRANSACTION_AMOUNT     DECIMAL EXTERNAL,   -- Tried TRANSACTION_AMOUNT DECIMAL EXTERNAL (10)  & TRANSACTION_AMOUNT NUMBER
      MF_TRX_CODE          NUMBER,
      USER_ID          CHAR,
      GROUP_NUMBER          NUMBER,
      EXPIRATION_DATE     DATE "YYYYMMDD"          NULLIF EXPIRATION_DATE = '',
      BILL_NUMBER          NUMBER,Any help is greatly appreciated. Thanks before hand.

    Hi,
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> SELECT * FROM TEST;
    TRANSACTION_AMOUNT
    SQL> SELECT * FROM TEST;
    TRANSACTION_AMOUNT
              11000,00
                293,37
               2000,00
               1134,32
                  0,30
    SQL>Between the selects I loaded the table with sql*loader using...
    Load Data
    INFILE *
    APPEND
    INTO TABLE TEST
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS
      TRANSACTION_AMOUNT     DECIMAL EXTERNAL
    BEGINDATA
    00011000.00
    00000293.37
    00002000.00
    00001134.32
    00000000.30The log is
    SQL*Loader: Release 10.2.0.1.0 - Production on Tue Dec 23 17:23:47 2008
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Control File:   test.ctl
    Data File:      test.ctl
      Bad File:     test.bad
      Discard File:  none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table TEST, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
       Column Name                  Position   Len  Term Encl Datatype
    TRANSACTION_AMOUNT                  FIRST     *   |       CHARACTER           
    Table TEST:
      5 Rows successfully loaded.
      0 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    Space allocated for bind array:                  16512 bytes(64 rows)
    Read   buffer bytes: 1048576
    Total logical records skipped:          0
    Total logical records read:             5
    Total logical records rejected:         0
    Total logical records discarded:        0
    Run began on Tue Dec 23 17:23:47 2008
    Run ended on Tue Dec 23 17:23:50 2008
    Elapsed time was:     00:00:02.86
    CPU time was:         00:00:00.06Regards,

  • Apex 4.2: Date picker & format mask number

    Hello
    In Apex 4.2, in a Date Item, how can I modify the date picker to set Monday as the start of week day? I can set Monday as the start of week day on a calendar, but not in a Date Item.
    In a Number Item, there's no format mask to set the comma char as a decimal separator and the dot char as a thousand separator. How can I create a new format mask number?
    Thank you.
    Edited by: user7034195 on 12-mar-2013 3:24

    for the Date Item, you can check this link, you have to call the process on the page load
    http://stackoverflow.com/questions/1313317/set-start-day-of-the-week-in-jquery-ui-datepicker
    and for the Number format, there's a little trick involved, will try to explain
    First of all convert you items from Number field to simple Textfield.
    1. Write this in your items Post Calculation Computation: TO_CHAR (:item_name, '999G999G999G999G990D00', 'NLS_NUMERIC_CHARACTERS = '',.''')This will do the number formatting you want, but in oracle above format is not acceptable, so while submitting the above values to database we need to undo the changes for that you can use the below code.
    2. Create a Computation "After Submit" for every item you did the above formatting and copy this code in it: replace(replace('1.00.00,00','.',''),',','.') for the 2nd step you can create a package/function which will get the items value as string and do the conversion as number using above code and return back the number.
    This should help you.
    Regards,
    Tauceef

  • Date Picker (Application Format Mask) YYYY-MM-DD HH24:MI

    I am experience what appears to be a bug with the Date Picker (Application Format Mask) that is causing the "DD" portion of the format mask to be interpreted as "CC" (when using a YYYY-MM-DD Application format).
    Within "Application Builder", "Edit Attributes" I have defined a "Static Substitution Strings" with the required Substitution String of PICK_DATE_FORMAT_MASK and a Substitution Value of "YYYY-MM-DD HH24:MI" (without the quotes).
    When this is used within the application, and I select a date of "January 15, 2008 @ 23:14", the date picker gives me a date of "2008-01-20 23:14". If I were to change the Year to 1957, the date I get is "1957-01-19 23:14". Note that if the century is 20, no matter what day of the month I pick, I get DD=20. If the century is 19, the day of the month is always 19.
    I have also tested this with a format of YYYY-DDD HH24:MI. With this format too, the DDD gets set to the century portion of the year.
    DD-MM-YYYY HH24:MI format does work, however this is not the format that my end users want to see. They want to see the format as "YYYY-MM-DD HH24:MI"
    If I change the PICK_DATE_FORMAT_MASK to "YY-MM-DD HH24:MI" and pick "Feb 8, 1977" I get "77-02-28" and if I pick "January 9, 1921" I get "21-01-31" which just happens to be the last day of the month in each of those case.
    So, something really weird is happen with the "Application Format Mask" Date Picker.
    Please note, that because of a known bug (relating to the translation of the Browser Language of "en-ca" to the propery NL_LANG of ENGLISH_CANADA) refer to
    HTMLDB - HOWTO Work with Dates
    I am executing the following code in my first "On Load - Before Header" and my first "On Submit - After Computations and Validations"
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT=''YYYY-MM-DD HH24:MI''' ;
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_SORT=''FRENCH''' ;
    Could you please investigate this problem.

    Paul,
    Thank you for the feedback and detailed reporting of this issue.
    This is a previously identified bug with the computation of the day component of the popup calendar.
    This correction will be available with the next HTML DB patch set and/or the release of HTML DB available later this year.
    Thanks again.
    Joel

  • Display as Date Picker (DD-MON-YYYY)

    Hi everyone,
    can you please help me:
    I want to change an item as Display as Date Picker (DD.MM.YYYY). I cannot find this mask.
    Can you help me to change or can you tell me, where i could find an example?
    Tahnk you and best regards
    Siegwin

    Note that changing the format of a Date Picker does not change the default database input/output date format. Meaning, the NLS_DATE_FORMAT (the default format used when selecting from, or writing to, the Oracle database) does not change when the date picker is changed.
    The date picker format used should match the date format of the application. Meaning that if you retrieve a date from the database into a text field and it found to be in the YYYY-MM-DD format, then the date picker used should be in the YYYY-MM-DD format and if the date retrieved from the database is in the format DD-MON-RR then the Date Picker used should also be in that format.
    The date picker is there to allow dates to be chosen from a calendar in a particular “text” format.
    So, set your date picker to match your NLS DATE FORMAT setting.
    Now, if you want to change the default input/output date format (which is likely your desired effect), then you want to start looking at the NLS settings in your database, the NLS settings in your DAD (reference Marvel.conf), and the NLS settings as they are affected by your Web browser Regional Settings (i.e. Language, territory). If this is the case, refer to the following postings:
    HTMLDB - HOWTO Work with Dates
    Re: HTMLDB - HOWTO Work with Dates
    HTMLDB - HOWTO Work with Dates
    HTMLDB - HOWTO Work with Dates
    YYYY-MM-DD Format for Canada and ISO
    YYYY-MM-DD Format for Canada and ISO

  • Plz help ...Error on data insert ORA-01722 :invalid number

    Hi everybody
    I have the strange situation
    I tested my code on test database It works well
    but when another user want insert new data on the same table on the working database Oracle give message ORA-01722 :invalid number
    and then I look to table's structure
    On the table my data type that i want insert and table type is same
    Plz help ...

    sriram wrote:
    Based on your Input I can give you
    ORA-01722:     invalid number
    Cause:     The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal. Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions. Only numeric fields may be added to or subtracted from dates.
    Action:     Check the character strings in the function or expression. Check that they contain only numbers, a sign, a decimal point, and the character "E" or "e" and retry the operationI checked input value and table column type are same Because of i can't understand this error message

  • Case When Statement and ORA:01722 Invalid number error

    Hi folks, I have posted this under another heading as well under E-business suite so apologies if some you have already seen it but I would really appreciate some help on this one. Any suggestions are most welcome.
    We are trying to put together a calculation that returns the number of days absent an individual has had in a given time period. We need to cater for those absences that started before the period and are closed during it, absence that start during the period and end after it, and those that open and close within it.
    The period is always a rolling 6 months from sysdate.
    This is the calc we have come up with so far which works for some people but we get the invalid number error if the absence includes a half day - so 0.5, 1.5,etc.
    This is probably over complicated but we are not techie at all so are learning as we go!
    We are using the HRMS - Administration - Oracle Human Resources (Core) business area in 10G and the Absence Attendance and Person folders.
    SUM(TO_NUMBER(NVL(( CASE WHEN Absence Attendance.Actual Start Date < TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') THEN ( CASE WHEN Absence Attendance."Actual End Date" > SYSDATE THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) END ) END ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( Absence Attendance.Duration Days ) END ) END ) END ) END ) END ),( DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") )),'999999990D00'))

    Hi,
    It could be that this is because you are using SYSDATE which contains the time as a fraction rather than TRUNC(SYSDATE) which just contains the current time. It could be that your working_dates_between raises this error.
    However, your formula is far more complicated than it needs to be.
    Firstly, you want to look at the date window ADD_MONTHS(TRUNC(SYSDATE), -6) to TRUNC(SYSDATE). Then you want to look at the portion of the absence that falls in the date window. This is GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6)) to LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE)). You may need to add 1 to the absence end date because this is the last day of their absence rather than the date they return. It depends how you calculate the days between the start and end
    date of the absence. You can create calculations for the start and end date of the absences within the 6 months time window. Create calculation AbsenceStart as
    GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6))
    and AbsenceEnd as
    LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE))
    Then you need to only pick up absence that a part of the absence in your 6 month date window. You can use a condition in the workbook or a condition in a case statement to do this. You then need to calculate the difference between these dates and SUM all the values.
    SUM(CASE WHEN AbsenceEnd >= AbsenceStart THEN WORKING_DAYS_BETWEEN(AbsenceStart, AbsenceEnd) END)
    That's it. Not so complicated after all.
    Rod West

  • Case When Statement and ORA:1722 Invalid number error

    Sorry I posted this in the wrong forum - I have the answer now
    Cheers
    HELP!!!
    We are trying to put together a calculation that returns the number of days absent an individual has had in a given time period. We need to cater for those absences that started before the period and are closed during it, absence that start during the period and end after it, and those that open and close within it.
    The period is always a rolling 6 months from sysdate.
    This is the calc we have come up with so far which works for some people but we get the invalid number error if the absence includes a half day - so 0.5, 1.5,etc.
    This is probably over complicated but we are not Techie at all so are learning as we go! We are using the HRMS - Administration - Oracle Human Resources (Core) business area in 10G and the Absence Attendance and Person folders.
    SUM(TO_NUMBER(NVL(( CASE WHEN Absence Attendance.Actual Start Date < TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') THEN ( CASE WHEN Absence Attendance."Actual End Date" > SYSDATE THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) END ) END ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( Absence Attendance.Duration Days ) END ) END ) END ) END ) END ),( DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") )),'999999990D00'))
    Edited by: CPearce on Sep 25, 2008 8:03 AM

    Hi,
    It could be that this is because you are using SYSDATE which contains the time as a fraction rather than TRUNC(SYSDATE) which just contains the current time. It could be that your working_dates_between raises this error.
    However, your formula is far more complicated than it needs to be.
    Firstly, you want to look at the date window ADD_MONTHS(TRUNC(SYSDATE), -6) to TRUNC(SYSDATE). Then you want to look at the portion of the absence that falls in the date window. This is GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6)) to LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE)). You may need to add 1 to the absence end date because this is the last day of their absence rather than the date they return. It depends how you calculate the days between the start and end
    date of the absence. You can create calculations for the start and end date of the absences within the 6 months time window. Create calculation AbsenceStart as
    GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6))
    and AbsenceEnd as
    LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE))
    Then you need to only pick up absence that a part of the absence in your 6 month date window. You can use a condition in the workbook or a condition in a case statement to do this. You then need to calculate the difference between these dates and SUM all the values.
    SUM(CASE WHEN AbsenceEnd >= AbsenceStart THEN WORKING_DAYS_BETWEEN(AbsenceStart, AbsenceEnd) END)
    That's it. Not so complicated after all.
    Rod West

  • Default Value Date Picker Field

    Hello:
    In a detail tabular form I am referencing a date picker field from the master form as default value.
    This is the situation in the detail form:
    TABULAR FORM
    Column Name:                   FECHAREGISTRO -- the field's name in the detail tabular form
    Default Type: Item (application or page item name)
    Default: P68_FECHAREGISTRO -- It's a field in the master form and also is Date Picker format
    Reference Table Owner: SAMPEDRORIVEROS
    Reference Table Name: BITACORAABOGADO
    Reference Column Name: FECHAREGISTRO -- It's a date field in the database
    At execution time I have the error:
    report error:
    ORA-01790: expression must have same datatype as corresponding expression
    I think it is because i must use to_date and to_char in order to change the datatype and i have tried using:
    Default: to_date(to_char(:P68_FECHAREGISTRO,'DD-MON-YYYY'),'DD-MON-YYYY')
    and in Default Type: PL/SQL Expression or Function
    but I get a different message at execution time:
    report error:
    ORA-01722: invalid number
    Could you explain me what is the problem??
    Thanks in advance.
    Jairohernan

    I don't think you need to do a to_char here
    try
    to_date(:P68_FECHAREGISTRO,'DD-MON-YYYY')

  • Date Picker Translate Help

    Hi
    We've been using jQuery date pickers long before APEX used them as standard so have our own way of implementing them, that being said it shouldn't have any effect on what I'm trying to do.
    I have an application (APEX 4.2.1) that is used in a number of different languages. We don't use the APEX date picker and instead display dates as text fields, add a specific class to them and attributes as required. The class is picked up in javascript and the field is converted to a jQuery UI date picker with the attributes controlling certain behaviour (date restrictions etc.) This works fine and the date picker is translated to the different languages without a problem.
    Now I have a page in which fields defined by the user are displayed along side APEX fields. To do this I'm using apex_item and generating items on the page based on settings controlled by the user in another part of the application. The APEX items are displayed followed by custom items using apex_item. Again, this works fine and I've used it many times before.
    The problem I have is when a user creates a custom field which is a date picker and the date picker is translated.
    If the user is viewing the page in Norwegian then for an APEX field the date picker is shown in Norwegian and if they select May 1st then 1-Mai-2013 is returned to the field. The value of this field is 1-Mai-2013 when the page is submitted, but somehow the value is saved in the database correctly and when the database is queried the date is saved as 01-MAY-2013. For a custom field the value is saved in the database as 1-Mai-2013 and when this is then viewed by a user in English the page errors with not a valid month.
    My questions are:
    - How does APEX save a translated date field? How does 1-Mai-2013 become a proper date? If I try to save this in the database, unsurprisingly I get an invalid month error.
    - How can I use apex_item to have a date picker that is translated? apex_item.date_popup can't be used as this doesn't use the jQuery date picker. Perhaps this is a setting in jQuery UI to translate the date back? One solution is to use dd/mm/yyyy format, but I really don't want to do this.
    Many thanks for your help. If you need any more info let me know.
    Sara

    Hi Mike
    Thanks for the reply. When I said that it's saved as 01-MAY-2013, I was aware that it wasn't actually saved as this and is stored as a date. My point was that as a user I had entered the text 1-Mai-2013 on the screen and somehow it was changed to a date which when queried in the database was returned correctly as 01-MAY-2013. Showing that somehow it had been translated correctly from Norwegian. Even if I were to save my custom field value in a date column in the database, I would get an error as it would be trying to insert 1-Mai-2013 into a date column which isn't of the correct format. I think the problem can be resolved if I can convert the text in my custom field into a date.
    I've been able to find a possible solution, but I'm having problems implementing this.
    If I run
    select to_date('03-Okt-2013','DD-Mon-YYYY','nls_date_language=NORWEGIAN') from dual;
    this returns the correct date in the correct format (03-OCT-2013), which could be saved in my table and the problem would be resolved. I know what language is being used in my APEX session so I've used the following code to my procedure:
              CASE V('FSP_LANGUAGE_PREFERENCE')
              WHEN 'no' THEN v_value := to_date(v_value,'DD-Mon-YYYY','nls_date_language=NORWEGIAN');
              WHEN 'sv' THEN v_value := to_date(v_value,'DD-Mon-YYYY','nls_date_language=SWEDISH');
              WHEN 'pl' THEN v_value := to_date(v_value,'DD-Mon-YYYY','nls_date_language=POLISH');
              ELSE v_value := to_date(v_value,'DD-Mon-YYYY');
              END CASE;
    I've tested this through SQL*Plus and it works perfectly. The dates are always converted from Norwegian to English (the default for the database) DD-MON-YYYY.
    However, when I run the same code through APEX it doesn't work. The date is still stored as Norwegian. If I enter 10-Mai-2013 in the field that is exactly what is stored in the database. I've even added debug to make sure it's running the right bit of code and it is.
    Why would this code work in SQL but not through an APEX session? And is there anything I can do to resolve this?!
    Many thanks
    Sara

  • Date Picker not allowing to capture time

    Hello Friends,
    I am trying to create a tabular form on a table[create SQL as below].
    CREATE TABLE  "JOB_RUN_DETAILS"
       (     "JOB_NAME" VARCHAR2(100),
         "SCH_RUN_DATE" DATE,
         "START_DATE" DATE,
         "END_DATE" DATE,
         "STATUS" VARCHAR2(100),
         "ID" NUMBER NOT NULL ENABLE
    /My idea of the tabular form is to allow entry of time both hours and minutes from the date picker along with date for <b>"START_DATE", "END_DATE" </b> items.
    But I dont see a possibility to do that for hours and minutes. But I remember having seen this in Apex 3.2, not sure if I missed some thing while page making or this feature of Date Picker is left intentionally in the new release.
    Please share any ideas you have.
    Thanks,
    Chaitu.

    My understanding is you are trying to create a Tabular form using the Table which you specified, you are expecting time part to be displayed in the Date Picker column ?.
    The Time part of hours and Minutes will be displayed based on the format mask used for the Application or the item. if the format mask is DD-MM-YYYY HH24:MI then you will see the hour and minute part with the Date Picker.

  • Looking for a "free" Date Picker

    I'm looking for a free to download and use Date Picker that I can integrate into a small Swing app. Nothing fancy, just a calendar (probably using a JTable) and the ability to select a day of year/month and (possibly) a time of day.
    I'm searching google but they're all commercial licenses and I'm simply building this app as a learning process, not for profit.
    If there's nothing out there, I'll just stick with my series of combo-boxes :)
    Cheers,
    Chris

    Oh yeah, I should point out that I'm not just being lazy. I've spent a while trying to build it myself to no avail. I got as far as displaying the grid :P
    http://www.w3style.co.uk/~d11wtq/datepicker.png (out of date, the days are correct now)
    package org.w3style.calendar;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class CalendarPanel extends JPanel
         protected CalendarEventController controller = null;
         public CalendarModel model = null;
         //JComponents
         protected JComboBox monthDropdown = null;
         protected JSpinner yearDropdown = null;
         protected JTable grid = null;
         public CalendarPanel(String title)
              super(new GridBagLayout());
              this.model = new CalendarModel();
              this.controller = new CalendarEventController();
              this.controller.setUI(this);
              this.controller.setModel(this.model);
              this.setBorder(BorderFactory.createTitledBorder(title));
              GridBagConstraints c = new GridBagConstraints();
              c.gridx = 0;
              c.gridy = 0;
              c.fill = GridBagConstraints.HORIZONTAL;
              c.anchor = GridBagConstraints.WEST;
              this.addMonths(c);
              c.gridx = 1;
              c.anchor = GridBagConstraints.EAST;
              c.fill = GridBagConstraints.NONE;
              this.addYears(c);
              c.gridx = 0;
              c.gridy = 1;
              c.gridwidth = 2;
              this.addTable(c);
         protected void addMonths(GridBagConstraints c)
              String[] months = this.model.getMonths();
              if (this.monthDropdown == null)
                   this.monthDropdown = new JComboBox(months);
              int monthNow = this.model.getCurrentMonth();
              this.monthDropdown.setSelectedIndex(monthNow);
              this.model.setSelectedMonth(monthNow);
              this.controller.addMonthDropdown(this.monthDropdown);
              this.add(this.monthDropdown, c);
         public JComboBox getMonthDropdown()
              return this.monthDropdown;
         protected void addYears(GridBagConstraints c)
              this.yearDropdown = new JSpinner(this.model.getYearSpinnerModel());
              this.yearDropdown.setEditor(new JSpinner.DateEditor(this.yearDropdown, "yyyy"));
              this.add(this.yearDropdown, c);
         protected void addTable(GridBagConstraints c)
              JPanel box = new JPanel(new GridBagLayout());
              GridBagConstraints myC = new GridBagConstraints();
              myC.gridx = 0;
              myC.gridy = 0;
              this.grid = new JTable(this.model.getTableModel());
              this.configureTable();
              box.add(this.grid.getTableHeader(), myC);
              myC.gridy = 1;
              box.add(this.grid, myC);
              this.add(box, c);
         public void configureTable()
              this.grid.setDragEnabled(false);
              this.grid.getTableHeader().setReorderingAllowed(false);
              this.grid.getTableHeader().setResizingAllowed(false);
              CalendarCellRenderer renderer = new CalendarCellRenderer();
              renderer.setParentUI(this);
              TableColumn col = null;
              for (int i = 0; i < 7; i++)
                   col = this.grid.getColumnModel().getColumn(i);
                   col.setPreferredWidth(25);
                   col.setCellRenderer(renderer);
              this.grid.setSelectionBackground(new Color((float)0.7, (float)0.86, (float)1.0));
              this.grid.setSelectionForeground(Color.black);
              this.grid.setShowGrid(false);
              this.grid.setRowHeight(20);
              if (this.model.getSelectedMonth() == this.monthDropdown.getSelectedIndex())
                   int r = this.model.getSelectedGridRow();
                   this.grid.setRowSelectionInterval(r, r);
                   int c = this.model.getSelectedGridColumn();
                   this.grid.setColumnSelectionInterval(c, c);
         public JTable getGrid()
              return this.grid;
    * Manages the rendering of the cells in the calendar
    package org.w3style.calendar;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    * This is just a basic extension of the DefaultTableCellRender from the current L&F
    public class CalendarCellRenderer extends DefaultTableCellRenderer
          * The current row being rendered
         protected int row;
          * The current column being rendered
         protected int col;
          * If this cell is part of the "selected" row
         protected boolean isSelected;
          * The table being rendered
         protected JTable tbl;
         protected CalendarPanel parentUI = null;
         public void setParentUI(CalendarPanel p)
              this.parentUI = p;
          * Fetch the component which renders the cell ordinarily
          * @param JTable The current JTable the cell is in
          * @param Object The value in the cell
          * @param boolean If the cell is in the selected row
          * @param boolean If the cell is in focus
          * @param int The row number of the cell
          * @param int The column number of the cell
          * @return Component
         public Component getTableCellRendererComponent(JTable tbl, Object v, boolean isSelected, boolean isFocused, int row, int col)
              //Store this info for later use
              this.tbl = tbl;
              this.row = row;
              this.col = col;
              this.isSelected = isSelected;
              //and then allow the usual component to be returned
              return super.getTableCellRendererComponent(tbl, v, isSelected, isFocused, row, col);
          * Set the contents of the cell to v
          * @param Object The value to apply to the cell
         protected void setValue(Object v)
              super.setValue(v); //Set the value as requested
              //Set colors dependant upon if the row is selected or not
              if (!this.isSelected) this.setBackground(new Color((float)0.87, (float)0.91, (float)1.0));
              else this.setBackground(new Color((float)0.75, (float)0.78, (float)0.85));
              //Set a special highlight color if this actual cell is focused
              if (this.row == this.tbl.getSelectedRow() && this.col == this.tbl.getSelectedColumn())
                   this.setBackground(new Color((float)0.5, (float)0.80, (float)0.6));
                   this.parentUI.model.setSelectedMonth(this.parentUI.getMonthDropdown().getSelectedIndex());
                   this.parentUI.model.setSelectedGridRow(this.row);
                   this.parentUI.model.setSelectedGridColumn(this.col);
    package org.w3style.calendar;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import java.util.Date;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.*;
    public class CalendarModel
         protected GregorianCalendar calendar = null;
         protected Integer selectedMonth = null;
         protected Integer selectedYear = null;
         protected Integer selectedGridRow = null;
         protected Integer selectedGridColumn = null;
         String[][] days = null;
         public CalendarModel()
              this.days = new String[6][7];
              this.calendar = new GregorianCalendar();
         public GregorianCalendar getCalendar()
              return this.calendar;
         public String[] getMonths()
              String[] months = {
                   "January", "February", "March", "April", "May", "June",
                   "July", "August", "September", "October", "November", "December" };
              return months;
         public int getDaysInMonth()
              int[] daysInMonths = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
              int month = this.calendar.get(Calendar.MONTH);
              int ret = daysInMonths[month];
              if (month == 1 && this.calendar.isLeapYear(this.calendar.get(Calendar.YEAR))) ret += 1;
              return ret;
         public String[] getDayHeadings()
              String[] headings = { "S", "M", "T", "W", "T", "F", "S" };
              return headings;
         public DefaultTableModel getTableModel()
              String[] headings = this.getDayHeadings();
              Object[][] data = this.getDays();
              DefaultTableModel model = new DefaultTableModel(data, headings) {
                   public boolean isCellEditable(int row, int col)
                        return false;
              return model;
         public SpinnerDateModel getYearSpinnerModel()
              Date now = this.calendar.getTime();
              int year = this.calendar.get(Calendar.YEAR);
              this.calendar.add(Calendar.YEAR, -1000);
              Date earliest = this.calendar.getTime();
              this.calendar.add(Calendar.YEAR, 2000);
              Date latest = this.calendar.getTime();
              this.calendar.set(Calendar.YEAR, year);
              SpinnerDateModel model = new SpinnerDateModel(now, earliest, latest, Calendar.YEAR);
              return model;
         public void setSelectedGridRow(int r)
              this.selectedGridRow = r;
         public Integer getSelectedGridRow()
              return this.selectedGridRow;
         public void setSelectedGridColumn(int c)
              this.selectedGridColumn = c;
         public Integer getSelectedGridColumn()
              return this.selectedGridColumn;
         public int getSelectedMonth()
              return this.selectedMonth;
         public void setSelectedMonth(int m)
              this.selectedMonth = m;
         public String[][] getDays()
              int currDay = this.calendar.get(Calendar.DAY_OF_MONTH);
              this.calendar.set(Calendar.DAY_OF_MONTH, 1);
              int firstDayOfMonthAsDayOfWeek = this.calendar.get(Calendar.DAY_OF_WEEK);
              this.calendar.set(Calendar.DAY_OF_MONTH, currDay);
              int daysInMonth = this.getDaysInMonth();
              int row = 0;
              int key = 0;
              int dayToAdd = 0;
              for (int k = 1; k <= 42; k++)
                   if (k < firstDayOfMonthAsDayOfWeek || dayToAdd >= daysInMonth) this.days[row][key] = "";
                   else
                        dayToAdd++;
                        this.days[row][key] = ""+dayToAdd;
                        //Hack?
                        if (dayToAdd == currDay && this.getSelectedGridRow() == null && this.getSelectedGridColumn() == null)
                             this.setSelectedGridRow(row);
                             this.setSelectedGridColumn(key);
                   key++;
                   if (key == 7)
                        key = 0;
                        row++;
              return this.days;
         public int getCurrentMonth()
              int currentMonth = this.calendar.get(Calendar.MONTH);
              return currentMonth;
         public void setYear(int year)
         public void setMonth(int month)
    package org.w3style.calendar;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    public class CalendarEventController
         protected CalendarPanel ui = null;
         protected CalendarModel model = null;
         public CalendarEventController()
         public void setUI(CalendarPanel cal)
              this.ui = cal;
         public void setModel(CalendarModel m)
              this.model = m;
         public void addMonthDropdown(JComboBox months)
              months.addItemListener(new ItemListener() {
                   public void itemStateChanged(ItemEvent e)
                        if (e.getStateChange() == ItemEvent.SELECTED)
                             int monthSelected = ui.monthDropdown.getSelectedIndex();
                             model.getCalendar().set(Calendar.DAY_OF_MONTH, 1);
                             model.getCalendar().set(Calendar.MONTH, monthSelected);
                             //update days in table model, update ui
                             ui.getGrid().setModel(model.getTableModel());
                             ui.configureTable();
                             ui.getGrid().updateUI();
    }I could have finished it but it was just going to be a buggy mess.

Maybe you are looking for

  • Imac Bootcamp installation without cd drive

    hello I want to buy the new Imac. And I want to install Windows 7 on it with Bootcamp. But how can I install Windows 7 without a Cd Drive. Maybe on a USB Stick? but how does it work?

  • Project ipad to tv

    Just as title says, I have 2 70 inch tv and an iPad Air I would like to project the screens of my apps I play to the tv while still using the IPA...it's actually to allow my dad to play racing games on the tv via the ipad. Wireless option would be be

  • When I click on pictures they will not enlarge

    when I go to a website and there is a photo of an article for sale and I click on the picture to enlarge, the new window opens up blank

  • What is the Text Book correct way to do a spot uv merging multiple applications and exporting from 1

    I am unsuccesssfully finishing a project using Spot UV and about to start another.  I want to start this one out the Text Book correct way.  Here are the details. I have logo's coming from Illustrator that I want to have a spot UV on I have photos co

  • Add calendar to Acrobat dialog

    Hi all,      I' m creating the dialog in my PDF form.I know that there exists a mini calendar when clicking the Date/Time field in form. I try to add this calendar to the popup dialog for user to select the date. As it seems like something that shoul