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')

Tags: Database

Similar Questions

  • Date format string SQL Conveting XML

    Hi all
    I have a question where a date that comes as input to a string format must be inserted into a database is Timestamp. Can someone help me on this...

    the date format which I recive is '2008-08-01' where "yyyy-MM-DD" I have to convert it in the format "YYYY-MM-ddTHH" Help with this convert Timestamp would be a great help.

    Hi Sissi,
    Please use the format-dateTime function in xslt and to generate the time portion of the date, use the '00' instead of hh, mm, and ss. This function automatically converts an XML datetime SQL string.

    The function will look like this - dateTime(YYYY-MM-DDT00:00:00) format.

    Concerning
    AYUSH

  • Convert a Date Format data in a different Format of Date

    I'm trying to convert a date field (Text1-29), which is in the format "yyyy/mm/dd", and move it to the data in another field (text-DOB), which is in the format "mmmm dd, yyyy'."

    I tried various methods, such as the following, but without success. Any suggestions?

    getField("Text-DOB").value = util.scand ("mmmm dd, yyyy", (getField("Text1-29").value);)

    To reformat a date string, first convert the string into a JavaScript date object and and then format this date object as needed.

    Console.Show (); Console.clear();
    Disable the default result field
    Event.value = ";
    get the string from the date of entry
    var sText1_29 = this.getField('Text1-29').value;
    process if there is data
    If (sText1_29.toString ()! = ") {}
    Console.println ("sText1_29:" + sText1_29);
    convert JavaScript Date object
    var oText1_29 = util.scand ("yyyy/mm/dd ', sText1_29");
    Console.println ("oText1_29:" + oText1_29);
    convert the object date JS to the new format
    var sDOB = util.printd ("mmmm dd, yyyy', oText1_29");
    Console.println ("sDOB:" + sDOB);
    Event.Value = sDOB;
    }

  • How can I get this date format

    I want to convert my date format to

    YYMMDDHHMMSS
    so lets say
    Select (sysdate YYMMDDHHMMSS) format_date of double

    out put
    090612040957
    help please

    Published by: kama021 on June 13, 2009 09:05

    Published by: kama021 on June 13, 2009 09:06
    SQL> select to_char(sysdate, 'YYMMDDHH24MISS') from dual;
    
    TO_CHAR(SYSD
    ------------
    090613180705
    
  • Sort data in date format DD/MM/RRRR

    Hello

    I have to sort our data between two dates ex 01 01, 2016 to the 31/01/2016 for the list of transactions.

    Will I convert in JAN-16 format so that I can sort by where period_name like ' JAN-16'?

    If so how do I convert a date format of 01/01/2016 JAN-16?

    Thank you

    Hello

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    As Chris and Tubby has said, all DATEs are stored in the same internal format, which has nothing to do with the format you use to view or format you use in conversion as TO_DATE functions.

    Oracle provides many functions and other features for the manipulation of DATEs, you seldom need to convert them to another format.  For example, we wanted to get a list of employees of the scott.emp sorted by month and by ename; in other words, December 1980 would come before April, 1981, as from habit, but the day of the month, hours minutes and seconds would all be ignored in sorting.  We can use the TRUNC function to do this:

    SELECT TO_CHAR (hiredate, 'Mon-YYYY') AS hiremonth

    ename

    hiredate

    FROM scott.emp

    ORDER BY TRUNC (hiredate, 'MONTH')

    ename

    ;

    Output:

    HIREMONTH ENAME HIREDATE

    ---------- ---------- -----------

    DEC-1980 SMITH December 17, 1980

    Feb-1981 ALLEN 20 February 1981

    Feb-1981 WARD 22 February 1981

    Apr-1981 JONES April 2, 1981

    May-1981 BLAKE may 1, 1981

    Jun-1981 CLARK June 9, 1981

    MARTIN 1981-Sep 28-Sep-1981

    Sep-1981 TURNER 08-Sep-1981

    Nov-1981 KING November 17, 1981

    DEC-1981 FORD December 3, 1981

    DEC-1981 JAMES December 3, 1981

    Jan-1982 MILLER January 23, 1982

    Apr-1987 SCOTT April 19, 1987

    May-1987 ADAMS 23 May 1987

    Notice how MARTIN comes before TURNER in the output (I marked these Redlines), even if MARTIN hiredate is 20 days later than TURNER.  This is because only the year and month are considered in the sorting.  Any DATE in the same month will get the same sort value.

  • date format conversion

    Hello

    I have the date format in the table as below and now I need to convert the date format YYYY-MM-DD hh: mm :)

    data type of column is varchar2 (20)

    1993-06-24 - 14.15.06.785408 (note: hours, minutes, seconds, milliseconds are separated by.) (dot)

    1991-11-05 - 11.32.17.045702

    Can someone help me please.

    Thank you!

    Hello

    3058870 wrote:

    Hello

    I have the date format in the table as below and now I need to convert the date format YYYY-MM-DD hh: mm :)

    data type of column is varchar2 (20)

    1993-06-24 - 14.15.06.785408 (note: hours, minutes, seconds, milliseconds are separated by.) (dot)

    1991-11-05 - 11.32.17.045702

    Can someone help me please.

    Thank you!

    Do not store information on dates in a VARCHAR2 column. It's simply to request data not valid, complicated, inefficient code and runtime errors.  The columns DATE, or, if necessary, fractions of a second TIMESTAMP.

    To convert strings from one format to another, you can always use TO_DATE to convert any format they are dates and then use TO_CHAR to generate a new string, in any desired output format.

    In this case, it seems that you just want to lose the split second, change the 3rd indent to a space and change points to colons.  You can do the following:

    SUBSTR (datatype, 1, 10).

    ' '                      ||

    REPLACE (SUBSTR (datatype, 12, 8)

    , '.'

    , ':'

    )

    If you would care to post CREATE TABLE and INSERT statements for some sample data and accurate results, you want from these data, then I could test this.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

    You could do all the work in a single call REGEXP_REPLACE, but it is probably more complicated and less effective.

  • Date formats BI Publisher

    Hello

    I'm trying to convert a date format DD-MM-YYYY 20100910, is possible to change this format in the model. I tried to change the model of data using query:

    TO_DATE (date_field, ' YYYY-MM-DD ""), but this means no data returned by the query.

    Can anyone help with date formats?

    Thank you

    Given that your date is 20100910 format, you can use

    TO_CHAR (to_date(date,'YYYYMMDD'), 'DD-mon-YYYY') at the db level

    or

    to_date(date,'YYYYMMDD') in your query
    and use in RTF

  • convert the data in the Format of Date imported from MS SQL Server.

    I imported data from MS SQL Server. The column 'Date' received in digital format as 41017.6361109954. How can I convert Date in Oracle SQL.

    If I import the same data in Excel and you change the Type of column to this day. He passes. But in Oracle, I tried the To_Date function with different parameters, but it did not work.

    Published by: XAVER 22 April 2012 02:31
    select timestamp '1970-01-01 00:00:00' + numtodsinterval(41017.6361109954,'day') from dual;
    
    TIMESTAMP'1970-01-0100:00:00'+NUMTODSINTERVAL(41017.6361109954,'DAY')
    ---------------------------------------------------------------------------
    20-APR-82 03.15.59.990002560 PM
    
    SQL> 
    

    SY.

  • Convert the Period_Name in GL_JE_Lines table to a date format and then come back year

    I'm working on a data model BI Publisher and I try to convert the Period_Name in GL_JE_Lines table to a date format and then return of the year.

    The sql below works in 11i, but I can't make it work in Fusion.

    to_char (to_date (l. )) period_name , ' MON-RR ' ),'YYYY')

    Any ideas?

    Hi Jennifer,.

    To_char (sysdate, 'DDMONYYYY') in BI Publisher does not return a correct results due NLS_DATE_FORMAT/DATE_LANGUAGE settings.

    According to the standards of the I18N, NLS_DATE_LANGUAGE in the database is still hardcoded to NUMERIC_DATE_LANGUAGE. NUMERIC_DATE_LANGUAGE 'MY' in a date format mask is an integer, so you see the correct value.

    You're not supposed to publish direct SQL with fixΘe format masks (unless it's some sort of canonical format used in internal processing, including the end-user will not be), you should return language digital date to the mid range and then make the formatting of y.

    Workaround

    Try adjusting the NLS_LANGUAGE in SQL data model to override formatting from of the

    Data base and values of the Session, for ex: select to_char (sysdate, 'MON-DD-YYYY', 'NLS_DATE_LANGUAGE = AMERICAN') of double;

    I got this Oracle support after lifting a SR.

    Thank you

    Rahul.

  • convert date format period

    Hi all

    Here are my existing query which I run another tool to extract data from oracle-

    Select * from transactionTbl

    WHERE

    DATE > = TO_DATE (' $(vAppStartDate)', "DD/MM/YYYY")

    AND DATE < = TO_DATE (' $(vAppEndDate)', "DD/MM/YYYY")

    variables-

    -vAppStartDate = 06/01/2014

    -vAppEndDate = 30/06/2015

    Rather than use the Date column in the WHERE condition, I want to use PeriodID of column existing in the same table, to make the query faster.

    The period column is in below format.

    PeriodID format-> 201294 //means 2012Q 4. So 9 means Q

    Since I'm on variables, the values are always to the date format, so my requirement is first change variable date from periods of format.

    I wrote the pseudo-code, because I of course know how to convert date format periodID. Q also means in the periodID 9.

    Select * from transactionTbl

    WHERE

    PeriodID > = period_function (TO_DATE (July 1, 14 ',' DD/MM/YYYY '), 'YYYYxx')

    AND PeriodID > = period_function (TO_DATE (July 1, 15 ',' DD/MM/YYYY '), 'YYYYxx')

    Please help me with the query.

    Thank you!

    Calling a user-defined function is likely to slow down your query.

    What's the problem with just using regular date formatting strings for example

    SQL > select to_char (to_date('15/09/2014','DD/MM/YYYY'), 'YYYY "9" Q') of double;
    TO_CHA
    ------
    201493

    1 selected line.

  • Convert date format timestamp format

    Hello, I have the following code in * impl.java in the doDML method. I'm getting "invalid column type" at run time, but when I click on insert. I think that the problem is because I do not convert the timestamp format format date correctly. Any help please?

    CallableStatement cs1 = null;

    try {}

    / * Some code here * /.

    d = new java.sql.Date java.sql.Date (this.getRbcDtFrom () .getTime ());

    CS1. SetDate (2, d);

    java.sql.Date d1 = new java.sql.Date (this.getRbcDtTo () .getTime ());

    CS1. SetDate (3, d1);

    CS1. SetString(4,"RBCS");

    CS1. SetString (5, this.getRbcCode ());

    CS1.setInt (6, getRbcCounter ());

    CS1. ExecuteUpdate();

    Boolean ValeurRet = cs1.getBoolean (1);

    If (retvalue)

    {

    super.doDML (operation, e);

    }

    else {}

    System.out.println ("no Commit!");

    }

    } catch (SQLException f) {}

    throw new Aexception.getLocalizedMessage (f);

    }

    You did not created wrapper fucntion.

    Take a look at:

    Troubleshooting

    Use the same principle for the registered function...

  • Convert number to date format

    HI team,

    I have a problem, how we can convert number in date format?
    This is the result of the query.

    SQL > col START_TIME for 999999999999999999999999
    SQL > select start_time in qrtz_triggers;

    START_TIME
    -------------------------
    1364243906000
    1364589406000

    So, I have to change the date format niumber rto.

    My date format as for example: "" Mar 25,2013 20:36:45 ""


    Please suggest me...
    Thank you
    Chavigny

    Published by: 939938 on March 14, 2013 06:39

    This is the number of milliseconds since January 1, 1970.

    SQL> SELECT to_char(to_date('01/01/1970','mm/dd/yyyy')+1364243906000/24/60/60/1000
      2  ,'Mon dd, yyyy hh:mi:ss PM') FROM dual;
    
    TO_CHAR(TO_DATE('01/01/1970','
    ------------------------------
    Mar 25, 2013 08:38:26 PM
    

    So in your query instead of start_time use
    TO_CHAR (to_date (' 01/01/1970 ',' mm/DD/yyyy') + start_time/24/60/60/1000,' Mon DD, YYYY HH: mi: ss PM "")

    Published by: kendenny on March 14, 2013 08:31
    Had used mm instead of e for the minutes.

  • How to convert Date format in the Apex?

    Hi all

    I created an element of Apex Date Picker as "yyyy-mm-dd", now when they select this date picker, that must be converted in "day, month, DD, YYYY".
    I trired like that but it does not work, can anyone help me to find things to do.

    Under article, we have free will.

    Default value: to_char (to_date (: P1_ENG_DATE, 'dd-mm-yyyy'), ' day, month DD, YYYY ")
    Deafult value as type - PL/Sql.

    Thanks,
    David...

    Hello

    You can set the date format level of application, then you don't need to specify the format each time.

    for this go to "Modify the Application Properties"-> globalization

    Here you can specify the format of date of application.

    Thank you
    Tauceef

  • convert date format dd.mm.yyyy jj.mm.AA

    Hi all

    My need is to convert date format dd.mm.yyyy jj.mm.AA. All years are 1999 or less. My first assumption is to use the combination of substr with concatination of '19', but maybe someone can suggest another decision.
    select '18.03.97' as dt from dual

    You can do this:

    SQL> select to_char(to_date('18.03.97','dd.mm.rrrr'),'dd.mm.rrrr') Result from dual;
    
    RESULT
    ----------
    18.03.1997
    
  • Date format SQL Loader

    Hello everyone

    I have 2 questions for charger

    (1) I need to convert the date value in the csv file, column called closed_date and the value of the time to come as null and sometimes 20101122 22:12:07. I want to insert 'YYYYMMDD HH24:MI:SS' this format.

    (2) when I try I load the clob data type column using sql loader its give without endpoints found for this column.

    Could you please advice.

    Thank you
    Bhavana

    user13689917 wrote:
    Hello

    I am getting error below.

    column AUTHOR_CLOSED_DATE.
    ORA-01841: (full) year must be between-4713 and 9999 and not 0

    In the CSV file the AUTHOR_CLOSED_DATE value is a string NULL.

    Which seems to indicate that data in the file (at least a part of it) does not follow the format you specified in your control file (and is NOT NULL).

    Check the data (original file) as well as SQL loader logs.

Maybe you are looking for

  • Why a case without a title opens whenever I start Firefox?

    even if I delete the folder without a title from the office, he appears again when I open or reopen FireFox How can I prevent this keep happening?

  • Yet Mini WT7-C-100 - how to boot from the boot of SD card

    Hello guys, I have toshiba still wt7-c-100 mini with 10 GB hard drive. My question is how I can install Android x 86 on this tablet, because when I attach my micro sd card (witch has an image burned to 4.4x86 android) does not appear in the start men

  • HP Envy m7: HP Udate

    In HP Support Assistant: HP Intel Bluetooth update driver for Microsoft: sofpaq75360 18, 116053087Opi size 16,33 MB version This package contains the installation package driver for the Bluetooth from Intel in the models of laptop support and operati

  • start reading at the beginning few visa

    Hello! I'm doing a thet thet data readings program a GPS is written to a serial port and then store in a file. As an extra thing, I'm trying to add thet part finds the correct serial port the GPS is connected to and then automatically uses this port

  • Cannot Get Serial Port to operate in virtual XP Mode of Windows (operating system is Windows 7 Prof SP1)

    I have a data record meter Extech quite expensive. The software so that it runs only on a PC running XP or by loading the software in virtual XP mode on a computer with Win7. The software works OK in virtual XP mode, and I can open previously saved d