Ora-01843 problem

My code is giving me ora-01843 problem. When i put startdate as 01-jan-05 and
enddate as 31-jan-05, it gives me error. Please help me guys.
--declare
--ntwk_var varchar2(100);
SELECT PHY.PHYNAM,
decode (NETWORKPROTOCOL.LCC, 'Y', '<Lombardi Cancer Center>', '') ||
decode (NETWORKPROTOCOL.UMH, 'Y', ' <Union Memorial Hospital>', '') ||
decode (NETWORKPROTOCOL.GSH, 'Y', '<Good Somaritan Hospital>', '') ||
decode (NETWORKPROTOCOL.FSH, 'Y', '<Franklin Square Hospital>', '') ||
decode (NETWORKPROTOCOL.WHC, 'Y', '<Washington Hospital Center>', '') ||
decode (NETWORKPROTOCOL.HH, 'Y', '<Harbor Hospital>', '') as NETWORKID,
PRTCRC.FULLNAME,
CRCMTG.CRMTGDT, CRCMTG.CRCSTAT, PRTCRC.SUBMITTEDTOIRB,
PRTCRC.RECEIVEDIRBRESULTDATE,
PRTCRC.PRT, prtcrc.crcid,
PRTCRC.REVIEWSTATUS,
CRCMTG.CRCOUTCOME,
PRTCRC.REVIEWTYPE,
PRTCRC.MODIFICATIONDATE, PRTCRC.FINALIRBAPPROVALDATE,
PRTCRC.ACTIVATIONDATE, RECENTREAPPROVALDATE.RECENTREAPPROVAL,
recentamendmentdate.amenddate,
PRTCRC.CLOSURETOPATIENTACCRUAL, PRTCRC.TERMINATIONDATE,
prttype.descrip
FROM CRCMTG, PRTCRC, NETWORKPROTOCOL, RECENTREAPPROVALDATE, PHY, prttype, recentamendmentdate
WHERE
((CRCMTG.PRTCRCID(+)=PRTCRC.ID) AND
(NETWORKPROTOCOL.PRTCRCID(+)=PRTCRC.ID) AND
(PRTCRC.PRINCIPALINVESTIGATOR=PHY.PHY(+))
AND (PRTCRC.ID=RECENTREAPPROVALDATE.PRTCRCID(+))
AND (PRTCRC.ID=recentamendmentdate.PRTCRCID(+))
) and
TO_DATE('01'||SUBSTR(LTRIM( NVL(PRTCRC.CRCID, TO_CHAR(sysdate, 'MMYYYY'))) , 1, 6), 'DDMMYYYY') >= :startdate
and
TO_DATE('01'||SUBSTR(LTRIM( NVL(PRTCRC.CRCID, TO_CHAR(sysdate, 'MMYYYY'))) , 1, 6), 'DDMMYYYY') <= :enddate
) and
prtcrc.type=prttype.id(+) and
fullname is not null
order by &SORT

as Andrew had mentioned you are trying to convert a numeric into date that might not be in date format. for example you had a value of 482334
SQL> select substr(ltrim('482334'),1,6)
  2    from dual;
SUBSTR
482334then you tried to convert it into date format
SQL> select to_date(substr(ltrim('482334'),1,6),'ddmmyyyy')
  2    from dual;
select to_date(substr(ltrim('482334'),1,6),'ddmmyyyy')
ERROR at line 1:
ORA-01847: day of month must be between 1 and last day of month
SQL> it will give you an error. what is the datatype for your column PRTCRC.CRCID?

