Invalid month

When i run the following query why am i getting the error message :
ORA-01843: not a valid month
SELECT calc_type,
cnt,
     days,
     contract_number,
NTPACT,
     SELECTION_DATE,     
     to_char(ntpact,'yy"Q"q') quarter
FROM
(SELECT DISTINCT ' On-Call Unit Price' calc_type,
COUNT (CONTRACT_NUMBER) OVER (PARTITION BY contract_number ORDER BY contract_number) cnt,
     TRUNC (ntpact - selection_date) days,
     contract_number,
ntpact,
          SELECTION_DATE          
     FROM contract_vw2
     WHERE SELECTION_DATE BETWEEN ('1/1/2008') AND ('4/1/2008')
          AND contract_type = 'On Call'
     AND contract_comp_method = 'Unit Price'
     AND amend_status_code NOT IN (4, 33, 34, 35, 36, 37)
AND AMENDMENT_NUMBER=0)
          WHERE cnt=1
thnks

> WHERE SELECTION_DATE BETWEEN ('1/1/2008') AND ('4/1/2008')
You are implicitly converting a text string to a date. Oracle does not know what format you have specified. Is it yyyy/mm/dd, or dd-mon-yy, or mm/dd/yyyy or something else?
So Oracle uses the (standard/default) NLS_DATE_FORMAT setting (for that Oracle session) to convert the string into a date. Only the string you have specified does not match this format.
Moral of the story: Do NOT use implicit data type conversions as this can bite you badly in the butt, on the back, in the arm, ankle and for good measure chew on your ears too.
Use EXPLICIT conversions. Use data type conversion functions like TO_DATE. TO_NUMBER, TO_CHAR and so on, where applicable.

