I'm producing 'invalid NUMBER OF arguements' - but where?

afternoon gurus..
This line was bringing a 'ORA-00932: inconsistent datatypes: expected DATE got NUMBER' WHEN it was this..
, DECODE(SIGN(TRUNC(apid.accounting_date)- TRUNC('14-jun-2011')),1,0, ROUND(NVL(apid.quantity_invoiced,0),2) )
,apid.accounting_date, NVL(apid.quantity_invoiced,0)
..so I added a 'to_date' TO it..
, DECODE(SIGN(TRUNC(apid.accounting_date)- TRUNC(TO_DATE('14-jun-2011','dd-mon-yyyy')),1,0, ROUND(NVL(apid.quantity_invoiced,0),2) )
,apid.accounting_date, NVL(apid.quantity_invoiced,0)
..AND it now produces THE 'invalid NUMBER OF arguements' message..
how DO I get OVER this please?
TIA..
Joe

Missing a bracket I think...
DECODE(SIGN(TRUNC(apid.accounting_date)- TRUNC(TO_DATE('14-jun-2011','dd-mon-yyyy')),1,0, ROUND(NVL(apid.quantity_invoiced,0),2) )should be
DECODE(SIGN(TRUNC(apid.accounting_date)-TRUNC(TO_DATE('14-jun-2011','dd-mon-yyyy'))),1,0, ROUND(NVL(apid.quantity_invoiced,0),2) )

Similar Messages

  • Invalid number in 10g but not in 9i

    Hello,
    I have a weird problem with the database version 10.2.0.2.0.
    The following function executes in database version 9.2.0.7.0 as expected and for a long while everything is ok. But know on the new database I got an error: ORA-01722: invalid number at this line:
    FOR rec_apex_navigation_role IN c_apex_navigation_role( rec_core_role.ID )
    I discovered that all referenced columns there are of the type NUMBER(10,0), so that isn`t the problem.
    Here is the whole code of the function:
    FUNCTION get_page_role_sql
    RETURN VARCHAR2 IS
    proc_name CONSTANT VARCHAR2( 60 ) := package_name || '.get_page_role_sql';
    ret_value VARCHAR2( 32000 );
    p_column VARCHAR2( 100 );
    p_column_nr PLS_INTEGER;
    CURSOR c_apex_navigation IS
    SELECT a.ID,
    a.page_id,
    a.page_name
    FROM apex_navigation a
    ORDER BY ID;
    CURSOR c_apex_navigation_role(
    x_role_id apex_navigation_role.role_id%TYPE
    ) IS
    SELECT c.seq_id,
    c.c001 page_id,
    nr.role_id
    FROM wwv_flow_collections c, apex_navigation_role nr
    WHERE c.collection_name = c_col_page_role
    AND nr.navigation_id = TO_NUMBER( c.c001 )
    AND nr.role_id = x_role_id;
    CURSOR c_core_role IS
    SELECT ID,
    NAME,
    ROWNUM col_nr
    FROM core_role
    ORDER BY ID;
    BEGIN
    wwv_flow_collection.create_or_truncate_collection( c_col_page_role );
    wwv_flow_collection.create_or_truncate_collection( c_col_role_column );
    ret_value := 'SELECT c002 "Id",c003 "Seite",';
    FOR rec_apex_navigation IN c_apex_navigation
    LOOP
    wwv_flow_collection.add_member( p_collection_name => c_col_page_role, p_c001 => rec_apex_navigation.ID, p_c002 => rec_apex_navigation.page_id, p_c003 => rec_apex_navigation.page_name );
    END LOOP;
    FOR rec_core_role IN c_core_role
    LOOP
    p_column_nr := rec_core_role.col_nr + 3;
    p_column := 'c' || TRIM( TO_CHAR( p_column_nr, '000' ));
    ret_value := ret_value || 'APEX_ITEM.CHECKBOX( ' || p_column_nr || ', c001 , DECODE( ' || p_column || ',NULL, NULL, ''CHECKED'' ) ) "' || rec_core_role.NAME || '",';
    wwv_flow_collection.add_member( p_collection_name =>
    c_col_role_column, p_c001 => p_column_nr, p_c002 => rec_core_role.ID, p_c003 => rec_core_role.NAME );
    FOR rec_apex_navigation_role IN c_apex_navigation_role( rec_core_role.ID )
    LOOP
    wwv_flow_collection.update_member_attribute( p_collection_name => c_col_page_role, p_seq => rec_apex_navigation_role.seq_id, p_attr_number => p_column_nr, p_attr_value => rec_apex_navigation_role.role_id );
    END LOOP;
    END LOOP;
    ret_value := RTRIM( ret_value, ',' ) || ' FROM wwv_flow_collections WHERE collection_name = ''' || c_col_page_role || '''';
    RETURN ret_value;
    END;
    So the strange thing is, that it works in version 9 and not in version 10...
    Does anybody have an idea where the problem is?
    Thank you,
    Tim

    Well, I would suggest that there is something in your data which is causing the problem most likely due to an implicit data conversion, even though you insist not.
    However, without your data it is impossible to comment, only possible to guess.
    Can you reduce the problem any further to a reproducible test case that someone else could run?
    Have you tried the two workarounds in the article, not as a permanent solution, but to see if your problem persists?
    Message was edited by:
    dombrooks

  • 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

  • Ora-01722 invalid number error within view

    Hi, in my oracle 9.2.0.4.0 db, under TEST schema i've a view called PRODUTTIVITA_LINEE. I'm trying to create another view joining PRODUTTIVITA_LINEE with a table called LINEE. But when i execute the select (SELECT PRODUTTIVITA_LINEE.*, LINEE.NAME FROM PRODUTTIVITA_LINEE, LINEE WHERE PRODUTTIVITA_LINEE.LINEA_ID = LINEE.LINEA_ID), i obtain the ORA-01722 invalid number error.
    But if i create a table PRODUTTIVITA_SUPPORT as select all fields from PRODUTTIVITA_LINEE and i use it in the new query (SELECT PRODUTTIVITA_SUPPORT.*, LINEE.NAME FROM PRODUTTIVITA_SUPPORT, LINEE WHERE PRODUTTIVITA_SUPPORT.LINEA_ID = LINEE.LINEA_ID), all works.
    Using the view, the new query doesn't work, but using the same data toke from a table instead of view, all works. Why?

    Excuse me but i send modified script. Here the original script of object.
    SQL> desc PRODUTTIVITA_LINEE;
    Nome                               Nullo?   Tipe
    LINEA_ID                   NUMBER(9)           
    COD_LINEA_ANDATA                 VARCHAR2(8)        
    COD_LINEA_RITORNO                VARCHAR2(4)        
    ID_TRAT_PIC_ANDATA                NUMBER               
    ID_TRAT_PIC_RITORNO               NUMBER               
    DESC_LINEA                              VARCHAR2(120)     
    EKM_NOMINALI                         NUMBER                 
    EKM_SCONTATI                        NUMBER                 
    KMLINEA                                  NUMBER                 
    ANNO                                       NUMBER                  SQL> desc PRODUTTIVITA_SUPPORT;
    Nome                           Nullo?     Tipe
    LINEA_ID             NUMBER(9)
    COD_LINEA_ANDATA           VARCHAR2(8)
    COD_LINEA_RITORNO          VARCHAR2(4)
    ID_TRAT_PIC_ANDATA          NUMBER
    ID_TRAT_PIC_RITORNO         NUMBER
    DESC_LINEA                      VARCHAR2(120)
    EKM_NOMINALI                     NUMBER
    EKM_SCONTATI                   NUMBER
    KMLINEA                            NUMBER
    ANNO                                NUMBER Both objects have 5400 records and are the same.

  • I have produced a number of DVD on my iMac. They are stored in a folder called Burn Folder. I want to get them into iTunes so I can play them on Apple TV. I have tried to convert them to MP4s using Handbrake but Handbrake does not recognize these files.

    I have produced a number of DVD on my iMac. They are stored in a folder called Burn Folder. I want to get them into iTunes so I can play them on Apple TV. I have tried to convert them to MP4s using Handbrake but Handbrake does not recognize these files. I am stumped.

    If you have the original movie files, you'd be much better converting those, otherwise try MPEGstreamclip.

  • When i tried to text a message from my contact list  i received a message saying invalid number of digits. i use the area code with the number but still would not send

    When i tried to text a message from my contact list  i received a message saying invalid number of digits. i used the area code with the number but still would not send

    Call your carrier and see what they suggest.

  • Jdbc insert fails with 01722: invalid number but sqlplus doesn't

    I am experiencing a 01722: invalid number on a remote system in Canada. Initially, I couldn't insert '0.0' into a number field, but after changing the ...Oracle/HOME0 ... registry value from ENGLISH_CANADA.WE8MSWIN1252 to AMERICAN_AMERICA.WE8MSWIN1252 and recycling the App Server (Oracle client) I was able to insert '0.0' into a number field.
    But my java app using JDBC had the same error "ORA-01722: invalid number" occurring for the same table and attribute -- only this time -- when I attempted to manually insert the same insert '0.0' into a number field -- it worked via SQLPlus.
    The NLS_Lang is set to AMERICAN_AMERICA.WE8MSWIN1252.
    I confirmed that the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP value is 1252.
    Assuming a theory that maybe it is a setting on the DB Server, I tried reproducing this problem locally in my lab configuration by setting the NLS_Lang registry value to ENGLISH_CANADA.WE8MSWIN1252. I used the same jdbc test app to issue the insert....but it worked.
    --- Any advice on what other configuration changes could influence the number data type or whether it is possibly a DB Server setting instead of client -- would be greatly appreciated.

    JDBC does not care about NLS_LANG. It takes the Java default locale, maps it to Oracle language/territory pair and sends to the server.
    Just try this:
    Statement stmt = conn.createStatement();
    stmt.execute( "ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.,'" );
    or bind numeric datatypes.
    -- Sergiusz

  • Error Invalid Number, re-send using a 10 digit number when texting a certain number, but when I put the area code in it still sends to the 7 digit number

    About a month ago I added a friends number without the area code. I was in an area that I couldn't send texts from.  Two days ago he texted me and I tried to reply, but when I did I got the error message "Error Invalid Number. Please re-send using a valid 10 digit mobile number or valid short code."
    So, I put in the area code in front of the number and when I sent it, the phone dropped the area code and just sent it to the 7 digit number.  I went ahead and deleted all of his contact information and text messages to him and re-entered the with the area code and saved him as a new contact.  I tried to text the number and it still sent it to only the 7 digit number!!!
    I have tried everything there is to try, but there seems to be a part of the phone that is remembering this number even after I've deleted it and everything associated with it.
    Does anybody have a solution for this??  I have called Apple and they told me they have never heard of this problem before.

    The fix for this problem is easy and is set out here: http://edctips.blogspot.com/2014/09/fixing-iphone-texting-problem.html

  • TS2755 I recently upgraded my IPhone and for 1 person I began receiving this "7233375 Error Invalid Number. Please re-send using a valid 10 digit mobile number or valid short code". I receive text from this person but cannot send. Please help. Thank you.

    I recently upgraded my IPhone and for 1 person I began receiving this "7233375 Error Invalid Number. Please re-send using a valid 10 digit mobile number or valid short code". I receive text from this person but cannot send. Please help. Thank you.

    Hi there
    I’d be happy to help with this messaging error! This will be due to the device storing the number incorrectly. Please do the following to resolve the issue:
    Delete texts from both old number and new
    Delete any call logs including these numbers
    Delete old number from contacts
    Delete new number from contacts
    Restart device
    Send text to the new number directly (do not save as contact)
    Once the text sends successfully, you can then save as a new contact
    I hope this helps!
    Charise

  • Cannot change the print margins when printing out my spreadsheet.  Tried clicking on format and then Document but when I enter a number I always get " invalid number".

         I cannot change the margins when printing out my spreadsheet.  I clicked on the format then on document and got a entry box.  But everytime I try entering a number to change the left margin ( tried .5 ) I get an " invalid number " response.  I can print out the spreadsheet but always get a message telling me the margins may be too small and data may be clipped.  Data doesn't get clipped but left part of the spreadsheet is right at the left side of the paper.  Want to change the margin so I don't get that message.

    Naming the spreadsheet app would do wonders for getting an answer.

  • ORA-01722: invalid number - I know where its failing - but why???

    Not a clue..
    lMy code is trying to update certain employees with their most recent entry - its the cursor ......... I'm using, I know I'm wanting it to use a NUMBER in '............' but its not using one (around the 'Section 2 part')..
    eror message ....
    ...............................many many thanks for looking..
    Tim

    Timmy wrote:
    Ok thanks for comments..
    I've tried to_number(employeenumber,999999999) in the ........... and ............. cursors but still the same error message is returned. I hear what you're saying regarding the no WHERE clause on the UPDATe but I dont know what to do there either (working my way down the code..!) Ditto the LOOPing - trial and error really..
    So if someone could suggest how I fix this 'invalid number' issue I'd be extremely grateful...
    thanks for loooking..
    TimYou need to get very clear in your head what is a number and what isn't, as well as what to_number() does.
    this is a number ===> 123456
    (notice the lack of quotes?)
    this is a character string, not a number ===> '123456'
    (notice the quotes?)
    I don't care how much the second looks like a number to you, as far as oracle is concerned it is just a string of characters, fundamentally no different than your last name.
    the function TO_NUMBER() is used to convert a character string that looks like a number (in other words, all of the characters in the string are numeric characters - characters that we use to represent numbers) into a real number. Thus
    sql> select to_number('123456') from dual;is a legitimate use of the function. However
    sql> select to_number(123456) from dual;Makes no sense, because you are asking it to convert a number to a number. So internally, it has to first recast the number into a character string so that it can pass a legal argument to TO_CHAR to be converted back to a number.

  • I have one contact that I can call but cannot text. A return text states it is an invalid number. How can I fix it?

    I have one contact that I can call but cannot text. A return text states it is an invalid number. I have erased and re-entered the contact, changed phone identification and tried resetting the network - none have worked. What else can I try?

    What kind of phone is this person using? If this is an iPhone, are you logged into iMessage. If this is not an iMessage, then I suggest you both contact AT&T. SMS which is what is used between non-iPhone devices or between an iPhone and non-iPhone device are a carrier function. There is no setting in iOS or on the iPhone that deals with SMS. If you are able to send iMessage and/or SMS to other people, then AT&T needs to either look into your account to ensure SMS is configured, or they need to look at this other person's phone to see what it is reporting as its number since it is coming back invalid for you.

  • Please help: Case Statement - ORA-01722: invalid number Error

    Hi All,
    I'm trying to use Case statement to recode Cancelled statuses into two groups
    'Reject' if the difference between first date and last date is less than 29 and
    'Accept' if the difference between first date and last date is greater than 30
    Here is my 'test' data:
    STATUS     FIRST_DATE     LAST_DATE
    Transfer     10/08/2011     10/09/2011
    Mover     10/08/2011     15/09/2011
    Cancel     10/08/2011     16/09/2011
    Cancel     10/08/2011     5/09/2011
    Here is the syntax
    select a.*,
    (CASE WHEN a.STATUS ='Cancel' THEN (round(a.LAST_DATE-a.FIRST_DATE))
    ELSE 0
    END) CAN_DAYS,
    (CASE WHEN 'CAN_DAYS' >29 THEN 'Reject'
    WHEN 'CAN_DAYS' <30 THEN 'Accept'
    END) Reject_Accept
    from test a
    The first CASE statement works fine and gives me this
    STATUS     FIRST_DATE     LAST_DATE     CAN_DAYS
    Transfer     10/08/2011     10/09/2011     0
    Mover     10/08/2011     15/09/2011     0
    Cancel     10/08/2011     16/09/2011     37
    Cancel     10/08/2011     5/09/2011     26
    but the second CASE produces ORA-01722: invalid number Error. It is something to do with the CAN_DAYS data type, Oracle doesn't see it as Numeric i think.
    The result i want to see would be
    STATUS     FIRST_DATE     LAST_DATE     CAN_DAYS Reject_Accept
    Transfer     10/08/2011     10/09/2011     0
    Mover     10/08/2011     15/09/2011     0
    Cancel     10/08/2011     16/09/2011     37 Accept
    Cancel     10/08/2011     5/09/2011     26 Reject
    Could someone please help me to fix the syntax?
    Thank you in advance,

    This seems to give you your desired results...
    with test as
      ( select 'Transfer' as status, to_date('10/08/2011') as first_date, to_date('10/09/2011') as last_date  from dual union all
        select 'Mover'             , to_date('10/08/2011')              , to_date('15/09/2011')               from dual union all
        select 'Cancel'            , to_date('10/08/2011')              , to_date('16/09/2011')               from dual union all
        select 'Cancel'            , to_date('10/08/2011')              , to_date('05/09/2011')               from dual
    select  status
         ,  first_date
         ,  last_date
         ,  CAN_DAYS
         ,  CASE
              WHEN CAN_DAYS =   0 THEN NULL
              WHEN CAN_DAYS <  30 THEN 'Reject'
              WHEN CAN_DAYS >= 30 THEN 'Accept'
            END  Reject_Accept
      from  ( select  status
                   ,  first_date
                   ,  last_date
                   ,  CASE
                        WHEN STATUS ='Cancel' THEN round(LAST_DATE-FIRST_DATE)
                        ELSE 0
                      END  CAN_DAYS
                from  test
    ;

  • ORA-01722: invalid number

    Hi,[email protected]
    we are working on Import tool, which takes a CSV file and inserts in Oracle
    DB.I am using PLSQL UTL_File.Please look into the PLSQL file and clarify my
    Queries.
    If the Last column is a Varchar field, we are able to insert Records
    comfortably. but we get the Following Error when the last column in CSV file
    is a Number field.
    Error Generated:
    ORA-01722: invalid number 12242, ,
    Praveen, Reddy, Chitti, Praveen Reddy Chitti, ,700,
    ORA-01722: invalid number 12242, ,
    Abhishek, C, Singh, Abhishek C Singh, ,700,
    ORA-01722: invalid number 12243, , Paul,
    K, Jak, Paul K Jak, ,700,
    15 ORA-01722: invalid number 12242, ,
    Praveen, Reddy, Chitti, Praveen Reddy Chitti, ,700,
    Expecting reply from u in this regard.
    Regards,
    Mahi
    Sample table Structure:
    CREATE TABLE EMPM(
    CMPCD NUMBER (10) NOT NULL,
    LCTCD NUMBER (10),
    EMPCD NUMBER (10) NOT NULL,
    REFNO VARCHAR2 (51),
    USRID NUMBER (10),
    PREFX VARCHAR2 (10),
    FNAME VARCHAR2 (51) NOT NULL,
    MNAME VARCHAR2 (51),
    LNAME VARCHAR2 (51) NOT NULL,
    FULNM VARCHAR2 (201) NOT NULL,
    EMPSX VARCHAR2 (1),
    SSNUM VARCHAR2 (16),
    NTLTY NUMBER (10),
    STSCD NUMBER (10),
    TCODE NUMBER (10),
    JDATE DATE,
    TDATE DATE,
    ACDOB DATE,
    ADATE DATE,
    DSGCD NUMBER (10),
    DPTCD NUMBER (10),
    MGRCD NUMBER (10),
    REFBY NUMBER (10),
    WPHON VARCHAR2 (25),
    MPHON VARCHAR2 (16),
    RPHON VARCHAR2 (16),
    PGRNO VARCHAR2 (16),
    WKFAX VARCHAR2 (16),
    RSFAX VARCHAR2 (16),
    WKEML VARCHAR2 (256),
    PEML1 VARCHAR2 (256),
    PRLN1 VARCHAR2 (256),
    PRLN2 VARCHAR2 (256),
    PRCCD VARCHAR2 (256),
    PRSCD NUMBER (10),
    PRSIN VARCHAR2 (51),
    PRCTR NUMBER (10),
    PRZIP VARCHAR2 (15),
    PMLN1 VARCHAR2 (256),
    PMLN2 VARCHAR2 (256),
    PMCCD VARCHAR2 (256),
    PMSCD NUMBER (10),
    PMSIN VARCHAR2 (51),
    PMCTR NUMBER (10),
    PMZIP VARCHAR2 (15),
    LOADN NUMBER (10),
    RESF1 VARCHAR2 (256),
    RESF2 VARCHAR2 (256),
    RESF3 VARCHAR2 (256),
    RESF4 VARCHAR2 (256),
    RESF5 VARCHAR2 (256),
    OWNER VARCHAR2 (4000),
    NOTES VARCHAR2 (401),
    DFLAG VARCHAR2 (10) DEFAULT '0' NOT NULL,
    MODBY NUMBER (10) NOT NULL,
    MODON DATE NOT NULL,
    PRIMARY KEY("CMPCD", "EMPCD"))

    we get the Following Error when the last column in CSV fileis a Number field.
    Clearly one or more records has a value in the last column that is non-numeric. Broadly speaking, a number consists of characters 0123456789, with optional minus sign and decimal point (scientific notation is also allowed). Just about anything else is not a number. 934-89 is not a number. 786.567.765 is not a number. A NULL should not throw ORA-1722 but spaces will.
    So, check your data. You find it necessary to employ an intermediary table and cleanse the data there. Alternatively, yell at the people who produce the extract. Or change your schema definition. Whatever's right.
    Cheers, APC

  • 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

Maybe you are looking for

  • Prevent multiple users from updating coherence cache data at the same time

    Hi, I have a web application which have a huge amount of data instead of storing the data in Http Session are storing it in coherence. Now multiple groups of users can use or update the same data in coherence. There are 100's of groups with several t

  • Loading (point) features takes MapViewer 20 times sql exec time?

    I have a map which contains only one theme which shows 14500 point geometries stored in a table (accessed via a view). Rendering the map takes a long time, more than 22 secs. Looking at the log from MapViewer it seems like the sql execution time is n

  • Problem while exporting ADF table to excel

    Hello, I have some columns of random size which are left padded with 0. now the problem comes when I export the table containing these columns to excel, excel remove all those zeros from left. eg: 000000003726819563(table column value) after exportin

  • Adobe Premiere Pro CC Crashing Upon Startup

    Hello, this is my first post on this forum and I am doing this because I have a reoccurring problem:      Whenever I start up Premiere Pro CC, it does one of two things: 1. Stops responding at the startup screen and I am forced to close it.  or  2. I

  • Withholing tax

    Hi experts, In my client site the users go to t.code F-43 for direct billing for the vendor. I am following the same process but the TDS tax codes in vendor master (at the time of payment) is attached.and I have to pay the vendor through Automatic Ou