Ora-01861 error

I am getting ora-01861 error in SQL developer. I did not get the error using TORA. I am at a loss as what to fix. I need to reformat a date.
I am using
TO_CHAR(PER.BIRTH_DATE, 'MM/DD/YYYY') AS BIRTH_DATE,
The birth date is dd-mmm-yy and I MUST be able to convert to mm/dd/yyyy
Any suggestions?
Thanks

Is it already in date format and you want your query to return it in a different format? Try changing your Preferences
Tools -> Preferences -> Database -> NLS -> Date Format
-- Edit
I may have misread. If PER.BIRTH_DATE is a string in dd-mmm-yy format, you must convert it to a date, and the back to a string if you want to just change the format. Or if you just convert it to a date, and you change your NLS settings, maybe that will be good enough?
TO_CHAR(TO_DATE(PER.BIRTH_DATE, 'dd-mmm-yy'), 'MM/DD/YYYY') AS BIRTH_DATE,
Edited by: DylanB123 on Feb 25, 2010 4:49 PM

Similar Messages

  • SQL Error: ORA-01861: literal does not match format string

    Hello,
    I'm trying to do data mining on a web log which recorded one day web access information from a busy web server. I imported the data into Oracle Data miner, and created a table (WEBLOG). The idea is to create a new field, i.e. session, for the users so that each session could be thought as a representative of a user-intent (aka topic). Now based on this, data mining models would be used to cluster(group) the users based on their similarity. The first step is to prepare the data which involves using SQL queries. So first, all I did was to create a function for date and time. This is the following code I used,
    create or replace function ssndate(p_date in varchar2 default '03-01-18',
    p_time in varchar2)
    return number
    $if dbms_db_version.ver_le_10 $then
    deterministic
    $elsif dbms_db_version.ver_le_11 $then
    result_cache
    $end
    as
    begin
    return trunc((to_date(p_date||' '||p_time, 'dd-mm-yy hh24:mi:ss')
    - to_date('01-01-90','dd-mm-yy')) * (86400/2400));
    end ssndate;
    The function ssndate compiled successfully.
    The next step I took was to create a view through the following query,
    create or replace view WEBLOG_VIEWS
    as
    select (select ssndate(LOG_DATE, LOG_TIME) from dual) as "SESSION_DT",
    C_IP,
    CS_USER_AGENT,
    (CS_URI_STEM||'?'||CS_URI_QUERY) as WEB_LINK
    from WEBLOG;
    This was successful as well. The problem is in the next step where I try to do data grouping.
    create table FINAL_WEBLOG as
    select SESSION_DT, C_IP, CS_USER_AGENT,
    listagg(WEB_LINK, ' ')
    within group(order by C_IP, CS_USER_AGENT) "WEB_LINKS"
    from WEBLOG_VIEWS
    group by C_IP, CS_USER_AGENT, SESSION_DT
    order by SESSION_DT
    For this, I got the error,
    Error starting at line 1 in command:
    create table FINAL_LOG as
    select SESSION_DT, C_IP, CS_USER_AGENT,
    listagg(WEB_LINK, ' ')
    within group(order by C_IP, CS_USER_AGENT) "WEB_LINKS"
    from WEBLOG_VIEWS
    group by C_IP, CS_USER_AGENT, SESSION_DT
    order by SESSION_DT
    Error at Command Line:1 Column:7
    Error report:
    SQL Error: ORA-01861: literal does not match format string
    ORA-06512: at "DMUSER.SSNDATE", line 11
    ORA-06512: at line 1
    01861. 00000 - "literal does not match format string"
    *Cause:    Literals in the input must be the same length as literals in
    the format string (with the exception of leading whitespace).
    If the "FX" modifier has been toggled on, the literal must
    match exactly, with no extra whitespace.
    *Action:   Correct the format string to match the literal.
    I don't know where I'm going wrong with this.. the to_date function should be fine. In the data that I possess, the date and time are in no format. Example: 30118 and 0:00:09 respectively. If anyone has any clue about this I would be sincerely grateful for any help that I can get!! It's quite urgent..
    The Oracle version is 11.2.0.1.0
    Edited by: 975265 on Dec 5, 2012 5:31 PM

    975265 wrote:
    Ok.. Looks like I touched a nerve there. I apologize. I'm still a student, and this is the first time that I've tried something at this level. I'm still in the learning process, so I was hoping that someone could point me in the right direction in order to "fix" the data.Not so much touching a nerve as simply trying to implement a very very poor, but all too common, practice. Since you are a student (which we didn't know until this post) most people will cut you some slack. However, this little exchange should now be burned into your brain as you move forward. One of the very first rules of programming is to ALWAYS use the correct data types for your data. And along with that, never ever depend on implicit type conversions - always use the proper explicit conversion functions.
    And as a slight follow-on, when considering the appropriate data type, don't assume that just because we refer to a given element as a 'something number' that it is indeed a number. Telephone "numbers" are NOT numbers. U.S. Social Security "numbers" are NOT numbers. U.S. Postal Zip codes are NOT numbers. All are just character strings which, by convention, we limit to the same characters we use to represent numbers.
    And since this entire discussion came up around the representation of dates, you might want to take a look at http://edstevensdba.wordpress.com/2011/04/07/nls_date_format/
    Now, go forth and be a smarter programmer than your peers.
    Edited by: EdStevens on Dec 6, 2012 6:12 AM

  • Error: ORA-01861: literal does not match format string

    Hi,
    I am doing a RFC-XI-JDBC scenario.
    In the CC monitoring , i am getting this error for the reciver CC:
    "Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. "TableNAMe"(structure 'STATEMENTNAME'): java.sql.SQLException: ORA-01861: literal does not match format string "
    Please guide me what can be the cause and how to solve it.
    Thanks,
    Puneet

    This is how my payload looks like :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:MT_JDBC_REC xmlns:ns1="https:namespace.scene3">
    <STATEMENTNAME>
    <TABLE_NAME action="INSERT">
    <TABLE>ggclgis</TABLE>
    <access>
    <VALVE_ID>12584</VALVE_ID>
    <EQUNR>122</EQUNR>
    <ERNAM>12122</ERNAM>
    <INVNR>1212</INVNR>
    <GROES>1212</GROES>
    <ELIEF>123</ELIEF>
    <GWLEN>21-jul-2008</GWLEN>
    <GWLDT>12-jun-2006</GWLDT>
    <SERGE>wqwqw</SERGE>
    <TYPBZ>wqwqwq</TYPBZ>
    </access>
    </TABLE_NAME>
    </STATEMENTNAME>
    </ns1:MT_JDBC_REC>
    Please tell me if it looks fine.

  • Lession 3 oca sql fundamental doubts on ora -01858 error

    SELECT last_name, hire_date
       FROM   employees
       WHERE  hire_date = TO_DATE('May 24, 1999', 'fxMonth DD, YYYY');
       books mention it will leave a error (ora-01858 which is an non-numeric error )but the statement running perfectly while
    by deleting that "fx"-prefix gives an error called ora-01861.
    i am confused here??can anyone show me the right way?

    Hi,
    The outcome depends on your NLS settings. Probably yours are set to something different than AMERICAN. In you language the month of May may then have a different number of characters(?)
    That's why you hit the ORA-01861 with the FX Format Model, and something else without. (Can't see why you should get ORA-01858, though)
    Regards
    Peter

  • SQL LOADER and ORA-01861: literal does not match format string

    Hi,
    I've to load data through control_file(.ctl) into oracle table through sqlldr. Oracle 11g, win xp.
    as soon as I use - sqlldr dss/dss control=orders.ctl I get error or nothing.
    Text file that is generated after loading fails has the following error.
    Record 1: Rejected - Error on table ORDERS, column O_ORDERDATE.
    ORA-01861: literal does not match format string
    I have checked the format of data to be loaded into Orders table is like this : *1996-01-02.*
    I checked the format of data in my database by querying sysdate from dual i.e. 10-JAN-10
    I thought that changing its format might solve my problem so i tried this:
    SQL> alter session set nls_date_format='YYYY-MM-DD';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    2010-01-10but still i'm getting the same error. I've to load millions of data. how I can solve this issue.
    Please suggest.
    Thanks alot.
    Best Regads,
    Kam

    Hi,
    It's strange ....nobody knew it?. I think this type of load problem will be very common isn't it.... where date column data is in a different format than in the db i.e.
    How to change *1996-01-02* in the Control_file to make it able to load in the table where sysdate is like this: *11-JAN-10*
    Sample data to be loaded is :
    1|36901|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among |
    Desc Orders
    O_ORDERDATE NOT NULL DATEI have tested this by creating a test table and a test control file by omitting this O_ORDERDATE and then everything was fine, data was inserted but don't know how to load this DATE also.
    Also not able to understand about POSITION in the control file...?
    Regards,
    Kam

  • SQL LOADER and ORA-01861: Please ignore,,my mistake...its duplicate

    Hi,
    I've to load data through control_file(.ctl) into oracle table through sqlldr. Oracle 11g, win xp.
    as soon as I use - sqlldr dss/dss control=orders.ctl I get error or nothing.
    Text file that is generated after loading fails has the following error.
    Record 1: Rejected - Error on table ORDERS, column O_ORDERDATE.
    ORA-01861: literal does not match format string
    I have checked the format of data to be loaded into Orders table is like this : *1996-01-02.*
    I checked the format of data in my database by querying sysdate from dual i.e. 10-JAN-10
    I thought that changing its format might solve my problem so i tried this:
    SQL> alter session set nls_date_format='YYYY-MM-DD';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    2010-01-10but still i'm getting the same error. I've to load millions of data. how I can solve this issue.
    Please suggest.
    Thanks alot.
    Best Regads,
    Kam
    Edited by: kam555 on Jan 10, 2010 11:41 PM

    Please refrain from [posting duplicates|http://forums.oracle.com/forums/thread.jspa?threadID=1010735&tstart=0] and mark this post with IGNORE in the subject.

  • ORA-01861 on call to stored procedure

    I'm trying to pass a date type to stored procedure and I get this error. Here's my code any help would be GREATLY appreciated!
    Dim expiresParam As OracleParameter = command.Parameters.Add("expires", OracleDbType.Date)
    expiresParam.Direction = ParameterDirection.Input
    Dim od As OracleDate = New OracleDate(expires)
    expiresParam.Value = od
    Expires is defined as ByVal expires As System.DateTime

    I changed the date field to a varchar2 field and I still get an ORA-01861 - any ideas what causes this on a called to a stored proc? Here's the entire code snippet
    Protected Shared Function SprocCreateSecurityToken(ByVal token As String, ByVal expires As System.DateTime, ByVal MachineName As String, _
    ByVal UserName As String, ByVal EmployeeNo As Integer) As Integer
    ' create a connection...
    Dim connection As New OracleConnection(ULLOSPApplication.Application.ConnectionString)
    connection.Open()
    ' create a command...
    Dim command As New OracleCommand("dps_eppv4_package.CREATE_SECURITY_TOKEN", connection)
    command.CommandType = CommandType.StoredProcedure
    ' parameters...
    Dim tokenParam As OracleParameter = command.Parameters.Add("Token", OracleDbType.Varchar2, 256)
    tokenParam.Direction = ParameterDirection.Input
    tokenParam.Value = token
    'Dim expiresParam As OracleParameter = command.Parameters.Add("expires", OracleDbType.Date, 20)
    'expiresParam.Direction = ParameterDirection.Input
    'Dim od As OracleDate = New OracleDate(expires)
    'expiresParam.Value = od
    Dim expiresParam As OracleParameter = command.Parameters.Add("expires", OracleDbType.Varchar2, 20)
    expiresParam.Direction = ParameterDirection.Input
    expiresParam.Value = expires.ToString
    Dim MachineNameParam As OracleParameter = command.Parameters.Add("MachineName", OracleDbType.Varchar2, 64)
    MachineNameParam.Direction = ParameterDirection.Input
    'MachineNameParam.Value = MachineName
    MachineNameParam.Value = "123"
    Dim UserNameParam As OracleParameter = command.Parameters.Add("UserName", OracleDbType.Varchar2, 64)
    UserNameParam.Direction = ParameterDirection.Input
    UserNameParam.Value = UserName
    Dim EmployeeNoParam As OracleParameter = command.Parameters.Add("EmployeeNo", OracleDbType.Int64, 6)
    EmployeeNoParam.Direction = ParameterDirection.Input
    EmployeeNoParam.Value = EmployeeNo
    Dim returnValueParam As OracleParameter = command.Parameters.Add("RETVAL", OracleDbType.Int64)
    returnValueParam.Direction = ParameterDirection.ReturnValue
    ' execute...
    command.ExecuteNonQuery()
    ' cleanup...
    command.Dispose()
    connection.Close()
    ' return...
    Return CInt(returnValueParam.Value)
    End Function
    The exception is returned on the ExecuteNonQuery

  • ORA-01861

    Hi Everyone ,
    I am trying to declare some variable in PL/SQL code but getting ORA-01861. I am not able to find out the reason. Can anyone help me out.
    Thanks,
    Av
    PL/SQL Code is
    SQL> ed
    Wrote file afiedt.buf
    1 declare
    2 crel_id intf_msg_dlvr_t.msg_crel_id%type := null ;
    3 tmst varchar2(25) := null ;
    4 rtmst varchar2(25) := null ;
    5 recp_date date;
    6 recv_dc varchar2(10) := '&recv_dc'; ---- getting error in this statement
    7 leg_tsf_num varchar2(7):= '&leg_tsf_num';
    8 begin
    9 select to_char(current_timestamp, 'YYYY-MM-DD-HH24.MI.SS.FF6') into crel_id from dual;
    10 select to_char(systimestamp,'YYYYMMDDHHMISS') into recp_date from dual ;
    11 select to_char(systimestamp,'YYYYMMDDHH24MISSFF6') into tmst from dual;
    12 select reverse(to_char(systimestamp,'YYYYMMDDHH24MISSFF6')) into rtmst from dual;
    13 dbms_output.put_line(crel_id);
    14 dbms_output.put_line(tmst);
    15* end;
    16 /
    Enter value for recv_dc: 25
    old 6: recv_dc varchar2(10) := '&recv_dc'; ---- getting error in this statement
    new 6: recv_dc varchar2(10) := '25'; ---- getting error in this statement
    Enter value for leg_tsf_num: 1000as
    old 7: leg_tsf_num varchar2(7):= '&leg_tsf_num';
    new 7: leg_tsf_num varchar2(7):= '1000as';
    declare
    ERROR at line 1:
    ORA-01861: literal does not match format string
    ORA-06512: at line 10
    ---*********************************8

    whats wrong with my query because i end up getting ORA-00911: invalid character
    please help. here's my query
    select 'A' DATE_RANGE, count(*)
    from sm_service_header
    where
    TO_CHAR(REQUEST_DATE, 'YYYY-MM-DD HH:MI:SS') >= CONCAT(TO_CHAR(TRUNC('2005-01-01'), 'YYYY-MM-DD'), ' 17:00:00')
    and TO_CHAR(REQUEST_DATE, 'YYYY-MM-DD HH:MI:SS') <= CONCAT(TO_CHAR(TRUNC('2005-01-30'), 'YYYY-MM-DD'), ' 07:00:00')
    union
    select 'B' DATE_RANGE, count(*)
    from sm_service_header
    where
    TO_CHAR(REQUEST_DATE, 'YYYY-MM-DD HH:MI:SS') > CONCAT(TO_CHAR(TRUNC('2005-01-30'), 'YYYY-MM-DD'), ' 07:00:00')
    and TO_CHAR(REQUEST_DATE, 'YYYY-MM-DD HH:MI:SS') < CONCAT(TO_CHAR(TRUNC('2005-01-30'), 'YYYY-MM-DD'), ' 17:00:00');

  • FRM-40735: When-Validate-Item trigger raised unhandled exception ORA-01861

    Dear all, I runned a form designed by Developer 2000 version 4.5 and encountered a puzzling problem. The same program could be runned on one computer but not in another one. The error message is as below: FRM-40735: When-Validate-Item trigger raised unhandled exception ORA-01861. The OS of both computers are windows 2000 professional. The only difference between two computers is the patch files didn't installed on one of them. I don't know if it is the key point. Could you tell me why?
    Thank you!!!

    I sure wish people would post the entire text of the error message. "ORA-01861: literal does not match format string."
    What kind of field are you trying to validate? This message is usually due to a date format error. If you are trying to convert text into a date without using TO_DATE('some text','date-format'), then that is the problem. It sounds like you are, and the database default date format is different between the two systems.

  • ORA-01861 literal does not match format string, ORA-02063preceding line fro

    We have upgraded a client from 8.0.5 to 9.2.03. The following query is called from a report that was built using Cold Fusion5. It worked in 8.0.5, but not 9.2.03. When you run the report you get the errors
    [Oracle][ODBC][Ora]ORA-01861: literal does not match format string ORA-02063: preceding line from FRPE
    Here's the query:
    SELECT x.acct, x.obj, x.offn, x.status, x.asofdate, max( decode( x.func_id, 1, t, null ) ) UOB, max( decode( x.func_id, 12, t, null ) ) COB, max( decode( x.func_id, 24, t, null ) ) Rate_Warning, max( decode( x.func_id, 2, t, null ) ) Sector_Change, max( decode( x.func_id, 2006, t, null) ) FRRFRD , max( decode( x.func_id, 2003, t, null ) ) No_Tcode , max( decode( x.func_id, 2004, t, null) ) No_Sector FROM ( SELECT a.acct, a.func_id, count(*) cnt, 'Fail' t, b.obj, b.offn, b.status,a.asofdate FROM frpfaud@FRPE a, frpair@FRPE b WHERE a.acct=b.acct AND a.asofdate='2008-02-29 00:00:00' AND b.bnk not like 'B%' and b.obj not in ('KL') and b.obj in ('GAF') GROUP BY a.acct, a.func_id,b.obj,b.offn,b.status,a.asofdate) x GROUP BY x.acct, x.obj,x.offn,x.status,x.asofdate
    Now, this query will not work by running straight through SQL worksheet in either the 8.0.5 or 9.2.03 regions. So I guess it has something to do with Cold Fusion- which I know nothing about. Has anyone had any experience using Cold Fusion to issue a query? What would be the cause of the difference between the Oracle versions? That is the only thing that changed.
    Thanks for any input.

    I actually want the date format of DD-MON-YY. Which, from what I understand, is the default format for both Oracle 8.0.5 and 9.2.03. I'm trying to figure out why it is now displaying as 'yyyy-mm-dd hh24:mi:ss'. I could convince the client that the code needs changing if I had evidence that this version of Oracle (9.2.03) used a different default date format. Or if Cold Fusion pulls the date differently. Ughh.
    Here are the database parameters:
    SQL> show parameter nls_date_format
    NAME TYPE VALUE
    nls_date_format string
    select sysdate from dual;
    SYSDATE
    26-FEB-08
    1 row selected.
    select * from nls_session_parameters
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    17 rows selected.
    select * from v$nls_parameters
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_CHARACTERSET WE8MSWIN1252
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    19 rows selected.

  • Trying to insert "second" value in DATE column using SQLLDR ORA-01861

    Don't know suddenly with the same piece of control file the number issue got resolved.
    :30
    :30
    :30
    :30
    :30
    :30
    :30
    :30
    :30
    :30
    :30
    Now I was using for this
    FORECASTED_ASA EXPRESSION "TO_DATE(SYSDATE,':SS')" ...but it's not working
    throwing error like....
    Record 1: Rejected - Error on table "ABC", column FORECASTED_ASA.
    ORA-01861: literal does not match format string
    Record 2: Rejected - Error on table "ABC", column FORECASTED_ASA.
    ORA-01861: literal does not match format string

    SQL> alter session set nls_Date_format = 'DD-MON-YYYY HH24:MI:SS';
    Session altered.
    SQL> select to_date(sysdate,':ss') from dual;
    select to_date(sysdate,':ss') from dual
    ERROR at line 1:
    ORA-01861: literal does not match format string
    SQL> select to_date(':30',':ss') from dual;
    TO_DATE(':30',':SS')
    01-JUL-2011 00:00:30
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionSo it could be
    FORECASTED_ASA EXPRESSION "TO_DATE(':forecaseted_asa',':SS')" Regards
    Raj

  • DUPLICATE fails after recovery due to ORA-01861

    I issued the following duplicate command:
    DUPLICATE TARGET DATABASE TO dev2 UNTIL TIME '2006-09-16 04:30:00';It actually goes through the 8-hour task of restoring datafiles and recovering from archive logs. It then creates the control file and then executes the SET NEWNAME commands when it fails with this error
    executing command: SET NEWNAME
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 09/18/2006 08:17:07
    RMAN-03015: error occurred in stored script Memory Script
    ORA-01861: literal does not match format stringThe only possible cause I can think of is that, as of 16 Sep 2006, I hadn't yet set my NLS_DATE_FORMAT parameter. It is now set (to YYYY-MM-DD HH24:MI:SS) so that I can specify the date format for my PITR duplication.
    Does my diagnosis make any sense? If I unset NLS_DATE_FORMAT and say UNTIL TIME '16-SEP-06' does that mean '16-SEP-06 00:00:00'? That would work for me as well. However since each failed attempt means 8 hours lost I'd like to know that kind of thing ahead of time, and if my diagnosis is even correct.

    Normally we do have two senarios while cloning. One, you clone to an existing instance by removing the control and datafiles. Two, take a copy of spfile from target DB and clone to auxiliary DB. In the first case there can be chances that NLS is different than your target. But in second case it will be same because you are cloning from one parent setting.
    In your case if I am not wrong it was the first scenario ( This scenario I normally face in my UAT database clones when cloning from production). Its always better to keep same NLS but some situations u cant do that. In that case you can use “to_date” and it’s a very well proven method.
    And your question why your clone failed after all the restore operation. I personally think the database when tried to reset your logs after restoration it found format difference and shouted about that. As simple as that.

  • ORA-01861: literal does not match format string

    Hi Experts,
    Whenever i am running the my procedure in oracle appliactions i am getting this error.
    ORA-01861: literal does not match format string .
    pkg is below:--->
    CREATE OR REPLACE PACKAGE Arc0471_Pending_Crc_Prc_Pkg IS
      --Insert into Custom Table
        PROCEDURE Arc_Insert_Data(P_ORG_ID VARCHAR2, P_BC_CODE VARCHAR2, P_GL_DATE VARCHAR2, P_DB_LINK VARCHAR2);
    END Arc0471_Pending_Crc_Prc_Pkg;
    CREATE OR REPLACE PACKAGE BODY Arc0471_Pending_Crc_Prc_Pkg IS
            PROCEDURE Arc_Insert_Data(P_ORG_ID VARCHAR2, P_BC_CODE VARCHAR2, P_GL_DATE VARCHAR2, P_DB_LINK VARCHAR2)
            IS
              v_val         varchar2(32000);          
              v_cursor1     integer;
              v_cursor2     integer;
              v_returncode  integer;
            BEGIN
           v_val   := ' ';
            v_val :=' INSERT INTO ARC.ARC_CRC_PRC_INVC ';
              v_val := v_val||' (CTA_TRX_NUMBER ,CTA_TRX_DATE ,DUE_DATE ,';
              v_val := v_val||' BILL_TO_CUSTOMER_NO,     BILL_TO_CUSTOMER_NAME ,     BILL_TO_LOCATION ,';
              v_val := v_val||' BILL_TO_ADDRESS ,ORIGINAL_AMOUNT ,APPLIED_AMOUNT , EXCHANGE_RATE     ,';
              v_val := v_val||' INVOICE_CURRENCY_CODE , ACCOUNT_CLASS , GL_DATE  , CTA_CUSTOMER_TRX_ID ,';
              v_val := v_val||' ORG_ID , CREATED_BY , CREATION_DATE ,LAST_UPDATE_BY , LAST_UPDATE_DATE , LAST_UPDATE_LOGIN )';
            v_val := v_val||' SELECT  CTA.TRX_NUMBER ,     CTA.TRX_DATE , APS.DUE_DATE ,';
              v_val := v_val||' HCA.ACCOUNT_NUMBER ,     HP.PARTY_NAME ,     HCSUA.LOCATION ,';
              v_val := v_val||' SUBSTR(HL.ADDRESS1 ||'||''' '''||'|| HL.ADDRESS2 ||'||'''  '''|| '||HL.ADDRESS3||'||'''  '''|| '||HL.ADDRESS4|| '||'''  ''' ||'||HL.PROVINCE||'||'''  '''||'|| HL.CITY ||'||'''  '''||'|| HL.STATE ||'||'''  '''||'|| HL.POSTAL_CODE ||'||'''  '''||'||FTL.TERRITORY_SHORT_NAME,0,1500),';
              v_val := v_val||' APS.AMOUNT_DUE_ORIGINAL , APS.AMOUNT_APPLIED,APS.EXCHANGE_RATE, APS.INVOICE_CURRENCY_CODE, CTLA.ACCOUNT_CLASS,';
              v_val := v_val||' APS.GL_DATE , CTA.CUSTOMER_TRX_ID , CTA.ORG_ID ,FND_GLOBAL.USER_ID ,';
              v_val := v_val||' SYSDATE , FND_GLOBAL.USER_ID , SYSDATE , FND_GLOBAL.LOGIN_ID '  ;  
             v_val := v_val||' FROM ' ;
             v_val := v_val||' AR.RA_CUSTOMER_TRX_ALL CTA,';
              v_val := v_val||' AR.RA_CUST_TRX_TYPES_ALL CTTA,';
              v_val := v_val||' AR.RA_CUST_TRX_LINE_GL_DIST_ALL CTLA,';
              v_val := v_val||' AR.HZ_PARTIES HP,';
              v_val := v_val||' AR.HZ_CUST_ACCOUNTS HCA,';
              v_val := v_val||' AR.HZ_CUST_SITE_USES_ALL HCSUA,';
              v_val := v_val||' AR.HZ_LOCATIONS HL,';
              v_val := v_val||' AR.HZ_PARTY_SITES HPS,';
              v_val := v_val||' AR.AR_PAYMENT_SCHEDULES_ALL APS,';
              v_val := v_val||' AR.HZ_CUST_ACCT_SITES_ALL HCASA,';
              v_val := v_val||' GL.GL_CODE_COMBINATIONS GCC,';
              v_val := v_val||' AR.AR_RECEIVABLE_APPLICATIONS_ALL ARAA,';
              v_val := v_val||' APPLSYS.FND_TERRITORIES_TL FTL ,';
              v_val := v_val||' ONT.OE_TRANSACTION_TYPES_TL'|| P_DB_LINK ||' IND_OTT, ' ;
              v_val := v_val||' ONT.OE_ORDER_HEADERS_ALL'||P_DB_LINK ||'  IND_OH, ';
              v_val := v_val||' AR.RA_CUSTOMER_TRX_ALL'||P_DB_LINK ||' IND_RCTA   ';
             v_val := v_val||' WHERE   CTA.ORG_ID = '||''''|| P_ORG_ID||'''';
             v_val := v_val||' AND   CTTA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   CTLA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   HCSUA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   APS.ORG_ID =  '||''''||P_ORG_ID||'''';
             v_val := v_val||' AND   HCASA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   CTLA.ACCOUNT_CLASS     =     '||'''REC''';
              v_val := v_val||' AND   CTLA.GL_DATE <= TRUNC(TO_DATE( '||''''||P_GL_DATE||''''||','||'''DD/MM/RRRR HH24:MI:SS'''||'))';
             v_val := v_val||' AND   NVL(ARAA.APPLY_DATE,TO_DATE( '||''''||P_GL_DATE||''''||','||'''DD/MM/RRRR HH24:MI:SS'''||')) <= TRUNC(TO_DATE ('||''''||P_GL_DATE||''''||','||'''DD/MM/RRRR HH24:MI:SS'''||'))';
             v_val := v_val||' AND   TO_DATE(APS.TRX_DATE,'||'''DD-MON-RRRR'''||') >'|| '''02-SEP-2007''' ;
             v_val := v_val||' AND     CTA.CUST_TRX_TYPE_ID    =     CTTA.CUST_TRX_TYPE_ID';
             v_val := v_val||' AND     CTLA.CUSTOMER_TRX_ID     =     CTA.CUSTOMER_TRX_ID';
             v_val := v_val||' AND     HCA.CUST_ACCOUNT_ID     =     CTA.BILL_TO_CUSTOMER_ID';
             v_val := v_val||' AND     HCA.PARTY_ID          =     HP.PARTY_ID';
             v_val := v_val||' AND     HCSUA.SITE_USE_ID     =     CTA.BILL_TO_SITE_USE_ID';
             v_val := v_val||' AND     HL.LOCATION_ID          =     HPS.LOCATION_ID';
             v_val := v_val||' AND     HPS.PARTY_ID          =     HCA.PARTY_ID';
               v_val := v_val||' AND     APS.CUSTOMER_TRX_ID     =     CTLA.CUSTOMER_TRX_ID';
             v_val := v_val||' AND     HCASA.CUST_ACCOUNT_ID     =     HCA.CUST_ACCOUNT_ID';
             v_val := v_val||' AND   HCASA.CUST_ACCT_SITE_ID =HCSUA.CUST_ACCT_SITE_ID';
             v_val := v_val||' AND   HCASA.PARTY_SITE_ID=HPS.PARTY_SITE_ID';
             v_val := v_val||' AND     ARAA.APPLIED_CUSTOMER_TRX_ID(+) = CTA.CUSTOMER_TRX_ID';
             v_val := v_val||' AND   IND_RCTA.TRX_NUMBER = CTA.TRX_NUMBER';
             v_val := v_val||' AND     TO_CHAR(IND_OH.ORDER_NUMBER) = IND_RCTA.CT_REFERENCE';
             v_val := v_val||' AND     IND_OTT.TRANSACTION_TYPE_ID = IND_OH.ORDER_TYPE_ID';
              --v_val := v_val||' AND   ARC.Arc0463_Get_Remng_Amt(APS.TRX_NUMBER,'||''''|| P_GL_DATE||''''||','||'APS.INVOICE_CURRENCY_CODE) <> 0';
             v_val := v_val||' AND   IND_OTT.NAME IN ('||'''D0M RC Imported Sale'''||','||'''D0M RC Indigenous Sale'''||')';
             v_val := v_val||' AND   GCC.CODE_COMBINATION_ID = CTLA.CODE_COMBINATION_ID';
             v_val := v_val||' AND   GCC.SEGMENT1 = '|| ''''||P_BC_CODE||'''';
             v_val := v_val||' AND   HL.COUNTRY = FTL.TERRITORY_CODE';
             v_val := v_val||' AND   FTL.LANGUAGE = USERENV('||'''LANG'''||')';          
                v_cursor1 := dbms_sql.open_cursor;
              dbms_sql.parse(v_cursor1,v_val,DBMS_SQL.NATIVE);
              v_returncode := dbms_sql.execute(v_cursor1);
              dbms_sql.close_cursor(v_cursor1);
         COMMIT;
         EXCEPTION     
                    WHEN DUP_VAL_ON_INDEX THEN
                                    NULL;
                   WHEN OTHERS THEN
                        COMMIT;
                   FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'IN WHEN OTHERS THEN OF INSERT INTO ARC.ARC_CRC_PRC_INVC'||SQLCODE || ' - ' || SQLERRM);
                -- dbms_output.put_line(sqlcode||sqlerrm);
            END Arc_Insert_Data;
    END Arc0471_Pending_Crc_Prc_Pkg;in above procdure APS.TRX_DATE having the format like this..23/3/2006. in Backend this procedure is working fine ..in toad(version 8.0.0.47). database is 9.0.
    but in oracle apps it is giving error like "literal does not match format string".
    please give me the solution...
    Thanks in ADv...

    Hi,
    It is the Date Data type...There's your problem then; NEVER, EVER, EVER to_date a date!! As you have discovered, it leads to problems when your code is run on different clients due to the different NLS settings they may have. You've been lucky, in other words, that your code has been working at all!
    What to_dating a date does is this:
    to_date(to_char(date_value, <format in NLS_DATE_FORMAT parameter>), <format in NLS_DATE_FORMAT parameter>) You've been lucky because your NLS_DATE_FORMAT has the same format as the data, on your client. On the database, however, it is clearly different.
    Simply remove the to_date from your already-a-date value, and you should find that it works fine.

  • ORA-01861 occurs when NO_INDEX hint removed

    Hi all,
    We've got a view that is very slow and we'd noticed it had several /* NO_INDEX (+index_name+) */ hints. Thinking this was an odd approach and may be causing the performance hit, I tested the query without the hints and, as expected, performance was vastly improved.
    However, the application that uses the view queries via a DATE column on the view. When a date is specified in a query against the view, the version with the hints removed now comes up with ORA-01861. The same query against the view with the hints intact works fine (albeit very slowly).
    The view references views/tables that are accessed across a database link. The source of the DATE field is originally a VARCHAR2 field that is converted to a date using TO_DATE on one of the views in the main view's FROM clause (to the DD/MM/YYYY HH24:MI:SS format).
    I've tried all manner of TO_CHAR, TO_DATE (with and without TRUNC) to get the query to work without success. There is something very odd going on here.
    The database is 9i.
    Please help!

    Many thanks for the swift responses.
    The main query (I've posted the version with the hint so you can see that) is:
    CREATE OR REPLACE FORCE VIEW people.xxmod_int_fp_shift_payment_v (psp_cust_id,
    psp_person_id,
    psp_term_date,
    psp_pp_date,
    psp_amt,
    psp_ind,
    psp_percent,
    psp_hrs,
    psp_pen_amt
    AS
    SELECT /*+ NO_INDEX(xienav.peev pay_element_entry_values_f_n50) */
    xipciv.customer_id, papf.employee_number, papf.effective_end_date,
    xienav.week_ending_date, NULL, NULL, NULL, NULL, NULL
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    pay_element_entries_f peef,
    xxmod_int_ee_night_allow_v xienav,
    xxmod_int_per_cust_id_v xipciv
    WHERE paaf.person_id = papf.person_id
    AND peef.assignment_id = paaf.assignment_id
    AND xienav.element_entry_id = peef.element_entry_id
    AND paaf.payroll_id = xipciv.payroll_id
    AND peef.effective_start_date BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND peef.effective_start_date BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    UNION ALL
    SELECT /*+ NO_INDEX(xienamv.peev pay_element_entry_values_f_n50) */
    xipciv.customer_id, papf.employee_number, papf.effective_end_date,
    xienamv.date_worked, NULL, NULL, NULL, NULL, NULL
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    pay_element_entries_f peef,
    xxmod_int_ee_night_allow_mod_v xienamv,
    xxmod_int_per_cust_id_v xipciv
    WHERE paaf.person_id = papf.person_id
    AND peef.assignment_id = paaf.assignment_id
    AND xienamv.element_entry_id = peef.element_entry_id
    AND paaf.payroll_id = xipciv.payroll_id
    AND peef.effective_start_date BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND peef.effective_start_date BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    UNION ALL
    SELECT /*+ NO_INDEX(xiesov.peev pay_element_entry_values_f_n50) */
    xipciv.customer_id, papf.employee_number, papf.effective_end_date,
    xiesov.date_worked, NULL, NULL, NULL, NULL, NULL
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    pay_element_entries_f peef,
    xxmod_int_ee_shift_overtime_v xiesov,
    xxmod_int_per_cust_id_v xipciv
    WHERE paaf.person_id = papf.person_id
    AND peef.assignment_id = paaf.assignment_id
    AND xiesov.element_entry_id = peef.element_entry_id
    AND paaf.payroll_id = xipciv.payroll_id
    AND peef.effective_start_date BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND peef.effective_start_date BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date;
    One of the sub-view queries (they all do a similar thing) converting the data in question is:
    CREATE OR REPLACE FORCE VIEW people.xxmod_int_ee_night_allow_v (element_entry_id,
    early_hrs_to_2300,
    late_hrs_from_2300,
    pay_value,
    week_ending_date
    AS
    SELECT /*+ NO_INDEX(peev pay_element_entry_values_f_n50) */
    peev.element_entry_id, NULL, NULL, NULL,
    TO_DATE (peev.screen_entry_value, 'YYYY/MM/DD HH24:MI:SS')
    FROM pay_element_entry_values_f peev,
    pay_input_values_f piv,
    pay_element_types_f pet
    WHERE piv.input_value_id = peev.input_value_id
    AND piv.element_type_id = pet.element_type_id
    AND pet.element_name = 'Night Allowance Non MOD'
    AND piv.NAME = 'Claim Date'
    AND peev.effective_start_date BETWEEN piv.effective_start_date
    AND piv.effective_end_date
    AND peev.effective_start_date BETWEEN pet.effective_start_date
    AND pet.effective_end_date;
    I've looked for erroneous data that may be contributing towards this error but I have yet to find any.

  • Ora-00604 error and ora 01000 error while report generation.

    hi all,
    I am trying to generate the multiple reports of same template through a program.
    While this job is running, i get the following error at the BIP console and the reports don't get generated.
    [101711_044115578][][EXCEPTION] java.sql.SQLException: ORA-00604: error occurred
    at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    ORA-01000: maximum open cursors exceeded
    Kindly help.
    Thanks.

    Lots of resources with a simple search to see what this is about, for example:
    http://www.orafaq.com/wiki/ORA-01000
    ORA-01000:     maximum open cursors exceeded
    Cause:     A host language program attempted to open too many cursors. The initialization parameter OPEN_CURSORS determines the maximum number of cursors per user.
    Action:     Modify the program to use fewer cursors. If this error occurs often, shut down Oracle, increase the value of OPEN_CURSORS, and then restart Oracle.
    open_cursors parameter
    http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/initparams160.htm#REFRN10137
    Oracle support note:
    OERR: ORA-1000 maximum open cursors exceeded (Doc ID 18591.1)

Maybe you are looking for

  • Internet Explorer 4.72 and applet menu

    Hi! I've got an applet that displays a menu that redirects to other URLs when selecting a menu item. The applet only uses AWT and Menu, MenuItem and PopupMenu are used to create the menu. My problem is that together with some other sites this menu st

  • Internal order Budget KO22

    Hi, Does SAP allow business area to be entered as part of Internal order budget ? I've a requirement where IO budget are entered as per different business area in the same fiscal year.Can anyone advice whether this can be handled ? Thank you. Firefly

  • Schedule Java Stored Proc in DBMS_JOB in Oracle 9.2

    Is it possible to schedule a Java Stored Proc in DBMS_JOB? If so, any example would be helpful. Thanks Siva

  • Why ava.lang.reflect.Array.newInstance() returns Object, but not Object[]?

    It is interesting why java.lang.reflect.Array.newInstance() returns Object, but not more specific Object[]?

  • PhotoShop Elements 4 "unexpectedly quit"

    My daughter has an eMac (1.42 GHz/512/160/SD/OS 10.4) with PSE 4. It frequently quits and gives the "unexpectedly quit" message. There does not appear to be any consistent pattern as to when this will occur. Anyone have a solution for this? iMac w/In