Converting Varchar2 to date is prob

Hello guys
My column contains in fact date in the following format
JJ/mm/aaaa
I'll try this query to update in
something like
dd/mm/yyyy HH24:MM:SI
When I use the SELECT statement, it worked fine but when I update the column there
say not one month valid
Please look at the querys
select to_Char(to_date(create_date,'mm/dd/yy HH24:MI:SS'),'mm/dd/yyyy HH24:MI:SS') 
from Report
where trunc(Load_Date) = trunc(sysdate - 52)
--WorkingFine
--but this one not its getting updated no issue in update statment.
Update Report
Set Create_date = to_Char(to_date(Create_date,'mm/dd/yy HH24:MI:SS'),'mm/dd/yyyy')
where trunc(Load_Date) = trunc(sysdate - 52)
{Code}
Here is my sample data
date of creation
16/09/2009
15/09/2009
and so on
The create date column is in Varchar2 type
Please help dun knw wat i am doing wrong
any suggestion will be appreciated
Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

If you want this format (mm/dd/yyyy HH24.MI:SS) after updating the table, your update to be:

Update Report
Set Create_date = to_Char(to_date(Create_date,'mm/dd/yy HH24:MI:SS'),'mm/dd/yyyy hh24:mi:ss')
where trunc(Load_Date) = trunc(sysdate - 52)

Max

Tags: Database

