ORA-01830: date format

Hi all

in 10.2.0.3

I have run the following query:

Select completion_time from V$ BACKUP_DATAFILE where creation_time < sysdate-10;

12/06/2013-12:39:34

12/06/2013-12:35:20

But when executing:

Select file # completion_time, blocks, block_size in V$ BACKUP_DATAFILE where completion_time > (select to_char (sysdate - 6/24, ' DD/MM/YY HH24:mi:ss') of double)

I have:

ORA-01830: date format picture ends before converting all of the input string

Thanks for help.

> where completion_time > (select to_char (sysdate - 6/24, ' DD/MM/YY HH24:mi:ss') of double)

Why you convert sysdate to a string? (and why are you selecting in double?)

Your first example he was entitled.

Did you mean this: where completion_time > sysdate - 6/24;

Tags: Database

Similar Questions

  • ORA-01830: date format picture ends before converting all of the input string

    Hi exprets. I support to the top of my operation backupset dissertation I get this error. I am looking for this error on google, they say this nls_Date_format problem. But I have set up a format and try again I encounter the same error. When I look at the new location, I see my data file backup but backup control files is not there. could someone tell me please what is the problem with that?

    Capture.JPG

    try to set the parameter as follows: export NLS_LANG = AMERICAN_AMERICA. UTF8

  • ORA-01821: date format not recognized when you use the format TSH:TZM model

    Hi all

    Running on the Oracle 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production database

    I guess I am missing something here... but the following SQL code raises the exception ORA-01821.

    SELECT to_char(CAST(to_timestamp(SYSDATE) AS TIMESTAMP WITH LOCAL TIME ZONE),'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM') as date_updated FROM DUAL;
    

    ORA-01821: date format not recognized

    01821 00000 - "date format not recognized".

    * Cause:

    * Action:

    If I change the model of TZDS or TZR time zone format... This works.

    SELECT to_char(CAST(to_timestamp(SYSDATE) AS TIMESTAMP WITH LOCAL TIME ZONE),'YYYY-MM-DD"T"HH24:MI:SSTZD') as date_updated FROM DUAL;
    

    2013-09 - 04T 13: 24:16EDT

    I need to format a date in a date in the correct format with time zone for an Atom (RFC3339) feed

    for example. 2013-09 - 04T 14: 11:09 - 05:00

    I do not know why the TZH:TZM triggers the error...

    Database NLS settings have anything to do with it?

    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

    Thanks for the help

    If you want to change the display format, can you use to_char with the expected format

    SELECT to_char (TO_TIMESTAMP_TZ (to_char (sysdate,' YYYY-MM-DD HH), "YYYY-MM-DD HH:MI:SSTZH:TZM"), "YYYY-MM-DD"T"HH:MI:SSTZH:TZM") t1d FROM DUAL;

  • ORA-01821: date format not recognized in PL/SQL report - 4.0

    Hello


    I use Apex 4.0 and I have a classic report (return of function application) which allows you to select a date column.
    The query runs in the background and gives the result.

    But when I run the report on the page, I get the error
     report error:
    ORA-20001: Error fetching column value: ORA-01821: date format not recognized
    The values for the column are like this 14-MAR-13, 01-FEB-13, etc... Everything seems to be good.

    But I don't know why this error occurs.

    Thank you
    Adkins

    Divya says:

    Yes, this is a database column, and the data type is Date.

    The I used to convert the format is to_date(inv_date,'dd-mm-yy').

    My format of the Date of the application is "DD-MON-YYYY '.

    If the column type is date, then DO NOT use to_date. To format the date, either use the format column (which is strongly recommended) or to_char mask in the query:

    to_char(inv_date, 'dd-mm-yy')
    

    It is not recommended the use of the 2-digit year formats.

  • Date value error ORA-01821: date format not recognized

    Hi team,

    will be running the query below, I'm getting ORA-01821: date format not recognized
    SELECT DISTINCT  to_date(TO_CHAR(csactivated,'DDMONRR'||'24:00:00'),'DD-MON-RR hh24:mi:ss') FROM CUSTOMER_ALL
    and I use the 10g version and I checked the NLS_SESSION_PARAMETERS. IE NLS_TIMESTAMP_FORMAT (DD-MON-RR HH.MI. SSXFF AM)
    ALTER SESSION SET NLS_TIMESTAMP_FORMAT ='DDMONRR HH:MI:SS AM';
    
    SELECT TO_DATE (TO_CHAR (TO_CHAR (SYSDATE, 'DDMONRR') || ' 14:00:00'),
                    'DD-MON-YY HH24:MI:SS')
      FROM DUAL;
    
    output : - 8/17/2012 2:00:00 PM
    

    See you soon,.
    Manik

  • ORA-01821: date format not recognized

    Hi all

    Can you help me debug this error please. It drives me crazy :(


    update inventory set decomission_date = August 19, 11 ' where ID = 100;
    *
    ERROR on line 1:
    ORA-01821: date format not recognized
    ORA-06512: at "SC. AUDIT_PKG", line 29
    ORA-06512: at "SC. AUD_INVENTORY", line 39
    ORA-04088: error during execution of trigger 'SC. AUD_INVENTORY'


    ORA-06512: at "SC. AUDIT_PKG", line 29 is:
            insert into audit_tbl values
            ( sysdate, nvl( v( 'app_user' ), user ), upper(l_tname), upper(l_cname),
              to_char( l_old, 'dd-mon-yyyy hh24:mi:ss' ),
              to_char( l_new, 'dd-mon-yyyy hh23:mi:ss' ), l_id );
    SQL> desc audit_tbl
     Name                                      Null?    Type
     ----------------------------------------- -------- ---------------
    
     TIMESTAMP                                          DATE
     WHO                                                VARCHAR2(30)
     TNAME                                              VARCHAR2(30)
     CNAME                                              VARCHAR2(30)
     OLD                                                VARCHAR2(2000)
     NEW                                                VARCHAR2(2000)
     ID                                                 NUMBER
    ORA-06512: at "SC. AUD_MDC_INVENTORY", line 39 is:
     audit_pkg.check_val( 'INVENTORY', 'DECOMISSION_DATE', :new.DECOMISSION_DATE, :old.DECOMISSION_DATE, :old.id );
    What are the causes the incorrect date format pleaseeeeeeeeee...


    Thank you very much.

    TO_CHAR (l_new, 'hh23:mi:ss of mon-dd-yyyy'), l_id);

    Looks like a simple typo - code a CM23 instead of HH24!

  • Validate the XML: DateTime-&gt; ORA-01830 / 01858

    Hello

    I'm trying to parse an XML document that contains an element which is defined as DateTime
    <CreDtTm>2012-06-02T09:30:47.000Z</CreDtTm>
    The xsd is as follows
    <xs:element name="CreDtTm" type="ISODateTime"/>
    ...
    <xs:simpleType name="ISODateTime">
      <xs:restriction base="xs:dateTime"/>
    </xs:simpleType>
    For me the format looks OK, but I get
    ORA-01830: date format picture ends before converting entire input string
    I found http://stackoverflow.com/questions/6370035/why-dbms-xmlschema-fails-to-validate-a-valid-xsdatetime/6382096#6382096
    and changed the schema:
    <xs:simpleType name="ISODateTime" xdb:SQLType="TIMESTAMP WITH TIME ZONE">
    Now, I get
    ORA-01858: a non-numeric character was found where a numeric was expected
    So I tried
    ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='yyyy-mm-dd"T"hh24:mi:ss.ff3"Z"';
    and tested
    select systimestamp from dual;
    
    SYSTIMESTAMP
    ----------------------------------------
    2012-07-27T10:52:05.860Z
    The exact format, but still ORA-01858.

    Validation is performed with
    DECLARE
      xmldoc XMLTYPE;
    DECLARE
      xmldoc XMLTYPE;
    BEGIN
        xmldoc := XMLTYPE(q'[<?xml version="1.0" encoding="UTF-8"?>
          ...
          <CreDtTm>2012-06-02T09:30:47.000Z</CreDtTm>
          ...]');
        xmldoc := xmldoc.createSchemaBasedXML('http://...xsd');
        XMLTYPE.schemaValidate(xmldoc);
    END;
    Anyone know where I am going wrong?
    select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for HPUX: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Concerning
    Marcus

    Published by: Marwim on 27.07.2012 11:45
    Addition of the db version

    Hi Marcus,

    This one is interesting.
    I had already implemented my own example shortly before posting your own, then here's something that works for me:

    BEGIN
    
      dbms_xmlschema.registerSchema(
        schemaURL => 'test_ts.xsd'
      , schemaDoc => 
    
      '
    
      
      
        
      
    '
    
      , local => true
      , genTypes => false
      , genTables => false
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
      );
    
    END;
    /
    
    SQL> DECLARE
      2    doc xmltype := xmltype('2012-06-02T09:30:47.000Z', 'test_ts.xsd');
      3  BEGIN
      4    doc.schemaValidate();
      5  END;
      6  /
    DECLARE
    *
    ERROR at line 1:
    ORA-30992: error occurred at Xpath /CreDtTm[@SYS_XDBBODY$]
    ORA-01858: a non-numeric character was found where a numeric was expected
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at line 4
    

    OK, same error so far.

    SQL> REM : change from ", " to ".,"
    SQL> ALTER SESSION SET nls_numeric_characters = '.,';
    
    Session altered.
    
    SQL> DECLARE
      2    doc xmltype := xmltype('2012-06-02T09:30:47.000Z', 'test_ts.xsd');
      3  BEGIN
      4    doc.schemaValidate();
      5  END;
      6  /
    
    PL/SQL procedure successfully completed.
    

    Now it's working.

    I know that there is an implicit conversion happening in addition to automatic mapping "dateTime"--> 'TIMESTAMP WITH time ZONE'.
    Documentation, although not very clear, seems to hint in that direction:

    With the help of Z back to indicate the time zone UTC

    XML Schema allows the time zone specified under Z, component to indicate the UTC time zone. When a leaking Z value is stored in a SQL TIMESTAMP WITH time ZONE TIMES column, the time zone is actually stored as + 00:00. Thus, the value retrieved contains the leak + 00:00, not the original Z. For example, if the value in the input XML document is 1973-02-12 T 13: 44:32Z, the output is 1973-02 - 12 T 13: 44:32.000000 + 00:00.

    So I think that Oracle is attempting to expand "2012-06 - 02T 09: 30:47.000Z" at "2012-06 - 02 T 09: + 00:00 30:47.000000"but relying on the NLS configuration session to determine the decimal separator used in the fractional part of timestamp.»

  • Error ORA-01830 drives me crazy

    I've not found anything relevant online to my question so I'll try here. To set this up, I'm still in the learning I'll phase of Oralce, so be gentle please.

    I run this query:

    Update fascor_load
    Set order_status_id = 18
    where load_date < to_date('06-APR-01','DD-MON-YY');.

    He has in turn triggers:

    create or replace
    relaxation Fascor_Load_BUR
    before the update on Fascor_Load
    for each line

    declare
    closed whole;
    Date of Current_Date_Time;

    Start
    Select order_status_id from firm order_status where description = "CLOSED";
    Select to_char (sysdate,' HH24 LUN-JJ-AA "") in the double Current_Date_Time;

    If: old. Order_Status_ID <>: new. Order_Status_ID and
    : new. Order_Status_ID = closed and
    : new. Load_Completion_Date is null then

    -Insert Current Date/time in the field of Load_Completion_Date
    : new. Load_Completion_Date: = Current_Date_Time;
    end if;
    end;


    When you run the query, I get:


    ************************************************************
    Error from the 1 in the command line:
    Update fascor_load
    Set order_status_id = 18
    where load_date < to_date('06-APR-01','DD-MON-YY')
    Error report:
    SQL error: ORA-01830: date format picture ends before converting all of the input string
    ORA-06512: at "EIS_EMERY. FASCOR_LOAD_BUR', line 7
    ORA-04088: error during execution of trigger ' EIS_EMERY. FASCOR_LOAD_BUR'
    01830 00000 - "date format picture ends before converting all of the input string.
    * Cause:
    * Action:
    *************************************************************

    Someone has ideas on what exactly the cause this problem? I thought that perhaps that is the data type of Load_Completion_Date, which is of type 'Date', so I dropped the column and then tried to add it again but this time by putting a mask on it, but it would not get in shape the type date when adding the column.

    I'm lost on this and it seems to simple.

    927300 wrote:
    For me, the result is:

    18 APRIL 12

    Select TO_CHAR (sysdate,'YYYY-MM-DD HH24:MI:SS) twice;

    do high instead
    It is strictly a matter of presentation of data; also known as the formatting!

  • date format picture ends before converting all of the input string

    In the following query, I get the error: ORA-01830: date format picture ends before converting all of the input string

    Select sum (e.gl_fig) in the rm_gl e where e.as_on_dt < = trunc (to_date('31-Nov-2011'), 'Q')-1

    Hello

    Moreover, how many days are there in November? It IS 30 or 31?

    Please change from 31-Nov-2011 to November 30, 2011, then it works.

    select sum(e.gl_fig) from rm_gl e where e.as_on_dt <= trunc(to_date('30-Nov-2011', 'DD-MON-YYYY'),'Q')- 1
    
  • insertion error - date format picture ends before the conversion while

    My system: I use of Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product with SQL * more: Release 10.2.0.1.0 and the first thing I've done in this project is a user account configuration especially for her through Application Express 2.1.0.00.39 with all permissions and then connected with SQL * more and seized command and run scripts on it since.

    I got the following error was in a previous project, but I don't have the result of it so I don't know how much he touched me. We can not always distribute perfect projects so I could live with that. It is that this new project is the first that start from a previous one have of course, I still have the error so I think they'll be less forgiving of mistakes that I had more time to work on it. However, after hours of research & debugging tests I still cannot do things.

    I read on sites in development more than a couple that we should not rely simply on inputs of channel inserts on dates where there is incompatibilities with nls_date_format and based instead on TO_DATE. This seems logical and I have no problem of implementation, but there is a problem running it. :|

    The following is an excerpt from my project bringing the error that I need to move.
    Thank you so much for your help
    DynV

    H2.
    code

    ALTER SESSION SET nls_date_format = "DD/MM/YYYY";
    DROP TABLE EMP;

    CREATE TABLE EMP
    (
    NOEMP INTEGER NOT NULL PRIMARY KEY,
    NAME VARCHAR (15) NOT NULL,
    FIRST NAME VARCHAR (15) NOT NULL,
    NOFONCTION INTEGER NOT NULL,
    DATEEMBAUCHE DATE,
    SALARY INTEGER NOT NULL,
    NODEPT INTEGER NOT NULL-,
    -FUNCTION REFERENCES FOREIGN KEY (NOFONCTION),
    -FOREIGN KEY (NODEPT) REFERENCES DEPT
    );

    -NoEmp, name, NoFonction, DateEmbauche, NoDept, salary
    INSERT INTO VALUES EMP (1230, "DAHER", "ERIC", 1, TO_DATE (DECEMBER 17, 1997 ',' DD/MM/YYYY ""), 40, 20000);
    INSERT INTO VALUES EMP (3235, "LEMAY", "PATRICK", 3, TO_DATE (FEBRUARY 20, 1982 ',' DD/MM/YYYY '), 20, 3500);

    H2.
    result

    Modified session.

    Table created.

    INSERT INTO VALUES EMP (1230, "DAHER", "ERIC", 1, TO_DATE (DECEMBER 17, 1997 ',' DD/MM/A))
    YY'), 40, 20000)
    *
    ERROR on line 1:
    ORA-01830: date format picture ends before converting all of the input string

    INSERT INTO VALUES EMP (3235, "LEMAY", "PATRICK", 3, TO_DATE (FEBRUARY 20, 1982 ',' DD/M))
    M/YYY'), 20, 3500)
    *
    ERROR on line 1:
    ORA-01830: date format picture ends before converting all of the input string

    H1.
    solution

    The Xgc of channel for the IRC server freenode user [#sql | irc://freenode/%23sql] had me I was using 3 characters for my picture/mask/filter /... instead of the 4 that taking data. then they became "JJ/M".
    M/YYYY "."

    How small error but with such devastating consequences.

    Published by: user13420426 on December 6, 2010 01:39

    You're 1 shy O.

    TUBBY_TUBBZ?select TO_DATE('17/12/1997', 'DD/MM/YYY') from dual;
    select TO_DATE('17/12/1997', 'DD/MM/YYY') from dual
                   *
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire input string
    
    TUBBY_TUBBZ?select TO_DATE('17/12/1997', 'DD/MM/YYYY') from dual;
    
    TO_DATE('17/12/1997'
    --------------------
    17-DEC-1997 12 00:00
    
    1 row selected.
    
    TUBBY_TUBBZ?
    

    Notice how I YYYY where you YYY.

  • ORA-01830 during an attempt of incomplete recovery

    Hi guys,.

    I practice the incomplete recovery but my RMAN script fails with the following error:
    ORA-01830: date format picture ends before converting all of the input string

    Here's the RMAN script

    RUN
    {
    May 7, 2010 until 05:00 ";
    restore the database;
    recover the database;
    ALTER database open resetlogs;
    }

    My NLS_DATE_FORMAT has the value
    * # env | grep-i nls *.
    * # NLS_DATE_FORMAT = HH24:MI:SS * MON-DD-YYYY

    Linux x 86, Oracle 10.2.0.4

    In your case, case issues (my output is in windows, but should be the same on linux)

    SQL> alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';  -- sqlplus can handle uppercase
    
    Session altered.
    
    SQL> select sysdate from dual;
    
    SYSDATE
    --------------------
    07-MAY-2010 22:27:14
    
    ### but your environment is less forgiving  ###
    
    C:\Documents and Settings\User>set nls_date_format=DD-MON-YYYY HH24:MI:SS
    
    C:\Documents and Settings\User>rman target /
    
    Recovery Manager: Release 10.2.0.1.0 - Production on Fri May 7 22:24:47 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    connected to target database: PTS (DBID=774850390)
    
    RMAN> RUN
    2> {
    3> set until time '07-MAY-2010 05:00:00';
    4> }
    
    executing command: SET until clause
    using target database control file instead of recovery catalog
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of set command at 05/07/2010 22:25:09
    ORA-01830: date format picture ends before converting entire input string
    

    Now let's see what happens when I put the NLS_DATE_FORMAT correctly:

    C:\Documents and Settings\User>set nls_date_format=DD-MON-YYYY hh24:mi:ss
    
    C:\Documents and Settings\User>rman target /
    
    Recovery Manager: Release 10.2.0.1.0 - Production on Fri May 7 22:25:36 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    connected to target database: PTS (DBID=774850390)
    
    RMAN> RUN
    2> {
    3> set until time '07-MAY-2010 05:00:00';
    4> }
    
    executing command: SET until clause
    using target database control file instead of recovery catalog
    

    Now, usually when I write RMAN scripts I'll put the nls_date_format there it will always be good for the rman session:

    run {
    set until time "to_date('07-MAY-2010 05:00:00','dd-mm-yyyy hh24:mi:ss')";
    }
    
  • ORA-01830/ora-1839

    Hi I have a requirement as to join the date and month of a single parameter and the year of another parameter


    Select TO_DATE (TO_CHAR(:DATE_OF_BIRTH,'DD-MON-') |) To_char(:L_DATE,'RRRR'), 'DD-mon-RRRR') of the double

    Since I have error: ORA-01839: date not valid for the specified months, I changed as below:
    pass on February 29, 2008 for date of birth and may-01-2009 for l_date

    Select ADD_MONTHS (TO_DATE (TO_CHAR (ADD_MONTHS(:DATE_OF_BIRTH,-1), 'DD - MON-') |)) (To_char(:L_DATE,'RRRR'), 'DD-mon-RRRR'), 1) of the double

    now, I get the error message: Ora-01830
    ORA-01830: date format picture ends before converting all of the input string
    When I spend 30-mar-2008 to the date of birth and may-01-2009 for l_date

    Select ADD_MONTHS (TO_DATE (TO_CHAR (ADD_MONTHS(:DATE_OF_BIRTH,-1), 'DD - MON-') |)) (To_char(:L_DATE,'RRRR'), 'DD-mon-RRRR'), 1) double.

    I want a solution to fix two errors

    Assuming for date of birth February 29 and l_date as a non-leap year, you want to return on February 28:

    SET VERIFY OFF
    WITH T AS (
               SELECT  TO_DATE('&DATE_OF_BIRTH','DD-MON-YYYY') DATE_OF_BIRTH,
                       TO_DATE('&L_DATE','YYYY') L_DATE
                 FROM  DUAL
              )
    SELECT  ADD_MONTHS(DATE_OF_BIRTH,(TO_CHAR(L_DATE,'YYYY') - TO_CHAR(DATE_OF_BIRTH,'YYYY')) * 12)
      FROM  T
    /
    Enter value for date_of_birth: 29-feb-2008
    Enter value for l_date: 2009
    
    ADD_MONTH
    ---------
    28-FEB-09
    
    SQL> /
    Enter value for date_of_birth: 29-feb-2008
    Enter value for l_date: 2012
    
    ADD_MONTH
    ---------
    29-FEB-12
    
    SQL> /
    Enter value for date_of_birth: 25-may-2008
    Enter value for l_date: 2009
    
    ADD_MONTH
    ---------
    25-MAY-09
    
    SQL> 
    

    SY.

  • convert a date format pl/sql...

    I have a .net code that generates a sql string...
    I'm having some trouble getting the date right formats...

    Here's my statement from pl/sql

    SELECT * FROM VIEW_ASSETCURRENT_DESTID
    WHERE ROWNUM < 5000
    and 1 = 1
    AND HDate > = to_date ('2009-05-11 11:31:45 "," MM/DD/YYYY HH24')
    AND HDate < = to_date ('2009-05-12 11:31:45 "," MM/DD/YYYY HH24')

    I get an error saying
    ORA-01830 date format picture ends before converting all of the input string

    what I am doing wrong?

    I hope this helps.

      SELECT * FROM VIEW_ASSETCURRENT_DESTID
       WHERE ROWNUM < 5000
         and 1=1
         AND HDate >= to_date('05/11/2009 11:31:45 AM','MM/DD/YYYY HH:MI:SS AM')
         AND HDate <= to_date('05/12/2009 11:31:45 AM','MM/DD/YYYY HH:MI:SS AM')
    

    or this

      SELECT * FROM VIEW_ASSETCURRENT_DESTID
       WHERE ROWNUM < 5000
         and 1=1
         AND HDate >= to_date('05/11/2009 11:31:45','MM/DD/YYYY HH24:MI:SS')
         AND HDate <= to_date('05/12/2009 11:31:45','MM/DD/YYYY HH24:MI:SS')
    
  • Bug - import drop of time - data format literals?

    SQL Developer 4.1 ai2

    If I put in place an import of data using INSERTs and specify a format string for a timestamp field that includes literals, these removed in the instructions for INSERTING generated resulting:

    Format: YYYY-MM-DD "T" HH24:MI:SS. " FF3 ""-07:00 " "

    Data_Import_Wizard_-_Step_4_of_5.png

    INSERT resulting:

    Oracle_SQL_Developer____var_folders_py_jrrk_5490y95w7816tzqbygm0092f2_T_Import-phys-reqs-by-user-time-tsv_1_sql.png

    Get the recitals:

    SQL error: ORA-01821: date format not recognized

    Set the format:

    Oracle_SQL_Developer____var_folders_py_jrrk_5490y95w7816tzqbygm0092f2_T_Import-phys-reqs-by-user-time-tsv_1_sql.png

    Works as it should:

    1 row inserted.

    (I know I'm butchering the timestamp/zone - that is by the by ;-)) )

    We were stripping the quotes of the mask of date format for a reason-this problem has been fixed

  • Receive error message when calculating the two fields with different date format

    I'm more familiar with SQL Server and Oracle, then after a search online without success, I ask here.

    I use developer PL/SQL with DB Oracle 11g Release 11.2.0.2.0 Enterprise 64-bit

    MyTable:

    ID_Number VarChar2

    Date of Date_Received

    Select ID_Number,

    Date_Received,

    To_Date (substr (ID_Number, 1.6), "YYMMDD") SentDate,.

    Date_Received - NumDays To_Date (substr (ID_Number, 1.6), "YYMMDD")

    FROM MyTable

    Where substr (ID_Number, 7.3) in ('ABC', 'ABD')

    and length (Trim (translate ((substr (ID_Number, 1,6)), '0123456789',' '))) a null value

    ID_Number Date_Received SentDate NumDays

    131002ABC1654106 10/16/10/2013-2013 14 2

    131004ABD8813899 4/12/2013-4/8/2013 4

    131014ABD1844832 10/16/10/14 OF 2013-2013 2

    Sometimes the first 6 characters in the ID_Number aren't the numbers and length (Trim (translate deletes records))

    I want just the records where NumDays > 2

    I tried to put the request in a subquery and using where NumDays > 2 outside.  I also tried using the calculation directly in the Where clause.  Without it in Where clause it works very well, with him in a place, I get the following error:

    ORA-01931: Date format picture ends before converting all of the input string


    I don't know how to put the two dates in the same format.  I tried to declare the format without result.  I don't understand how I can calculate in the selection, but do not use the same calculation in Where clause.

    Thank you for your help.

    Hello

    SQL is a language to describe the desired results.  How the system gets these results belongs to you don't have much say about which conditions will be applied when.

    One place where you can control the order of things is a CASE expression.  When you say

    CASE

    WHEN condition_1

    THEN expression_1

    END

    You can be sure that expression_1 will be evaluated only when cond_1 is set to TRUE.

    Try something like this:

    WITH got_sent_date AS

    (

    SELECT id_number, date_received

    CASE

    WHEN the TRANSLATION (SUBSTR (id_number, 1, 6)

    , 'x' 0123456789 '.

    , 'x'

    ) IS NULL

    THEN TO_DATE (SUBSTR (id_number, 1-6)

    , "YYMMDD".

    )

    END AS sent_date

    FROM MyTable

    WHERE (id_number, 7, 3) SUBSTR ("ABC", "ABD")

    )

    SELECT id_number

    date_received

    sent_date

    , date_received - sent_date AS num_days

    OF got_sent_date

    WHERE date_received > sent_date + 2

    ;

    If you would care to post some sample data (CREATE TABLE and INSERT statements) and the results desired from this data, I was able to test this.

    Of course, you'll still errors of execution if id_number starts with 6 digits, but they do not have to be valid, for example '131100' or '130229'.  This is one of the reasons why the date information storage in VARCHAR2 columns are a bad idea.  To work around this problem, see

    https://forums.Oracle.com/message/4255051

Maybe you are looking for

  • Yahoo mail gives unreliable connection error

    When I log into Yahoo mail on Firefox 40.0.3 (on Windows 7) on my laptop provided by company, I get this message:"You asked Firefox to connect safely to we - mg5.mail.yahoo.com, but we cannot confirm that your connection is secure." I can't create an

  • Thunderbird deletes all emails at random times, but is set to "never erase" them.

    He always removes them when the program is closed and sometimes when it is minimumized. Also deleted the file archives. Most seem to be in the "basket", but not all. It started at the last update.

  • Boot SSD eSATA Y560

    Hello Just installed Windows XP on my OCZ SSD that was installed in my desktop pc. I used it on my pc Windows 7 to start XP just to play a few games that will not work under Windows 7. I removed the SSD drive and now use it on my laptop Y560. The dri

  • Moving files from an external hard drive to my computer

    I'm trying to move files from a disk external HARD connected to a router on my pc, and whenever I try to do the system show me a window with this message. IO error 0x8007045D error, I see a permission problem, then I configured for the 'Full' destina

  • Documentation of Custom Agents in development

    Are there documents specifically on the creation of custom agents and/or by creating the data model to host the data for these agents?  I understand that you can write about any script that collects data, but I don't understand how to set the data mo