Similar Messages

  • Flat file to Oracle Database - Invalid Month

    Hi All
    I am New to XI and trying to create a simple interface between Legacy system (flat file) and Oracle database.
    I have some date fields in the Oracle table.
    When i run the interface it says "invalid month" with some SQL exception number.
    I am using (mm/dd/yyyy) format for the date.
    Is there any conversion i need to do. I am using XML SQL format for Oracle database.
    Any help is appreciated.
    Thanks
    Nagakishore

    Hello,
    Oracle is very picky with the way date is stored. Assume that you have a field datefield that you need to save. In mapping add an attribute hasqQuote and set it to "NO". When mapping the value to the node use to_date as shown below.
    <DateField hasQuot="No">
       TO_DATE("2004-07-20", "yyyy-mm-dd hh:mi:ss")</DateField>
    cheers,
    Naveen

  • Invalid month error sometimes in SQL Developer

    Hi
    sometimes I get 'Invalid Month error' in SQL developer when I execute the following query
    select TRUNC(TO_DATE('01-JUN-2013','DD-MON-YYYY')) from dual;
    But when I dosconnect session and reconnect, It works fine
    Any suggestions on how to avoid this issue ?
    Thanks

    872202 wrote:
    Hi
    sometimes I get 'Invalid Month error' in SQL developer when I execute the following query
    select TRUNC(TO_DATE('01-JUN-2013','DD-MON-YYYY')) from dual;
    But when I dosconnect session and reconnect, It works fine
    Any suggestions on how to avoid this issue ?
    ThanksThere's absolutely no reason that that should result in that error.
    The SQL is sent to the database and it's perfectly valid SQL, taking a string, and converting it to a date with the correct date format mask, and then truncating the date (which, by default is to the day, which in this case is pointless as it's already truncated), returning a DATE datatype, which SQL Developer will then render using it's date display format.

  • Given query giving an error -invalid month????

    select to_date(add_months(trunc(sysdate),-5) ||' 10:30:00 AM','mm/dd/yyyy hh:mi:ss am') from dual
    giving an error-invalid month..

    1. Instead of comma you have put dot.
    2. Below is teh correct usage
    select to_date(to_char(add_months(trunc(sysdate),-5),'DD/MM/YYYY')||' 10:30:00 AM','DD/MM/YYYY HH:MI:SS AM')
    from dual3. But, why are you going for this when there is a straight forward way?

  • Strange invalid month error.

    Hi all,
    I have a function which receives a date and then returns a text string saying what day of the week it is, ie Monday Tuesday etc etc
    For example sakes I'll say the function is called dayoftheweek and we use the function like 'select somedate, dayoftheweek(somedate) from dual'
    Now, the bit within the function that works out the day is as below
    SELECT TO_CHAR(TO_DATE(p_date, 'DD/MM/RRRR') ,'DAY') from dual (p_date is the internal function variable for the date passed in.)
    Now, if I do this
    select dayoftheweek('25-MAY-09') from dual -- this works.
    But...
    select dayoftheweek('25/05/09') from dual -- this does not work, I get an ora 01843 invalid month error.
    So, I assumed it was something to do with the logic that worked out the day of the week.
    However, the below works.
    SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR') ,'DAY') from dual
    Does anyone know why when passing a date to the function in format 'select dayoftheweek('25/05/09') from dual' does not work but if I use this format within the function logic as above it does work?
    Cheers,
    rg

    Hello,
    Oracle does not know your date format:
    select dayoftheweek('25/05/09')I.e, it does not know that the date you are passing in is in the form of 'DD/MM/MM'. You must tell it (since it isn't your default format):
    select dayoftheweek(to_date('25/05/09', 'DD/MM/YY'))If all you wanted, however, was the day of the week from a date, then:
    TO_CHAR(to_date('25/05/09', 'DD/MM/YY'), 'DAY')Will give you that.
    And by the way, this:
    SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR') ,'DAY') from dualIs correct by chance, even though you're getting no error you may get the wrong result, because you're telling oracle you're passing in 4 digits for the year, yet you're only passing in two.
    Edit Beware:
    SQL> SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR'), 'YYYY') from dual;
    TO_C
    2009
    SQL> SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/YYYY'), 'YYYY') from dual;
    TO_C
    0009

  • Invalid month error in WEBI report level

    Hi,
    I had a issue with date format.I am using oracle10g as a backend database.I have a  date object in universe level i used that object in web intelligence report level.I created prompt for date object after select the date from the list i  am getting " invalid month error". In database level object datatype is timestamp.
    How to solve this issue.can somebody help me to solve the problem.

    Hi
    Date  Objects depends on various formats for different database
    Make sure that u format date like MM/dd/yyyy in universe level . and the object should be in date datatype .
    In the query level use prompt to select dates.
    In report level
    create a variable and use a formula like
    todate(userresponse("Enter date");"")
    Hope this helps U
    Sunil

  • INVALID MONTH ERROR

    I have seen a thread on this topic. But my issue is a bit different.
    I have a table (suppose A) with a date column (let b B)
    There is a view on this table say A_V. This view simply queries the table A.
    I have another table C, to which I am inserting record from A_V in a for loop like
    FOR i IN (SELECT * FROM A_V)
    LOOP
    INSERT INTO C(x,y,B)
    VALUES( i.x,i.y,nvl(i.B,sysdate) );
    END LOOP;
    I found invalid month issue in it. I am not sure of the reason. However, do I need apply to_char on i.B or nvl(i.B,sysdate) to give it a specific format. And if so, how would I know what format I should apply.
    I was also doing some test plsql developer and found result like this. Can anyone help me understand.
    select id,nvl(to_char(DATE_DATA,'dd/MM/yyyy'),to_date('19000101','YYYYMMDD')) from DATA_DUMP
    where DATE_DATA is null
    result is
    1 361725 01-JAN-00
    2 800001 01-JAN-00
    3 800002 01-JAN-00
    4 420068 01-JAN-00
    5 442682 01-JAN-00
    6 442984 01-JAN-00
    7 442340 01-JAN-00
    select id,nvl(DATE_DATA,to_date('19000101','YYYYMMDD')) from DATA_DUMP
    where DATE_DATA is null
    1 361725 1/1/1900
    2 800001 1/1/1900
    3 800002 1/1/1900
    4 420068 1/1/1900
    5 442682 1/1/1900
    6 442984 1/1/1900
    7 442340 1/1/1900
    I get similar result with DATA_DATA not null too.
    -Deb

    p.s. you also don't need to do your insert as single inserts within a cursor loop as this will give you poor performance. It should be done as a single insert... select... statement.
    e.g.
    SQL> select * from a;
         EMPNO     DEPTNO B
          7369         20 17/12/1980 00:00:00
          7499         30 20/02/1981 00:00:00
          7521         30 22/02/1981 00:00:00
          7566         20 02/04/1981 00:00:00
          7654         30 28/09/1981 00:00:00
          7698         30 01/05/1981 00:00:00
          7782         10 09/06/1981 00:00:00
          7788         20
          7839         10 17/11/1981 00:00:00
          7844         30 08/09/1981 00:00:00
          7876         20
          7900         30 03/12/1981 00:00:00
          7902         20 03/12/1981 00:00:00
          7934         10 23/01/1982 00:00:00
    14 rows selected.
    SQL> create table c (empno number, deptno number, b date);
    Table created.
    SQL> insert into c
      2  select empno, deptno, nvl(b,sysdate)
      3  from a;
    14 rows created.
    SQL> select * from c;
         EMPNO     DEPTNO B
          7369         20 17/12/1980 00:00:00
          7499         30 20/02/1981 00:00:00
          7521         30 22/02/1981 00:00:00
          7566         20 02/04/1981 00:00:00
          7654         30 28/09/1981 00:00:00
          7698         30 01/05/1981 00:00:00
          7782         10 09/06/1981 00:00:00
          7788         20 09/01/2009 15:24:04
          7839         10 17/11/1981 00:00:00
          7844         30 08/09/1981 00:00:00
          7876         20 09/01/2009 15:24:04
          7900         30 03/12/1981 00:00:00
          7902         20 03/12/1981 00:00:00
          7934         10 23/01/1982 00:00:00
    14 rows selected.
    SQL>

  • Oracle Invalid month

    I have an Oracle 9.2 database which is used in a swing application. I insert the dates in the following format dd/MM/yyyy.
    This works fine if I turn my app on a windows platform but when I run it on a linux machine I get the following error :
    ORA-01843 : Invalid month.
    Could anyone explain to me how this comes and what I can do about it?
    PS : My app has to work on both platforms.
    thanks

    import java.sql.* ;
    import java.util.Vector ;
    public class DBQuery
    public static Vector select(Connection connection,String statement,Object[] _param)
    PreparedStatement prepstat ;
    ResultSet result ;
    Connection conn=null ;
    try
    conn=_connection ;
    prepstat=conn.prepareStatement(_statement) ;
    if(_param != null)
    handleParams(prepstat,_param) ;
    result=prepstat.executeQuery() ;
    Vector vecresult=handleSelect(result) ;
    result.close() ;
    return vecresult ;
    catch(SQLException sqlexc)
    return new Vector() ;
    public static boolean execute(Connection connection,String statement,Object[] _param)
    PreparedStatement prepstat ;
    Connection conn=null ;
    try
    conn=_connection ;
    prepstat=conn.prepareStatement(_statement) ;
    if(_param != null)
    handleParams(prepstat,_param) ;
    prepstat.executeUpdate() ;
    return true ;
    catch(SQLException sqlexc)
    System.out.println(sqlexc.getErrorCode()) ;
    System.out.println(sqlexc.getMessage()) ;
    sqlexc.printStackTrace() ;
    return false ;
    private static Vector handleSelect(ResultSet _result)
    throws SQLException
    int nrcols ;
    ResultSetMetaData rsmd ;
    Vector vecresult=new Vector() ;
    rsmd=_result.getMetaData() ;
    nrcols=rsmd.getColumnCount() ;
    while(_result.next())
    Vector row=new Vector() ;
    for(int cntres=1 ; cntres <= nrcols ; cntres++)
    String value=_result.getString(cntres) ;
    if(value == null)
    value=new String("") ;
    row.addElement(value) ;
    vecresult.addElement(row) ;
    return vecresult ;
    private static void handleParams(PreparedStatement prepstat,Object[] params)
    throws SQLException
    String value="" ;
    Object param ;
    for(int cntparam=0 ; cntparam < _params.length ; cntparam++)
    param=_params[cntparam] ;
    if(param == null)
    value="" ;
    else
    value=param.toString() ;
    if(value != null && !value.equals(""))
    _prepstat.setObject(cntparam + 1,param) ;
    else
    _prepstat.setNull(cntparam + 1,Types.VARCHAR) ;
    }

  • Invalid Month error in PL/SQL

    Hi,
    The below query if given without the -- lines at an SQL prompt with work fine. But when used with in a PL/SQL will not work. It throws:
    sqlcode: -1843,sqlerrm: ORA-01843: not a valid month error.
    SELECT
    to_char(wk_beg_d,'dd/mm/yyyy'),to_char(wk_end_d,'dd/mm/yyyy')
    -- INTO
    -- v_fis_wk_strt_d,
    -- v_fis_wk_end_d
    FROM
    acct_date
    WHERE
    acct_d = '12-APR-07;
    Any suggestions will be very helpful.
    Thanks,
    Ravi.

    It reall depends on what you will be doing with v_fis_wk_strt_d and v_fis_wk_end_d.
    If you are just going to display them, and need to have that format for display purposes, then
    DECLARE
       v_fis_wk_strt_d VARCHAR2(11);
       v_fis_wk_end_d  VARCHAR2(11);
    BEGIN
       SELECT TO_CHAR(wk_beg_d,'dd/mm/yyyy'), TO_CHAR(wk_end_d,'dd/mm/yyyy')
       INTO v_fis_wk_strt_d, v_fis_wk_end_d
       FROM acct_date
       WHERE acct_d = TO_DATE('12-APR-2007', 'dd-mon-yyyy');
    END;If you are need to use them later as "real" dates, then, as Boneist suggested:
    DECLARE
       v_fis_wk_strt_d DATE;
       v_fis_wk_end_d  DATE;
    BEGIN
       SELECT wk_beg_d, wk_end_d
       INTO v_fis_wk_strt_d, v_fis_wk_end_d
       FROM acct_date
       WHERE acct_d = TO_DATE('12-APR-2007', 'dd-mon-yyyy');
    END;John

  • Invalid month sql request for chart

    Hi,
    i try to refresh a report with a dynamical sql request as following :
    select NULL LINK, status_label LABEL, count(fcr.status_code) as VALUE
    from table
    where table.date > '05/06/2007'
    This query is generated dynamicaly from a date picker.
    My problem is that the chart witch should be refreshed by this query, isn't.
    The following error message come from the ajax query :
    chart Flash Chart error: ORA-20987: APEX - Flash Chart error:  - ORA-20001: Fetch error: ORA-01843: not a valid month
    Something disapoint me: when i execute the query in plSQL i have got my wished results.
    Does someone have any idea about this mistake?

    Hi better,
    Try to give
    where table.date >to_date( '05/06/2007','dd/mm/yyyy');Brgds,
    Mini
    Mark Answers Promptly

  • Invalid month error during import

    I have set NLS_DATE_FORMAT=”YYYY-MM-DD HH24:MI:SS’ in my import script, yet I get following error in import. I tried NLS_DATE_FORMAT=”RRRR-MM-DD HH24:MI:SS” as well, yet get same error. How can I get rid of the error.
    I am on Oracle 10.2.0.4 on HP UNIX.
    " ALTER TABLE "IN_ERM_SPOOL" MODIFY ("REPORT_TIME" DEFAULT '1970-01-01 00:00"
    ":00' )"
    IMP-00003: ORACLE error 1843 encountered
    ORA-01843: not a valid month
    IMP-00017: following statement failed with ORACLE error 1843:
    " ALTER TABLE "IN_EXTERN_MSG" MODIFY ("START_TIME" DEFAULT '1970-01-01 00:00"
    ":00' )"
    IMP-00003: ORACLE error 1843 encountered
    ORA-01843: not a valid month

    That was a typo. Double quotes are needed in shell script.I am sorry to see that COPY & PASTE is broken for you.
    Post results of
    SELECT * from v$version;
    I am NOT convinced that setting OS environmental variable has the desire results
    bcm@bcm-laptop:~$ export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
    bcm@bcm-laptop:~$ sqlplus
    SQL*Plus: Release 11.2.0.1.0 Production on Sat Nov 20 19:52:55 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Enter user-name: / as sysdba
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select sysdate from dual;
    SYSDATE
    20-NOV-10
    SQL> alter session set NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    2010-11-20 20:17:34
    SQL>

  • Serial number invalid, Monthly subscription InDesign6

    HI,
    I have bought a monthly subscription of InDesign6, previously I had installed an expired trial version, then I bought the subscription, I uninstalled the software and I downloaded and installed again. I searched for my serial in "register products" and  I found one serial realted to the payment but this serial doesn't run, it's not valid serial, What's the problem?
    Thanks for help

    You need to contact Adobe Support either by chat or via phone when you have serial number and activation issues.
    Here are some links to help make contact:
    http://www.adobe.com/support/chat/ivrchat.html
    http://www.adobe.com/support/download-install/supportinfo/

  • Invalid month format

    This code when I run in toad is giving "ORA-01843: not a valid month"
    What should be the correct month format.
    SELECT
    WHSE_DBA.MV_PROD_ALL_INSP_OBJ.IDENTIFIER,
    WHSE_DBA.MV_PROD_ALL_INSP_OBJ.OBJ_TYPE,
    WHSE_DBA.MV_PROD_ALL_INSP_OBJ.LOCATION,
    FROM
    WHSE_DBA.MV_PROD_ALL_INSP_OBJ
    WHERE
    WHSE_DBA.MV_PROD_ALL_INSP_OBJ.OBJ_TYPE LIKE 'PROC%'
    AND WHSE_DBA.MV_PROD_ALL_INSP_STAT_HIST.REQUESTED_DATE BETWEEN '16-04-2008 00:00:00' AND '03-06-2008 00:00:00'

    It's an initialization parameter which also can be set by an environment variable.
    From SQL*Plus:
    SQL> show parameter NLSAlso on the client side check if this environment variable is set.
    Or...just use the TO_DATE() function:
    ...etc... BETWEEN TO_DATE('16-04-2008 00:00:00','DD-MM-YYYY HH24:MI:SS') AND ...etc...

  • Invalid Month error in stored procedure

    Hello, I have a simple stored procedure that I pass a begin and end date into and it is complaining about the date formatting. Below is the table layout and stored procedure in question. How can I format the date for example as MM-DD-YYYY and not have it complain? I have tried using TO_DATE and TO_CHAR and it still complains.
    Thank you.
    -- Table
    CREATE TABLE INV_MOVE_ARCHIVE
    *( "RETAILER_ID" NUMBER NOT NULL,*
    *"SKU_ID" VARCHAR2(18 BYTE) NOT NULL,*
    *"OUTLET_ID" VARCHAR2(20 BYTE) NOT NULL,*
    *"QTY_CHANGE" NUMBER NOT NULL,*
    *"TRANS_DATE" DATE DEFAULT sysdate*
    -- Stored procedure
    CREATE OR REPLACE PROCEDURE inv_move_update(beginDate IN DATE, endDate IN DATE, retailerId IN INT)
    IS
    skuId VARCHAR(18);
    outletId VARCHAR(20);
    qtyChange INTEGER;
    -- Declaring the cursor
    CURSOR getInvRecord IS
    SELECT
    sku_id,
    outlet_id,
    qty_change
    INTO
    skuId,
    outletId,
    qtyChange
    FROM
    inv_move_archive
    WHERE
    retailer_id = retailerId AND
    trans_date &gt;= beginDate AND
    trans_date &lt;= endDate;
    BEGIN
    FOR rec_getInvRecord IN getInvRecord LOOP
    UPDATE OUTLET_SKU_XREF
    SET qty = qty + qtyChange
    WHERE outlet_id = outletId
    AND sku_id = skuId;
    COMMIT;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    IF getInvRecord%isopen THEN CLOSE getInvRecord;
    END IF;
    END inv_move_update;
    */*

    Okay, I do not wantto change the table. I believe thatthe Java developers will need to change their code to call this procedure correctly. Another iss I am having is when I call this procedure manually from the database is is NOT doing the update. I put some debug statements in it and they indicate that the update statement is NOT updating any rows. If I run the select statement that is in the sp using the same parameters I pass into the sp it comes back with 1 row. The row to be updated is present in the table being updated.
    -- Here is my sp call
    DECLARE
      BEGINDATE DATE;
      ENDDATE DATE;
      RETAILERID NUMBER;
    BEGIN
      BEGINDATE := to_date('01/07/2009 00:00:00', 'MM/DD-YYYY HH24:MI:SS');
      ENDDATE := to_date('01/07/2009 11:59:59', 'MM/DD-YYYY HH24:MI:SS');
      RETAILERID := 104;
      INV_MOVE_UPDATE(
        BEGINDATE => BEGINDATE,
        ENDDATE => ENDDATE,
        RETAILERID => RETAILERID
    END;
    -- Select statement with same values
    SELECT
       sku_id,
       outlet_id,
       qty_change
    FROM
       inv_move_archive
    WHERE
       retailer_id = 104 AND
       trans_date >= to_date('01/07/2009 00:00:00', 'MM/DD-YYYY HH24:MI:SS') AND
       trans_date <= to_date('01/07/2009 11:59:59', 'MM/DD-YYYY HH24:MI:SS')
    -- Results from select
    036266579804040     9900165     500
    -- Here is the procedure with the debug statements in it.
    CREATE OR REPLACE PROCEDURE inv_move_update(beginDate IN DATE, endDate IN DATE, retailerId IN  INT)
    IS
            skuId VARCHAR(18);
            outletId VARCHAR(20);
            qtyChange NUMBER;
            errorMessage  VARCHAR(2500) := NULL;       
    -- Declaring the cursor
    CURSOR getInvRecord IS
          SELECT
             sku_id,
             outlet_id,
             qty_change
          INTO
             skuId,
             outletId,
             qtyChange
          FROM
             inv_move_archive
          WHERE
             retailer_id = retailerId AND
             trans_date >= beginDate AND
             trans_date <= endDate;
    BEGIN
       FOR rec_getInvRecord IN getInvRecord LOOP
          DBMS_OUTPUT.PUT_LINE('Rows Updated: ' || SQL%ROWCOUNT);
          UPDATE OUTLET_SKU_XREF
           SET qty = qty + qtyChange
          WHERE outlet_id = outletId
                AND sku_id = skuId;
          DBMS_OUTPUT.PUT_LINE('SKUID: ' || skuId);
          DBMS_OUTPUT.PUT_LINE('Rows Updated: ' || SQL%ROWCOUNT);
          COMMIT;       
       END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
        errorMessage := 'Error updating the OUTLET_SKU_XREF table: ' || SQLCODE || ':' || SQLERRM;
        RAISE_APPLICATION_ERROR(-20001,errorMessage);
        DBMS_OUTPUT.PUT_LINE(errorMessage);
        IF getInvRecord%isopen THEN CLOSE getInvRecord;
        END IF;  
    END inv_move_update;
    /I get no errors when running it. The DBMS_OUTPUT shows null for the skuId and 0 for Rows Updated. Like I said I ran the select manually and it returns a row and I see that the row does exist in the target table. Any ideas what is going on here?
    Thank you
    -- David

  • Checking for month name and number in different language?

    I have to let people search for documents by date. The database is used by French-speakers as well as English-speakers. The search allows users to type in free text (because it's not just dates they might search by, though if they do type in something that's intended to be interpreted as a date, that's the only thing they're allowed to type in). So, I might get '23/Apr/2009' or '2009/04/23', for example. (I also have to allow them to submit 23.04.2009 and 23 04 2009 and any combination of the above!)
    I have written a function which breaks the string into three bits, and then I work out if each bit is a year, or a month, or a day with simple rules (eg, if it's a number between 1900 and 2400, it must be the year component).
    When it comes to the month, I do two things. One is obvious: is it a number between 1 and 12? The other is, is it a month name that appears in a list of 'allowed' month names. So my function does this at the start:
    v_validmonths := 'january,february,march,april <and so on>';
    v_validmonths := v_validmonths || ',janv,fevr,avr,mai, <and so on>';Then I do this:
        for x in 1 .. listlen(v_validmonths,',') loop
          v_probemonth := listgetat(v_validmonths,x,',');   
          if instr(lower(v_partone),v_probemonth) > 0 then
            v_month := extract (month from to_date(v_partone,'MON'));
          end if;
        end loop;   IE, I compare the first component of the string (v_partone) with the list of allowed month names. I repeat that for the other two parts of the supplied string. As you can see, if one of the parts of the supplied string matches an allowed month name, I then try to extract the month number into a variable, using Oracle's own extract function.
    And that's where my problem arises. Because although "aout" is valid French for August and is permitted by my list of valid months, the extract function fails to understand it. A simple select extract (month from to_date('AOUT','MON')) from dual, for example, gives an ORA01843 (invalid month).
    How can I get the code to work with French (and German, actually) months and month abbreviations whilst also being able to understand English ones? Is there an in-built function that would allow me to do this? Or is there some way neatly to say, 'yes: AOUT is in the list, and it's month 8' without me having to rely on the extract function to work it out?
    (I realise that the business requirement here is very peculiar and your first reaction will probably be "this is horrible!". I will absolutely agree with you! But this is the requirement as has been explicitly specified by the MD and I can't negotiate it away, sadly.)

    Hi,
    Many of Oracle's date functions allow a parameter where you can override the current NLS settings only for that function call.
    For example:
    SELECT  TO_DATE ( 'JUIL.'
                     , 'MON'
                     , 'NLS_DATE_LANGUAGE=FRENCH'
                     ) AS month
    FROM    DUAL;You could also create your own table of month names
    NAME     NUM     LANGUAGE
    JANVIER   1     FRENCH
    JANV       1     FRENCHand look up the names in this table, rather than in a string hard-coded in the function. This might be especially useful if you wanted to allow your own abbreviations or spellings (e.g., ignoring accent marks).
    Edited by: Frank Kulash on Dec 16, 2010 11:40 PM

Maybe you are looking for

  • Looking for a good movie maker app for iPad 1

    Hi Everybody-   I am looking for a good Photo/Movie maker for the iPad 1. Something that I can add Photos/Movies together and add some songs and have editing capabilities for all of it and possiabily export it as well to my PC to burn to DVD/CD. So i

  • The Invoice date should hold the GR date by default

    Hi SDners, I have a requirement. When the Billing is done in MIRO, the user wants the field  Invoice Date to be automatically populated with GR  Date. Guide me as to where i need to do the coding for the same. Should this be coded in the user exit? R

  • Assemble PDF documents in Acrobat Reader

    Hi, In Acrobat, I create a button with a JavaScript Action to assemble two PDF documents. This action can be done in Acrobat reader ? Regards David

  • Manage Bookmarks on Preview application

    Hi there, does anybody know, how to manage bookmarks on preview application? I want to group my bookmarks in different folders or how can I highlight pages or sth. like this?

  • Cinema 4D Lite wont render in After Effects?

         I'm a beginner with After Effects and while trying to use Cinema 4D Lite I came back to After Effects and made a new Composition with the .c4d file. All that showed up in my composition was black, and if I scrubbed through nothing showed up and