Similar Questions

  • Problem converting varchar2 to date data type

    Hi all

    I am facing a problrm when writing a query to extract a SIT of all employee details in which I compared the "sysdate" with a column of type "varchar2" of the table SIT. I get the following error ORA-01841: (full) year must be between-4713 and 9999 and not 0 and the execution of the query
    ++++++++++++++++++++
    SELECT papf.person_id,
    WOMEN'S WEAR. Employee_number,
    PAPF.full_name,
    CAP. Work_permit_type Segment2,
    PAC.segment7 visa_expiry_date
    OF per_all_people_f women's wear.
    per_person_analyses App,
    per_analysis_criteria CIP,
    fnd_id_flex_structures_tl fifst,
    fnd_id_flex_structures FIFS
    WHERE papf.person_id = ppa.person_id
    AND BETWEEN TRUNC (SYSDATE) papf.effective_start_date
    AND papf.effective_end_date
    AND papf.current_employee_flag = 'Y '.
    AND ppa.analysis_criteria_id = pac.analysis_criteria_id
    AND pac.id_flex_num = fifs.id_flex_num
    AND fifst.id_flex_structure_name = 'THE SIT NAME'
    AND fifst.language = USERENV ('LANG')
    AND fifst.application_id = fifs.application_id
    AND fifst.id_flex_num = fifs.id_flex_num
    AND TO_DATE (pac.segment7,'YYYY/MM/DD HH24:MI:SS') > = trunc (sysdate)
    AND papf.employee_number = '9127327':
    +++++++++++++++++++++++++++++++++++++

    The strange thing is the query above works fine witout the last filter condition (AND papf.employee_number = '9127327') but get the mentioned error i.e ORA-01841: (full) year must be between-4713 and 9999 and not 0 with the State.

    Could someone help me on this?

    Published by: Kumar Koch on 4 December 2012 02:58

    Hello world...

    Thank you for your support.

    What some, I have maneged to get the result by adding an additional filter to condtiotn with the request in the form beloew.
    ({AND REGEXP_LIKE (pac.segment7,'[0123456789]{4}/[0123456789]{2}/[0123456789]{2}')
    }

  • Convert char to date format in obiee 11g?

    Hello

    I want to convert char to date format in obiee 11g.

    I have this date

    ' 07/31 /' | CAST (YEAR (CURRENT_DATE) AS CHAR)

    I want to change the tank to the date format.

    Please help me,

    Thanks in advance,

    A.Kavya.

    Below him is based on my date format NLS source Oracle database as DD-MON-RR (query on the database - SELECT * > OF nls_database_parameters WHERE the PARAMETER = "NLS_DATE_FORMAT").

    Note that this is not altered by the connection of the RPD pool, which is common.

    If the date that I put together for substrings and Casts a match before it can be LAUNCHED as a DATE. IE 31 July 15 etc.

    Steps to follow:

    -Drag a field to the report, one

    -Change the formula

    -Paste in

    CAST ("31 - Jul -" |) SUBSTRING (CAST ('F_PL_BAL'. ' BUSINESS_DATE ' AS CHAR) FROM 8 TO 2) AS DATE).

    -OK

    -See the results

  • Import excel should allow space in a column during the use of media: the value class coldfusion.sql.QueryColumn can not be converted to a date

    I followed the pretty good learncfinaweek and can see no error in my code.   Here is the error, that should solve and the page with the code.  Any help is appreciated.  This should be quite simply like this: < cfset blogPost.dateposted = importData ["posted Date"] / >, which allows the column in excel with a space between words.

    Good: dateposted - the coldfusion.sql.QueryColumn class value cannot be converted to a date.

    Root cause: org.hibernate.HibernateException: property: dateposted - the coldfusion.sql.QueryColumn class value cannot be converted to a date



    "< cfimport taglib ="... /... "/ customTags" prefix = "ct" / >

    < ct:securityCheck redirectPage = "#cgi.script_name #" / >

    < name = "cfparam form.submitted" default = "0" / > "

    "< name =" cfparam form.importFile"default =" "/ >

    < cfif form.submitted >

    <! - Download file - >

    < cffile action = "upload" destination = "#getTempDirectory ()" # "filefield ="importFile"nameconflict ="makeunique"/ >"

    <!--> reading spreadsheet

    "< cfspreadsheet action = 'read' src="#cffile.serverDirectory#/#cffile.serverfile# ' query = headerrow "importData" = "1" excludeheaderrow = "true" / >

    <!--> Import data

    < cfloop query = "importData" >

    < cfset blogPost = entityNew ('blogPost') / >

    < cfset blogPost.title = importData.title / >

    < cfset blogPost.summary = importData.summary / >

    < cfset blogPost.body = importData.body / >

    < cfset blogPost.dateposted = importData ["posted Date"] / >

    < cfset EntitySave (blogPost) / >

    < / cfloop >

    < cfset ormFlush() / >

    < cflocation url = "listblogpost.cfm? message = #urlencodedformat ('Blog Posts Imported Successfully')" # "addtoken ="false"/ >"

    < / cfif >

    < cfoutput >

    < section ct:layout = "Summary" >

    < section = 'blog' active 'post' = ct:navigation / >

    < div class = "span10" >

    The Blog posts to download < h2 > < / h2 >

    < form class = "form-horizontal" action = "" #cgi.script_name # "method ="post"enctype =" multipart/form-data">"

    < div class = "control group" >

    < class label = 'label control' for 'importFile' = > import file < / label >

    < div class = "orders" >

    < input type = "file" id = "importFile" name = "importFile" value = "#form.importFile #" >

    < / div >

    < / div >

    < div class = "control group" >

    < div class = "orders" >

    < button type = 'submit' class = "btn, btn-primary" > download < / button >

    < / div >

    < / div >

    < input type = "hidden" name = "subject" value = "1" / >

    < / make >

    < / div >

    < / ct:layout >

    < / cfoutput >


    DavidSCarlisle55 wrote:

    I changed the date to 'YYYY-MM-DD' in the xls file by changing to the UK format within excel.

    It is still giving an error.  ?

    Odd. Then there can be only one solution to the riddle: what you read is a column name, and not the date value stored in the column.

    See what happens when you replace this line by

    or, perhaps better,.

  • How to convert to format Date in milliseconds

    Hi all

    I am getting the output of a variable in milliseconds format, how can I convert it in date format

    For ex: I get variable input like 1366664691000 and I need to convert it to April 22, 2013 23:04:51 CEST (or SOA form). is there any function for this in XSL or XPath?

    Thank you

    Hello

    My XSLT works now after making a few changes

    and included namespace xmlns:fn = "http://www.w3.org/2005/xpath-functions.

    Now, I'm successfully number of days. My use case is to delete the files of the bases on the number of days. (i.e. changed the time - current date).

    Once again thank you @ vladidos

  • 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 a hex date?

    I notice with the release of SharePoint Foundation 2010 metadata using cfsharepoint dates/times are converted in the following format: 0x01cf2d81. 0x71c80a00

    How to convert it to a regular date using ColdFusion?  I found a few references to this question here http://sharepoint.stackexchange.com/questions/66602/dates-and-times-in-properties-vs-field s/91069 #91069 which shows a solution like this:

    //fieldValue looks like "0x01cf2f8e|0x6e559e00"
    string fieldValue = listItem.Properties[dateFieldName]
    string hexValue = fieldValue.Replace("|", "").Replace("0x", "");
    long ticks = long.Parse(hexvalue, NumberStyles.HexNumber);
    
    DateTime date1 = DateTime.FromBinary(ticks).AddYears(1600);
    

    But I have no idea how to do that in ColdFusion.  Apparently, the hexadecimal value represents the number of ticks since January 1, 1600.  Crazy, I know.

    Any ideas?  Thank you.

    Thanks for your help in this, Alexander.  I have worked on this for a day and discovered some useful information and finally found an easier way to do this.

    Below, you will see that the number of ticks can actually be retrieved using the method of parseLong() of Java.  I don't know what is happening with inputBaseN or why it does not work for this scenario, but we cannot forget that for now.  Also, I discovered Windows time system does not start at 1600, he begins to 1601.  The guy in the article I linked to really wrong, so apologies for any confusion on that!  Finally, I convert the date in local time.

    Here's the complete code to convert the hexagonal date of SharePoint at regular date using ColdFusion.  Hope this helps someone in a similar situation.

      
      
      
      
      
      
      
      
      
    

    By the way, here's a cool article about a guy who goes to something similar: http://ruthsarian.wordpress.com/category/programming/coldfusion/

  • I want to convert the double data type to string type

    I want to convert the double data type to string, have idea about that

    Hello

    Use f

    FN: String (ARG) returns the string value of the argument. The argument can be a number, boolean, or node-set element

    Example: string (314)
    Result: "314".

    http://w3schools.com/XPath/xpath_functions.asp#string

    See you soon,.
    Vlad

  • convert the money data type in a decimal format 2.

    What is the best way to convert the money data type in a decimal 2 format in ms sql 2005 for use in my applications.

    This?

    CAST (tr.depositReceivedAmount AS decimal (10, 2))

    I respectfully disagree with the idea that you must change the query column a type of 'money' data to something else.

    In most database servers, "«argent» Silver" is a data type that is designed to provide a very homogeneous behaviour with regard to the arithmetic accuracy.  In Microsoft Access, the representation is a the whole scale.  MS SQL Server, it is obviously similar.  Ditto Oracle and others.

    You like that the money data type in the database for this clarification, because "hell has no fury like an accountant looking for a bad penny."   The column of database storage formats are designed to satisfy the accountants, and it's a good thing.

    Meanwhile, you also want to take care as to exactly how you are dealing with values.  There are several points where the district could take place.  You don't have available the strongest possible manipulation of the floating of the data types in ColdFusion.  You also are somewhat at the mercy of any interface software can be between you and that SQL server, you can use.  "It is correct to all about values , but not several times."

    I suggest to round the value just before the display and user input must be two decimals.

    Then, you may need to do some things at the end of SQL server.  For example, when you update a value in the table, you may need to use logical server to explicitly truncate the value to two decimal places, as well as an update of "$ 34,56" explicitly updates the column "$34,5600.."  (This kind of thing should happen in the context of SQL Server).  You know that the user entry has exactly two significant digits, but maybe (maybe not...)! SQL server may not know this.  You want to ensure that the stored server internally represents exactly two digits, when the origin of a user input value.

    Do not err on the side of "convenience" or "which seems." good on the screen  (If you do, get ready get telephone communications of the accountants, always at inappropriate times of the night.)

  • How to convert varchar to date datatype all insert or update in the table

    Hai All

    I need to convert to varchar type to date.

    I have two Tables T1, T2

    Structure of T1

    Code varchar

    Time varchar

    Date varchar

    Structure of T2

    Var EmpName

    Empcode var

    Date of the respondent

    Outtime date

    Intrinsically date

    Date of Introut

    Att_date

    Now I need to spend the time form T1 to T2 respondent, outtime, intrinsically, introut under certain conditions

    So now I need to convert Varchar to Date so that the insert or update

    I tried something

    Insert into T1 (code, respondent, att_date) values

    (To_date(Date|| dele de code temps, «hh24mi de mon-dd-yyyy»), att_date);

    OR update while

    Setting a day set Outtime T2 = To_date(Date||) Time, 'hh24mi mon-dd-yyyy') where...


    I got an error Ora-01861


    Concerning

    Srikkanth.M

    You did not show an example of your date or time values, control may be necessary to add a space between them, like

    To_date(Date || ' ' || time,'dd-mon-yyyy hh24mi')
    
  • Convert Varchar to Date of the

    Hello


    Im trying to convert varchar to date.

    So I used To_date (cilumn, 'DD-MM-YYYY'), since I have to order the set in descending order, I used the same function of conversion with order by clause.


    The problem is... put it is not ordered.


    < sql >

    Select date_created
    Of
    (
    Select distinct
    to_date(created_date,'DD-mm-YYYY') as date_created
    of schedule_backup
    )
    order by desc date_created
    /

    < sql >




    out put is
    =================




    DATE_CREA
    ---------
    26 NOVEMBER 09
    23 NOVEMBER 09
    19 NOVEMBER 09
    16 NOVEMBER 09
    11 NOVEMBER 09
    4 NOVEMBER 09
    30 OCTOBER 09
    11-SEP-09
    4 MARCH 10
    MARCH 1, 10
    FEBRUARY 25, 10

    DATE_CREA
    ---------
    FEBRUARY 22, 10
    17 FEBRUARY 10
    FEBRUARY 15, 10
    11 FEBRUARY 10
    FEBRUARY 9, 10
    FEBRUARY 3, 10
    27 JANUARY 10
    20 JANUARY 10
    JANUARY 15, 10
    JANUARY 4, 10




    Thank you
    REDA

    So it's a problem with the data itself

    Check below

    SQL>SELECT TO_CHAR(a,'DD-MON-YYYY')
      2        ,TO_CHAR(b,'DD-MON-YYYY')
      3    FROM (
      4          SELECT TO_DATE('03-FEB-10','DD-MON-YYYY')    a
      5                ,TO_DATE('03-FEB-2010','DD-MON-YYYY')  b
      6            FROM DUAL
      7         ); 
    
    TO_CHAR(A,' TO_CHAR(B,'
    ----------- -----------
    03-FEB-0010 03-FEB-2010
    
    Elapsed: 00:00:00.04
    SQL>
    

    Data are not in a consistent format DD-MON-YYYY or DD-MON-AA. It is a format of mix that impact of output as shown above

    Concerning
    Arun

  • Convert NUMBER to DATE

    I have data from a table that has the columns, MONTH, DAY, YEAR in NUMBER data type. I am wanting to convert that to DATE datatype and concate month, day, and year. Can someone help me please? Thank you
    SELECT TO_DATE(month||day||year,'MM/DD/YYYY')
    FROM DATA_TABLE;

    Dclipse03 wrote:
    Gosh, now its gives me the error: not one month valid

    the man, trying to convert dates is totally not my thing...:)

    Nor is anyone else. This is one reason people use DATE columns.

    The valid months are integers from 1 to 12. You can find the lines which are not in this value by saying:

    SELECT  *
    FROM    data_table
    WHERE   month  NOT IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
    OR      month  IS NULL
    ;
    

    That will tell you what are the bad values. On this basis, you must decide what you want to do with the bad values.

  • Converting varchar2 field in date format: DD-ME-AAAA

    Thanks in advance for the help anyone about it because I know that it takes your time and expertise. I'm pretty new to SQL but learn my way through it just have a problem with a text to the conversion of date field. It is an Oracle database 10g and I do not write in SQL. There is a field called demand which is formatted in varchar2 format DDMMYY. There is also an updated field shaped like a date called payment which is in JJ-ME-YYYY format.

    Essentially, I need to make a simple payment > = request, however as you can see that is an issue with this being a field of varchar2. Anyone know if it is possible to make this type of expression against these two fields. Was thinking about the varchar2 eventually convert a date but do not know how to access this format DD-MON-YYYY.

    Also there are situations where this application field will often be null because he would have never received correspondence in the past and would not have a date at all.

    Thank you

    Published by: user10860766 on August 18, 2009 08:14

    Published by: user10860766 on August 18, 2009 08:19

    Hello

    It is difficult to detect the wrong dates in pure SQL, especially if you need to be specific as to which 29 February is valid.
    It's easy with a user-defined function, like that of [this thread | http://forums.oracle.com/forums/thread.jspa?messageID=3669932�].

    Published by: Frank Kulash, August 18, 2009 15:50

    To create a stand-alone function:

    CREATE OR REPLACE FUNCTION     to_dt
    (     in_txt          IN     VARCHAR2                    -- to be converted
    ,     in_fmt_txt     IN     VARCHAR2     DEFAULT     'DD-MON-YYYY'     -- optional format
    ,     in_err_dt     IN     DATE          DEFAULT     NULL
    )
    RETURN DATE
    DETERMINISTIC
    AS
    BEGIN
         -- Try to convert in_txt to a DATE.  If it works, fine.
         RETURN     TO_DATE (in_txt, in_fmt_txt);
    EXCEPTION     -- If TO_DATE caused an error, then this is not a valid DATE: return in_err_dt
         WHEN OTHERS
         THEN
              RETURN in_err_dt;
    END     to_dt
    ;
    /
    

    To use it:

    SELECT  primary_key  -- and/or other columns to identify the row
    ,       demand
    FROM    table_x
    WHERE   demand          IS NOT NULL
    AND     to_dt ( demand
               , 'DDMMYY'
               )          IS NULL;
    
  • Convert String to DATE

    Hello

    There is a '20091002' chain, and I need to convert it to this day.

    20091002 is in format YYYYMMDD - the VARCHAR2 data type

    I need the above in DD/MM/YYYY - DATE datattype

    '20091002' (VARCHAR2) - 10/02 / 2009 "(DATE)

    Thank you

    Aman

    Hi, Aman,

    user13115886 wrote:

    Hello

    There is a '20091002' chain, and I need to convert it to this day.

    20091002 is in format YYYYMMDD - the VARCHAR2 data type

    I need the above in DD/MM/YYYY - DATE datattype

    ...

    You are contradicting yourself.  All dATEs have the same format, and it's nothing like YYYYMMDD or DD/MM/YYYY.

    If you need a DATE, use TO_DATE:

    To_date (str, 'YYYYMMDD')

    but it will not be in the format MM/DD/YYYY

    If you want to convert a string into a format to another string in another format, and then use the string manipulation functions to reorganize secondary channels, for example

    REGEXP_REPLACE (str

    '(\d{4})(\d{2})(\d{2})'

    , "\2/\3/\1".

    )

    or

    SUBSTR (str, 5, 2) | '/' ||

    SUBSTR (str, 7, 2) | '/' ||

    SUBSTR (str, 1, 4)

    but it will not be a DATE.

    If you were certain that str contains valid data, then you can call TO_DATE to convert a DATE and then call TO_CHAR to convert the DATE to a string in the format MM/DD/YYYY.  I do not recommend, because it is likely that the strings would not be valid.  It's one of the reasons why you should use DATEs to store the date information.

  • Converting varchar2 to float

    Hello community,

    I have 2 columns with as many lines of type varchar2 attributes and I intend to convert to float. Seaweed can you tell me what the best way to do it and how?

    Best regards

    NLS_NUMERIC_CHARACTERS is normally set ".,"allowing both"."and ",    However, any non-digit character (for example, a letter or a symbol) present in the column in any row would cause an error ORA-01722.  So you need to check the data that are stored and clean.

    Hemant K Collette

Maybe you are looking for

  • E-mail account became case-sensitive?

    I have several email accounts on my iPhone and my iPad. One is a gmail account where I capitalized the first character of the email on the iPad (even if the gmail account is tiny everywhere). Recently, I changed the PW and, of course, has had to upda

  • How can I make my impression of bigger aol

    Internet explore my aol mail fills the screen. but on firefox, is toosmall. How can I make it bigger?

  • Thinking about ditching Windows 10 for OSX

    I'll try to completely avoid bashing Windows, but I am extremely disappointed by Windows 10. It's a bug-riddled mess. And the store / apps are so poor compared to what we get on iOS. So thinking about getting a Mac (iMac, perhaps). Have never owned a

  • Brightness not adjustable LCD screen in win7

    I recently had g500s lenovo with 64-bit preloaded windows8 I got bored of windows8 and retrograde to windows7 home premium 64-bit (a difficult procedure, or said by the way and with your help through the path) Windows 7 has worked very well after ins

  • Everything goes fine until the other day when...

    I've been a happy user of vista for a while now, and until a few days ago, I could just click on 'Documents' In Start Up list and see my documents. Since trying to save a document on a reliable website I find now I can't access it this way and find i