Similar Messages

  • Oracle error "ORA-01843: not a valid month" when trying to run sqlldr

    Hi all,
    I'm trying to load some data into a staging database via a CSV file using sqlldr, and am running into an issue where it doesn't like the date format I'm using.
    Here is my input data:
    2012-01-09 16:28:12 -05:00Here is the entry in the .ctl file:
    created TIMESTAMP WITH TIME ZONE 'yyyy-mm-dd HH24:MI:SS TZR'And finally, here is the entry in the .sql file:
    created TIMESTAMP WITH TIME ZONEAfter I try to load, I get greeted with the dreaded error message: Record 1: Rejected - Error on table WTPART, column CREATED. ORA-01843: not a valid month
    I'm really confused as to why it's blowing up on the date, because it seems to me that "01" is indeed a valid date in terms of the date format I'm using. Any ideas? Thanks!
    Edited by: Nick Tiberi on Jan 10, 2012 8:06 AM

    Hmmm, not sure exactly what the problem is. It works fine for me on my XE instance.
    Set up the control and data files....
    tubby@Tubbz:~/test$ cat >> WTPart.csv <<EOF
    2012-01-09 16:28:12 -05:00
    EOF
    tubby@Tubbz:~/test$
    tubby@Tubbz:~/test$ cat >> load.ctl <<EOF
    LOAD DATA
    INFILE WTPart.csv
    APPEND INTO TABLE WTPart
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    created TIMESTAMP WITH TIME ZONE 'yyyy-mm-dd HH24:MI:SS TZR'
    EOF
    tubby@Tubbz:~/test$
    tubby@Tubbz:~/test$ /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlldr tubby/pswd@xe control=load.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Tue Jan 10 10:21:28 2012
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 1
    tubby@Tubbz:~/test$
    {code}
    Query the result from the database
    {code}
    ME_XE?select * from wtpart;
    CREATED
    09-JAN-12 04.28.12.000000 PM -05:00
    1 row selected.
    Elapsed: 00:00:00.01
    ME_XE?
    ME_XE?select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.01
    ME_XE?
    {code}
    Are you sure your CSV file doesn't have some "funky" data in it?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • ORA-01843: not a valid month

    Hi
    I get the following error message intermittently.
    ===> ORA-01843: not a valid month
    The problem is only intermittent! Which makes this more difficult to solve !
    Ideas please ?
    The piece of problematic ProC code is given below -
    ===
    if(nForUpdate)
    EXEC SQL SELECT * into :dbtbl:dbind FROM MYTABLE
    WHERE my_time = :dbtbl.my_time
    AND myf_id = :dbtbl.myf_id
    AND myl_id = :dbtbl.myl_id
    AND myw_id = :dbtbl.myw_id
    FOR UPDATE;
    else
    EXEC SQL SELECT * into :dbtbl:dbind FROM MYTABLE
    WHERE my_time = :dbtbl.my_time
    AND myf_id = :dbtbl.myf_id
    AND myl_id = :dbtbl.myl_id
    AND myw_id = :dbtbl.myw_id;
    Raja

    So what kind of error handling to you have in place to log the error messages and related diagnostic information?
    This error usually happens when we have a character variable holding dates as strings, with the inevitable corruption of invalid dates being amongst those strings.
    If you say it isn't data in the table and the input parameter :dbtbl.my_time always contains a date, then the only possible explanation is that Red Lectroids are corrupting your database with their alien 8th Dimension calendar....
    Cheers, APC

  • Ora-01843 when Form is based on procedure

    I create a page using form based on procedure option. I have a date picker item in the form that corresponds to a date parameter in the procedure.
    I select every date format APEX provided from APEX date picker and always got ora-01843(not a valid month) error when I tried to sumbit the form.
    I have changed PICK_DATE_FORMAT_MASK to DD/MM/YYYY at application level but cannot solve the problem.
    Does anyone using a "Form on Procedure" and happen to have a date column? Do you have similar problem?
    ps. this problem only occurs to "Form on Procedure". I have no problem with master details or many other form options. I am using APEX 3.1.

    Hello user3003555,
    I have created forms based on procedure and used date pickers on them but don't recall encountering the date format error ORA-1843. I used "Date Picker (DD-MON-YYYY)" which corresponds to my application date format. I'm not sure what else I can tell you. Have you tried picking a date where the month and day are interchangeable to confirm that it is a formatting issue?
    - Alwyn

  • Regarding ORA-12801,ORA-01843 error

    Hi all,
    When I am running the mapping I am getting the
    ORA-12801: error signaled in parallel query server P079
    ORA-01843: not a valid month error
    My mapping was validated and deployed suceesfully.
    Please give me the suggestions.
    Thanks,
    Venkat

    Is the source field a date field or a varchar? Sounds like you are hitting a source data error.
    Try grabbing the insert (or merge, or whatever) statement from the mapping and running it on its own. If that fails with the same error, then try running the select portion of the statement to debug for the error.
    Assuming that you are using a to_Date function and if you are having real trouble finding the data error, you at least know which table the field is being sourced from. Run a little test - something like:
    declare
      cursor curs is select the_source_field from the_source_table;
    begin
      for rec in curs loop
         declare
            dateval date
         begin
            dateval := to_Date(rec.the_source_field,'yyyymmdd');   --or whatever format mask it is you are using
         exception
             when others then
                 dbms_output.put_line('FAILED TO_DATE ON SOURCEVAL: '||rec.the_source_field||' with error: '||substr(sqlerrm,1,150));
         end;
      end loop;
    end;Once you know the problems with the data then you can consider how best to deal with them.
    Cheers,
    Mike

  • ORA-01843: not a valid month . Receive this error when running report in reporting services but not when running query in BIDS

    sql server 2008 r2
    RS2008 r2
    I can execute the query in BIDS 2008 with out a problem and I can run on our RS2005 server without a problem
    But when I deploy report and run on our RS2008 server I get the error
    An error has occurred during report processing. (rsProcessingAborted)
    Query execution failed for dataset 'NIR'. (rsErrorExecutingCommand)
    ORA-01843: not a valid month 
    QUERY:
    select * from NIR_QUARTERLY where birth_date between :PARAM1 and :PARAM2
    order by PT_CODE

    CAUSE
    The problem is caused by not using VALID dates values in the dataset.
    - This data problem was masked in the original version as the Predicate(s) used can change between versions of Oracle
    - Oracle does *not* guarantee the same explain plan or the specific order of predicates used between versions of Oracle
    Reviewing the  EXPLAIN PLAN for both versions revealed in this case:
    1) The table was partitioned
    2) The EXPLAIN PLANS were not the same due to how the partitions were accessed
    3) If the same query was used against a non-partitioned table using the same data, the following error would always occur
       ORA-01843: not a valid month
    4) The problem string value was in this case found to include the string value of  '0000-00-00'
      The ORA-01843 occurred when using the TO_DATE function against '0000-00-00'
    There is *no* Year= '0000' Month= '00' or day = '00' -- therefore the  ORA-01843: not a valid month
    --Prashanth

  • Query with error: ORA-01843: not a valid month

    Hi,
    I have a problem with a query. I have modified a query that before worked but not now!
    The correct original query was:
    SELECT  rtrim('Cambio di: '
            || (CASE WHEN nvl(A.CODICE_EMITTENTE ,' ') <> nvl(B.CODICE_EMITTENTE ,' ') THEN 'Codice emittente, ' ELSE '' END)
            || (CASE WHEN nvl(A.DESCRIZIONE_TITOLO,' ') <> nvl(B.DESCRIZIONE_TITOLO,' ') THEN 'Descrizione titolo, ' ELSE '' END)
            || (CASE WHEN nvl(A.SOTTOSTANTE,' ') <> nvl(B.SOTTOSTANTE,' ') THEN 'Sottostante, ' ELSE '' END)
            || (CASE WHEN nvl(A.TIPO_SOTTOSTANTE, ' ') <> nvl(B.TIPO_SOTTOSTANTE,' ') THEN 'Tipo sottostante, ' ELSE '' END)
            || (CASE WHEN nvl(A.CEDOLA_LORDA_CORRENTE, 0) <> nvl(B.CEDOLA_LORDA_CORRENTE, 0) THEN 'Cedola lorda corrente, ' ELSE '' END)
            || (CASE WHEN nvl(A.FREQUENZA_CEDOLA, ' ') <> nvl(B.FREQUENZA_CEDOLA, ' ') THEN 'Frequenza cedola, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') <> nvl(B.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') THEN 'Data inizio facoltà call, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') <> nvl(B.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') THEN 'Data fine facoltà call, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') <> nvl(B.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') THEN 'Data inizio facoltà put, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') <> nvl(B.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') THEN 'Data fine facoltà put, ' ELSE '' END)
            || (CASE WHEN nvl(A.AMMONTARE_EMESSO, 0) <> nvl(B.AMMONTARE_EMESSO, 0) THEN 'Ammontare emesso, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_PRIMO_GODIMENTO, '31-Dec-2999') <> nvl(B.DATA_PRIMO_GODIMENTO, '31-Dec-2999') THEN 'Data primo godimento, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_SCADENZA, '31-Dec-2999') <> nvl(B.DATA_SCADENZA, '31-Dec-2999') THEN 'Data scadenza, ' ELSE '' END)
            || (CASE WHEN nvl(A.PRIMO_PREZZO_EMISSIONE, 0) <> nvl(B.PRIMO_PREZZO_EMISSIONE, 0) THEN 'Primo prezzo di emissione, ' ELSE '' END)
            || (CASE WHEN nvl(A.MODALITA_RIMBORSO, 0) <> nvl(B.MODALITA_RIMBORSO, 0) THEN 'Modalità rimborso, ' ELSE '' END)
            || (CASE WHEN nvl(A.SUBORDINAZIONE, ' ') <> nvl(B.SUBORDINAZIONE, ' ') THEN 'Subordinazione, ' ELSE '' END)
            || (CASE WHEN nvl(A.DIV_EMIS_CODE, 0) <> nvl(B.DIV_EMIS_CODE, 0) THEN 'Codice divisa di emissione, ' ELSE '' END)
            || (CASE WHEN nvl(A.DIV_EMIS, ' ') <> nvl(B.DIV_EMIS, ' ') THEN 'Divisa di emissione, ' ELSE '' END)
            ,', ') TIPO_VARIAZIONE,
           A.ISICOD ,
           A.CODICE_EMITTENTE AS EMIT_COD_T, B.CODICE_EMITTENTE AS EMIT_COD_T1, 
           A.DESCRIZIONE_TITOLO AS DESC_TITOLO_T, B.DESCRIZIONE_TITOLO AS DESC_TITOLO_T1,
           A.SOTTOSTANTE AS SOTTOSTANTE_T, B.SOTTOSTANTE AS SOTTOSTANTE_T1,
           A.TIPO_SOTTOSTANTE AS TIPO_SOTTOSTANTE_T, B.TIPO_SOTTOSTANTE AS TIPO_SOTTOSTANTE_T1,
           A.CEDOLA_LORDA_CORRENTE AS CEDOLA_LORDA_CORRENTE_T, B.CEDOLA_LORDA_CORRENTE AS CEDOLA_LORDA_CORRENTE_T1,
           A.FREQUENZA_CEDOLA AS FREQUENZA_CEDOLA_T, B.FREQUENZA_CEDOLA AS FREQUENZA_CEDOLA_T1,
           A.DATA_INIZIO_FACOLTA_CALL AS DATA_INIZIO_FACOLTA_CALL_T, B.DATA_INIZIO_FACOLTA_CALL AS DATA_INIZIO_FACOLTA_CALL_T1,
           A.DATA_FINE_FACOLTA_CALL AS DATA_FINE_FACOLTA_CALL_T, B.DATA_FINE_FACOLTA_CALL AS DATA_FINE_FACOLTA_CALL_T1,
           A.DATA_INIZIO_FACOLTA_PUT AS DATA_INIZIO_FACOLTA_PUT_T, B.DATA_INIZIO_FACOLTA_PUT AS DATA_INIZIO_FACOLTA_PUT_T1,
           A.DATA_FINE_FACOLTA_PUT AS DATA_FINE_FACOLTA_PUT_T, B.DATA_FINE_FACOLTA_PUT AS DATA_FINE_FACOLTA_PUT_T1,
           A.AMMONTARE_EMESSO AS AMMONTARE_EMESSO_T, B.AMMONTARE_EMESSO AS AMMONTARE_EMESSO_T1,
           A.DATA_PRIMO_GODIMENTO AS DATA_PRIMO_GODIMENTO_T,  B.DATA_PRIMO_GODIMENTO AS DATA_PRIMO_GODIMENTO_T1,
           A.DATA_SCADENZA AS DATA_SCADENZA_T, B.DATA_SCADENZA AS DATA_SCADENZA_T1,
           A.PRIMO_PREZZO_EMISSIONE AS PRIMO_PREZZO_EMISSIONE_T, B.PRIMO_PREZZO_EMISSIONE AS PRIMO_PREZZO_EMISSIONE_T1,
           A.MODALITA_RIMBORSO AS MODALITA_RIMBORSO_T, B.MODALITA_RIMBORSO AS MODALITA_RIMBORSO_T1,
           A.SUBORDINAZIONE AS SUBORDINAZIONE_T, B.SUBORDINAZIONE AS SUBORDINAZIONE_T1,
           A.DIV_EMIS_CODE AS DIV_EMIS_CODE_T, B.DIV_EMIS_CODE AS DIV_EMIS_CODE_T1,
           A.DIV_EMIS AS DIV_EMIS_T, B.DIV_EMIS AS DIV_EMIS_T1,
           A.START_DATE AS DATA_AGG_T, B.START_DATE AS DATA_AGG_T1
    FROM SPR_KLERS_ISD A, SPR_KLERS_ISD B
    WHERE A.START_DATE=TRUNC(SYSDATE)
          AND A.ISICOD=B.ISICOD
          AND B.START_DATE = decode(trim(to_char(sysdate, 'Day')), 'Monday',trunc(sysdate-3), trunc(sysdate-1))
          AND (nvl(A.CODICE_EMITTENTE,' ') != nvl(B.CODICE_EMITTENTE,' ')
            OR
            nvl(A.DESCRIZIONE_TITOLO,' ') != nvl(B.DESCRIZIONE_TITOLO,' ')
            OR
            nvl(A.SOTTOSTANTE,' ') != nvl(B.SOTTOSTANTE,' ')
            OR
            nvl(A.TIPO_SOTTOSTANTE, ' ') != nvl(B.TIPO_SOTTOSTANTE,' ')
            OR
            nvl(A.CEDOLA_LORDA_CORRENTE, 0) != nvl(B.CEDOLA_LORDA_CORRENTE, 0)
            OR
            nvl(A.FREQUENZA_CEDOLA, ' ') != nvl(B.FREQUENZA_CEDOLA, ' ')
            OR
            nvl(A.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') != nvl(B.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999')
            OR
            nvl(A.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') != nvl(B.DATA_FINE_FACOLTA_CALL, '31-Dec-2999')
            OR
            nvl(A.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') != nvl(B.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999')
            OR
            nvl(A.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') != nvl(B.DATA_FINE_FACOLTA_PUT,'31-Dec-2999')
            OR
            nvl(A.AMMONTARE_EMESSO, 0) != nvl(B.AMMONTARE_EMESSO, 0)
            OR
            nvl(A.DATA_PRIMO_GODIMENTO, '31-Dec-2999') != nvl(B.DATA_PRIMO_GODIMENTO, '31-Dec-2999')
            OR
            nvl(A.DATA_SCADENZA, '31-Dec-2999') != nvl(B.DATA_SCADENZA, '31-Dec-2999')
            OR
            nvl(A.PRIMO_PREZZO_EMISSIONE, 0) != nvl(B.PRIMO_PREZZO_EMISSIONE, 0)
            OR
            nvl(A.MODALITA_RIMBORSO, 0) != nvl(B.MODALITA_RIMBORSO, 0)
            OR
            nvl(A.SUBORDINAZIONE, ' ') != nvl(B.SUBORDINAZIONE, ' ')
            OR
            nvl(A.DIV_EMIS_CODE, 0) != nvl(B.DIV_EMIS_CODE, 0)
            OR
            nvl(A.DIV_EMIS, ' ') != nvl(B.DIV_EMIS, ' '))The new query that not works is:
    SELECT  rtrim('Cambio di: '
            || (CASE WHEN nvl(A.CODICE_EMITTENTE ,' ') <> nvl(B.CODICE_EMITTENTE ,' ') THEN 'Codice emittente, ' ELSE '' END)
            || (CASE WHEN nvl(A.DESCRIZIONE_TITOLO,' ') <> nvl(B.DESCRIZIONE_TITOLO,' ') THEN 'Descrizione titolo, ' ELSE '' END)
            || (CASE WHEN nvl(A.SOTTOSTANTE,' ') <> nvl(B.SOTTOSTANTE,' ') THEN 'Sottostante, ' ELSE '' END)
            || (CASE WHEN nvl(A.TIPO_SOTTOSTANTE, ' ') <> nvl(B.TIPO_SOTTOSTANTE,' ') THEN 'Tipo sottostante, ' ELSE '' END)
            || (CASE WHEN nvl(A.CEDOLA_LORDA_CORRENTE, 0) <> nvl(B.CEDOLA_LORDA_CORRENTE, 0) THEN 'Cedola lorda corrente, ' ELSE '' END)
            || (CASE WHEN nvl(A.FREQUENZA_CEDOLA, ' ') <> nvl(B.FREQUENZA_CEDOLA, ' ') THEN 'Frequenza cedola, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') <> nvl(B.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') THEN 'Data inizio facoltà call, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') <> nvl(B.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') THEN 'Data fine facoltà call, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') <> nvl(B.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') THEN 'Data inizio facoltà put, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') <> nvl(B.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') THEN 'Data fine facoltà put, ' ELSE '' END)
            || (CASE WHEN nvl(A.AMMONTARE_EMESSO, 0) <> nvl(B.AMMONTARE_EMESSO, 0) THEN 'Ammontare emesso, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_PRIMO_GODIMENTO, '31-Dec-2999') <> nvl(B.DATA_PRIMO_GODIMENTO, '31-Dec-2999') THEN 'Data primo godimento, ' ELSE '' END)
            || (CASE WHEN nvl(A.DATA_SCADENZA, '31-Dec-2999') <> nvl(B.DATA_SCADENZA, '31-Dec-2999') THEN 'Data scadenza, ' ELSE '' END)
            || (CASE WHEN nvl(A.PRIMO_PREZZO_EMISSIONE, 0) <> nvl(B.PRIMO_PREZZO_EMISSIONE, 0) THEN 'Primo prezzo di emissione, ' ELSE '' END)
            || (CASE WHEN nvl(A.MODALITA_RIMBORSO, 0) <> nvl(B.MODALITA_RIMBORSO, 0) THEN 'Modalità rimborso, ' ELSE '' END)
            || (CASE WHEN nvl(A.SUBORDINAZIONE, ' ') <> nvl(B.SUBORDINAZIONE, ' ') THEN 'Subordinazione, ' ELSE '' END)
            || (CASE WHEN nvl(A.DIV_EMIS_CODE, 0) <> nvl(B.DIV_EMIS_CODE, 0) THEN 'Codice divisa di emissione, ' ELSE '' END)
            || (CASE WHEN nvl(A.DIV_EMIS, ' ') <> nvl(B.DIV_EMIS, ' ') THEN 'Divisa di emissione, ' ELSE '' END)
            ,', ') TIPO_VARIAZIONE,
           A.ISICOD ,
           A.CODICE_EMITTENTE AS EMIT_COD_T, B.CODICE_EMITTENTE AS EMIT_COD_T1, 
           A.DESCRIZIONE_TITOLO AS DESC_TITOLO_T, B.DESCRIZIONE_TITOLO AS DESC_TITOLO_T1,
           A.SOTTOSTANTE AS SOTTOSTANTE_T, B.SOTTOSTANTE AS SOTTOSTANTE_T1,
           A.TIPO_SOTTOSTANTE AS TIPO_SOTTOSTANTE_T, B.TIPO_SOTTOSTANTE AS TIPO_SOTTOSTANTE_T1,
           A.CEDOLA_LORDA_CORRENTE AS CEDOLA_LORDA_CORRENTE_T, B.CEDOLA_LORDA_CORRENTE AS CEDOLA_LORDA_CORRENTE_T1,
           A.FREQUENZA_CEDOLA AS FREQUENZA_CEDOLA_T, B.FREQUENZA_CEDOLA AS FREQUENZA_CEDOLA_T1,
           A.DATA_INIZIO_FACOLTA_CALL AS DATA_INIZIO_FACOLTA_CALL_T, B.DATA_INIZIO_FACOLTA_CALL AS DATA_INIZIO_FACOLTA_CALL_T1,
           A.DATA_FINE_FACOLTA_CALL AS DATA_FINE_FACOLTA_CALL_T, B.DATA_FINE_FACOLTA_CALL AS DATA_FINE_FACOLTA_CALL_T1,
           A.DATA_INIZIO_FACOLTA_PUT AS DATA_INIZIO_FACOLTA_PUT_T, B.DATA_INIZIO_FACOLTA_PUT AS DATA_INIZIO_FACOLTA_PUT_T1,
           A.DATA_FINE_FACOLTA_PUT AS DATA_FINE_FACOLTA_PUT_T, B.DATA_FINE_FACOLTA_PUT AS DATA_FINE_FACOLTA_PUT_T1,
           A.AMMONTARE_EMESSO AS AMMONTARE_EMESSO_T, B.AMMONTARE_EMESSO AS AMMONTARE_EMESSO_T1,
           A.DATA_PRIMO_GODIMENTO AS DATA_PRIMO_GODIMENTO_T,  B.DATA_PRIMO_GODIMENTO AS DATA_PRIMO_GODIMENTO_T1,
           A.DATA_SCADENZA AS DATA_SCADENZA_T, B.DATA_SCADENZA AS DATA_SCADENZA_T1,
           A.PRIMO_PREZZO_EMISSIONE AS PRIMO_PREZZO_EMISSIONE_T, B.PRIMO_PREZZO_EMISSIONE AS PRIMO_PREZZO_EMISSIONE_T1,
           A.MODALITA_RIMBORSO AS MODALITA_RIMBORSO_T, B.MODALITA_RIMBORSO AS MODALITA_RIMBORSO_T1,
           A.SUBORDINAZIONE AS SUBORDINAZIONE_T, B.SUBORDINAZIONE AS SUBORDINAZIONE_T1,
           A.DIV_EMIS_CODE AS DIV_EMIS_CODE_T, B.DIV_EMIS_CODE AS DIV_EMIS_CODE_T1,
           A.DIV_EMIS AS DIV_EMIS_T, B.DIV_EMIS AS DIV_EMIS_T1,
           A.START_DATE AS DATA_AGG_T, B.START_DATE AS DATA_AGG_T1
    FROM SPR_KLERS_ISD A, SPR_KLERS_ISD B
    WHERE A.START_DATE=TRUNC(SYSDATE)
          AND A.ISICOD=B.ISICOD
          AND B.END_DATE = TRUNC(SYSDATE)
          AND (nvl(A.CODICE_EMITTENTE,' ') != nvl(B.CODICE_EMITTENTE,' ')
            OR
            nvl(A.DESCRIZIONE_TITOLO,' ') != nvl(B.DESCRIZIONE_TITOLO,' ')
            OR
            nvl(A.SOTTOSTANTE,' ') != nvl(B.SOTTOSTANTE,' ')
            OR
            nvl(A.TIPO_SOTTOSTANTE, ' ') != nvl(B.TIPO_SOTTOSTANTE,' ')
            OR
            nvl(A.CEDOLA_LORDA_CORRENTE, 0) != nvl(B.CEDOLA_LORDA_CORRENTE, 0)
            OR
            nvl(A.FREQUENZA_CEDOLA, ' ') != nvl(B.FREQUENZA_CEDOLA, ' ')
            OR
            nvl(A.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') != nvl(B.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999')
            OR
            nvl(A.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') != nvl(B.DATA_FINE_FACOLTA_CALL, '31-Dec-2999')
            OR
            nvl(A.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') != nvl(B.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999')
            OR
            nvl(A.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') != nvl(B.DATA_FINE_FACOLTA_PUT,'31-Dec-2999')
            OR
            nvl(A.AMMONTARE_EMESSO, 0) != nvl(B.AMMONTARE_EMESSO, 0)
            OR
            nvl(A.DATA_PRIMO_GODIMENTO, '31-Dec-2999') != nvl(B.DATA_PRIMO_GODIMENTO, '31-Dec-2999')
            OR
            nvl(A.DATA_SCADENZA, '31-Dec-2999') != nvl(B.DATA_SCADENZA, '31-Dec-2999')
            OR
            nvl(A.PRIMO_PREZZO_EMISSIONE, 0) != nvl(B.PRIMO_PREZZO_EMISSIONE, 0)
            OR
            nvl(A.MODALITA_RIMBORSO, 0) != nvl(B.MODALITA_RIMBORSO, 0)
            OR
            nvl(A.SUBORDINAZIONE, ' ') != nvl(B.SUBORDINAZIONE, ' ')
            OR
            nvl(A.DIV_EMIS_CODE, 0) != nvl(B.DIV_EMIS_CODE, 0)
            OR
            nvl(A.DIV_EMIS, ' ') != nvl(B.DIV_EMIS, ' '))where I have changed only this:
    B.START_DATE = decode(trim(to_char(sysdate, 'Day')), 'Monday',trunc(sysdate-3), trunc(sysdate-1)) --------->AND B.END_DATE = TRUNC(SYSDATE)
    Both START_DATE and END_DATE are date filds.
    When I execute the second query I receive this:
    ORA-01843: not a valid monthin many ponts of the query that change every time I execute the query, why this behaviour?
    How can I solve?
    Thanks, bye bye.

    Could you execute the following query and post the output.
    select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
    select sysdate from dual;Also what are the datatypes for these columns
    >
    nvl(A.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999') != nvl(B.DATA_INIZIO_FACOLTA_CALL, '31-Dec-2999')
    OR
    nvl(A.DATA_FINE_FACOLTA_CALL, '31-Dec-2999') != nvl(B.DATA_FINE_FACOLTA_CALL, '31-Dec-2999')
    OR
    nvl(A.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999') != nvl(B.DATA_INIZIO_FACOLTA_PUT,'31-Dec-2999')
    OR
    nvl(A.DATA_FINE_FACOLTA_PUT,'31-Dec-2999') != nvl(B.DATA_FINE_FACOLTA_PUT,'31-Dec-2999')
    OR
    nvl(A.AMMONTARE_EMESSO, 0) != nvl(B.AMMONTARE_EMESSO, 0)
    OR
    nvl(A.DATA_PRIMO_GODIMENTO, '31-Dec-2999') != nvl(B.DATA_PRIMO_GODIMENTO, '31-Dec-2999')
    OR
    nvl(A.DATA_SCADENZA, '31-Dec-2999') != nvl(B.DATA_SCADENZA, '31-Dec-2999')
    >
    I hope you know anything given in single quotes is a string and not a date.
    Regards
    Raj

  • Date error ORA-01843: not a valid month

    Hi,
    I am in a 4.01 Apex environment with NLS_DATE_FORMAT     mm/dd/yyyy. I created a view with a CASE statements using 'when eventstartdate between '08/15/2010' and '06/1/2011' then...' clauses and the view is created fine. I also can query the view with no problem with SQL workshop and the CASE statements work as expected. When I create an interactive report on that view I keep getting ORA-01843: not a valid month. I even tried matching the format in the Interactive Report column format mask to the NLS format for the date and still get error.
    What seems especially strange to me is that even if I have the view column defined with a 'to_char' I still get the same error when I use the CASE statement to build the view. Doesn't the Interactive Report just 'see' the View column definitions-- why should it 'care' how the view was built?
    The only way I can get the View to work with an Interactive report in any manner is to remove all the CASE statements and define the 'eventstartdate' as text using to_char but that then eliminates my ability to do any filters that require date comparisons with between or '>', '<'.
    Help would be appreciated!
    Thanks,
    Pat

    Quick late night response - always convert your dates for comparison. Apples to apples
    Instead of between '01/31/2012', use either
    TO_DATE('01/31/2012', 'MM/DD/YYYY')or
    DATE '2012-01-31'More related info
    http://www.grassroots-oracle.com/2011/03/date-format-tolerance.html
    Sorry if I'm off target, thought it may help

  • ORA-01843:This is not a valid month error

    One of our french customer using Oracle 11g R2 on RHEL is getting following error while running a stored procedure:
    ORA-01843: ce n'est pas un mois valide
    20120123::05:41:10 ended rebuilding cmroll table
    The error reported by ORACLE, in French « ce n'est pas un mois valide », means : « This is not a valid month ».I have asked him to verify the following settings on his machine:
    Please run the following query on Oracle Server to get the NLS settings. It specifies the settings both on Oracle client and Server.
    select * from nls_database_parameters;
    select * from nls_instance_parameters;
    However, you can override this setting by specifying the following environment variables in client or server. So kindly verify them  on both as well:
    1.     NLS_LANG
    2.     NLS_LANGUAGE
    3.     NLS_TERRITORYIs there anything further that can help me to trace this error?

    Moazzam wrote:
    ORA-01843: ce n'est pas un mois valide
    Is there anything further that can help me to trace this error?ORA-01843 Sounds a LOT more interesting in French :)
    I have to agree with the others that there is a problem with the code somewhere - again, the implicit conversion sounds promising. Or possibly a language issue (hopefully not)
    You should be getting a line number where the error is occurring. This can sometimes be deceptive; we use a WHEN-OTHERS exception handler but mark the code with a location marker throughout so we can look up errors and their locations in an exceptions table - in other words, the line cited in the error message may/may not be where the error happened. 11g sometimes reports errors on block headers too. There are other ways of finding the line the error is occurring on too, including just looking at the code (which is usually harder). Start by finding the line the error is occurring at.
    The "brute force" approach (if possible find an easier way) is to either use the debugger in a GUI tool or use DBMS_OUTPUT.PUT_LINE to trace your way through executions.
    When you find out where the error is occurring you can use DBMS_OUTPUT.PUT_LINE to display the value, find out what it is, and figure out what is causing the error, and fix it.
    Edited by: riedelme on Mar 13, 2012 7:11 AM

  • INSERT INTO EMP VALUES (7698, 'BLAKE', 'MANAGER',  ORA-01843: not a valid m

    One problem occured creating tables from old demobld.script:
    all inserts where accepted, but this one:
    INSERT INTO EMP VALUES
    (7698, 'BLAKE', 'MANAGER', 7839,
    TO_DATE('1-MAY-1981', 'DD-MON-YYYY'), 2850, NULL, 30);
    COMMIT;
    Changing the month into FEB helped.
    Bug?
    ORACLEXE running on Windows XP Home Edition.
    No problems with installing.
    Cheers,
    Huub.

    OK - I'm guessing that your OS uses Dutch language and locale settings and you did not ichange these settings when you installed XE. <g>
    On my XE system, I did the following:
    SQL> connect hr/hr
    Connected.
    SQL> alter session set nls_date_language='DUTCH'
    2 /
    Session altered.
    SQL> select to_date('1-MAR-1981','DD-MON-YYYY') from dual;
    select to_date('1-MAR-1981','DD-MON-YYYY') from dual
    ERROR at line 1:
    ORA-01843: not a valid month
    SQL> select to_date('1-OCT-1981','DD-MON-YYYY') from dual;
    select to_date('1-OCT-1981','DD-MON-YYYY') from dual
    ERROR at line 1:
    ORA-01843: not a valid month
    SQL> select to_date('1-OKT-1981','DD-MON-YYYY') from dual;
    TO_DATE('1-OKT-198
    01-OKT-81
    SQL> alter session set nls_date_language='ENGLISH';
    Session altered.
    SQL> select to_date('1-MAR-1981','DD-MON-YYYY') from dual;
    TO_DATE('1-MAR-198
    01-MAR-81
    SQL>
    So - I guess you want to change the NLS_DATE_LANGUAGE (or other NLS setting) to English when you want to load english month format.

  • Unable to compare date "ORA-01843: not a valid month"

    Hello All,
    I am trying to fire below query but it is failing with error. Please suggest.
    SELECT column_name FROM table_name WHERE start_time < '01/01/2011 00:00:00 AM';
    ORA-01843: not a valid month
    In table the start_time is stored in 2/16/2013 8:31:01 PM format.
    Regards,
    Ankit
    Edited by: 982193 on Mar 11, 2013 6:32 AM

    Hi, Ankit,
    982193 wrote:
    Hello All,
    I am trying to fire below query but it is failing with error. Please suggest.Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    SELECT column_name FROM table_name WHERE start_time < '01/01/2011 00:00:00 AM';Use \ tags, as explained in the forum FAQ, so that this site won't garble your messages so much.
    ORA-01843: not a valid month
    In table the start_time is stored in 2/16/2013 8:31:01 PM format. If start_time is a DATE (or a TIMESTAMP) then it is not stored in that format, or any other format you would recognize.  Regardless of what the format is, don't try to compare a DATE with a VARCHAR2, such as '01/01/2011 00:00:00 AM'.  Use TO_DATE to convert the VARCHAR2 to a DATE.  For exampleWHERE start_time < TO_DATE ( '01/01/2011 12:00:00 AM'
                   , 'MM/DD/YYYY HH:MI:SS AM'
    If you're using AM in a time, then 0 is not a possible hour.  The hours are 12, 1, 2, ..., 11 when using AM or PM.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Edit Userpreferences getting ORA-01843 not a valid month

    Does anyone know what is wrong when editing a APEX User and getting the "ORA-01843 not a valid month".

    Hi
    I had the same problem. I've changed my language from English to German. Then I tried it again and I could change the permissions of a user. Then I have the language of my workspaces set back to English and I could change all user rights. I hope my answer helps you.
    Best regards

  • ORA-01843 from Crystal

    Hello ,
    I have sql query that im try to run from crystal report.
    In the query im using function that handel with dates
    (there are no dates in the query just calling the function that have dates handling).
    when im running it from apache on windows 2000 i got
    "ORA-01843" . The apache computer are in italy , and its seems that the problem is with ojdbc14 . the query run good on plsql developer and also run ok on local apache server.
    How can i fix it?
    Many Thanks

    909825 wrote:
    Hello...
    I have a field with data type datetime and format mask as HH24:MI in the form. Now i want to fetch the only time from the table having the column with data type as timestamp into the field.
    For eg:
    My field is worktime (datetime) and my column in the table is working_dt1 (timestamp).
    i tried following query
    substr(to_char(working_dt1,'DD-MM-YY HH24:MI'),10,15);
    but got error ora-01843.....
    could you please help me out.
    Thank you.try this..
    to_date(to_char(working_dt1,'DD-MM-YY HH24:MI'),'DD-MM-YY HH24:MI')Hope this will help you
    If someone's response is helpful or correct, please mark it accordingly.

  • Not valid month Error Ora 01843

    hi
    This is an error while running a report 6i. in Oracle 8i Environment.
    "Not valid month Error Ora 01843"
    This report is working fine in Production. But it is not working in Development Database.
    Development database is the image of Production system.
    Any reason for this Error?

    Dear Naseer C ,
    We got similar experiences for several time.
    We quried like that.
    Selet moth from table;
    08-AUG-1988
    08-08-1988
    08-08-88
    We changed several time until diappear the message.
    Hopefully, it will help you.
    Best regards,
    S!G

  • [PL/SQL Error] ORA-01843: not a valid month, not sure how to troubleshoot

    Trying to use PL/SQL to automatically create a report that show the following:
    Daily:      
    # of Registered Users      
    # of Completes (assessment)      Average per User
    # of Starts (assessment)      Average per User
    Weekly:      
    # of Registered Users      
    # of Completes (assessment)      Average per User
    # of Starts (assessment)      Average per User
    Yearly:      
    # of Registered Users      
    # of Completes (assessment)      Average per User
    # of Starts (assessment)      Average per User
    When I run the PL/SQL I get the following
    [error]
    ORA-01843: not a valid month
    [error]
    The error occurs on this part of the PL/SQL
    --registered users weekly starts
    select count(*), trunc(next_day(sysdate-29, 'SUNDAY')-7), trunc(sysdate-29)
         into v_weekly_count_total_ru, v_weekly_start_date, v_weekly_end_date
              from entities
                   where list_id = 3290
                   and participation_code_id = 10
                   and trunc(participation_date)
                   between trunc(next_day(sysdate-29, 'SUNDAY')-7) and                         
                            trunc(sysdate-29);I'm using the number 29 because I'm using a test database to test this first before moving it into production. And my test data only goes back to early August 2006.
    Also, I'm not doing anything with months, so I am suprised that it is throwing this type of error.
    thanks

    I tested a snippet of code in my production environment, just to see if I would get any results:
    --registered users weekly starts
    select count(*), trunc(next_day(sysdate-1, 'SUNDAY')-7), trunc(sysdate-1)
         --into v_weekly_count_total_ru, v_weekly_start_date, v_weekly_end_date
              from entities
                   where list_id = 3290
                   and participation_code_id = 10
                   and trunc(participation_date)
                   between trunc(next_day(sysdate-1, 'SUNDAY')-7) and trunc(sysdate-1);
    COUNT(*)     TRUNC(NEXT_DAY(SYSDATE-1,'SUND     TRUNC(SYSDATE-1)--INTOV_WEEKLY
    1     09/10/2006 00:00:00     09/11/2006 00:00:00I did a double check in my test DB to make sure there is data there:
    select count(*)
         from entities
              where trunc(participation_date)
              between to_date('01-08-2006','DD-MM-YYYY')
              and to_date('14-08-2006','DD-MM-YYYY')
              and list_id = 3290;
    COUNT(*)
    11So I'm pretty sure that I'm not pulling anything null.
    thanks

Maybe you are looking for