How to convert a timestamp varchar2 column (3)

Hi all

I have a column of field date with varchar2 data type:

Date
----------
13/03/2011 10:22
13/03/2011 10:22


I tried this:
select to_timestamp(date,'HH24MI') from dual;
IAM getting this error:

ORA-01858: a non-digit character was found here where was waiting for a digital
I want to convert date timestamp column (3) column

846773 wrote:

I want to convert date timestamp column (3) column

TIMESTAMP is not time column. Look at him as a date with a better accuracy - it supports the franctional part of a second. In any case, use:

Select to_timestamp (date, "DD/MM/YYYY HH: mi AM'") twice;

SY.

Tags: Database

Similar Questions

  • How to convert the timestamp in varchar2

    How to convert

    -timestamp

    TO_TIMESTAMP (' 29.01.2015 08:36:41 ','fmDDfm.fmMMfm.YYYY fmHH24fm:MI:SS') of double

    in

    -varchar2

    20150129083641

    Hello

    Maybe something like this:

    select to_char(to_date(substr(to_char(TO_TIMESTAMP('29.01.2015 08:36:41','fmDDfm.fmMMfm.YYYY fmHH24fm:MI:SS')),1,17), 'dd.mm.yy hh24:mi:ss'), 'yyyymmddhh24miss') from dual;
    

    But the question is: what do you do? Sorting? Or you have a (very) old data model with varchars or numbers to organize the date fields?

    concerning

    Kay

  • How to convert a timestamp in tank

    Hai all

    How to convert a timestamp to varchar

    I had a query called Cube_instance

    Here, the creation date is declared as timestamp. This is my request

    Select count (1) in the cube_instance where ID_processus like 'PreAdviceHandler %' and
    CREATION_DATE between July 30, 10 00.00.00.000000' and
    31 JULY 10 00.00.00.000000';

    My result is when I run this query, I need the count starts from 30 declaring Jul and 30 jul ending when I run the present 31 Jul


    How to convert this varchar timestamp and give the condition


    Kind regards

    Srikkanth.M

    Published by: Srikkanth.M on July 31, 2010 01:53
    select count (1)
    from cube_instance
    where process_id like 'PreAdviceHandler%'
       and creation_date between trunc (sysdate) and trunc (sysdate + 1) - interval '1' second;
    
  • How to convert the lines into columns dynamically

    HII
    I have a 'report_line' with the following data table

    location_code line_code value
    LOC1 L1 12
    loc2 L1 13
    LOC1 L2 15
    loc2 L3 11
    LOC3 L1 9

    Now I want the o/p by converting the line_codes in clumns as below

    L1 L2 L3
    LOC1 12 15
    13 11 loc2
    LOC3 9

    How can I do this dynamically. Line codes are not constatnt, they can change for each scenario.

    Thank you
    Sandeep

    I want just a sql for this query and no. columns ' maximum of are 6.

    In this case you can do.

    --sample data
    with t
    as
    (
    select 'loc1' location_code, 'L1' line_code, 12 value from dual union all
    select 'loc2', 'L1', 13 from dual union all
    select 'loc1', 'L2', 15 from dual union all
    select 'loc2', 'L3', 11 from dual union all
    select 'loc3', 'L1', 9 from dual
    )
    --end of sample data
    select location_code,
           max(decode(line_code, 'L1', value, null)) L1,
           max(decode(line_code, 'L2', value, null)) L2,
           max(decode(line_code, 'L3', value, null)) L3,
           max(decode(line_code, 'L4', value, null)) L4,
           max(decode(line_code, 'L5', value, null)) L5,
           max(decode(line_code, 'L6', value, null)) L6
      from t
     group by location_code
    

    Here I used the WITH clause as an example of table. You can replace the "t" table name in the select statement with your actual table and remove the WITH clause.

  • How to convert line values in columns

    Hello guys,.

    I am using Oracle 10 g on a windows platform, I have the following data:
    with test as
    (
    select '000-ME-001' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    select '000-ME-001' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    select '000-ME-001' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
    select '000-ME-002' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    select '000-ME-002' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    select '000-ME-002' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
    select '000-ME-003' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    select '000-ME-003' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    select '000-ME-003' tag_number, 'Capacity 350' tag_details1, '' tag_details2 from dual
    )
    How can I secret the tag_details1 as the name of column values to achieve this result:
    tag_number     Capacity 150     Capacity 250     Capacity 350
    
    000-ME-001     000-TS-M-226     000-TS-M-227     000-TS-M-228
    000-ME-002     000-TS-M-226     000-TS-M-227     000-TS-M-228
    000-ME-003     000-TS-M-226     000-TS-M-227
    Hope you can help me, but cordially.

    It is probably one of the most common question here with thousands and thousands entries in the forum.
    In any case, here's one more:

    SQL> with test as
      2  (
      3  select '000-ME-001' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
      4  select '000-ME-001' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
      5  select '000-ME-001' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
      6  select '000-ME-002' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
      7  select '000-ME-002' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
      8  select '000-ME-002' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
      9  select '000-ME-003' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
     10  select '000-ME-003' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
     11  select '000-ME-003' tag_number, 'Capacity 350' tag_details1, '' tag_details2 from dual
     12  )
     13  select tag_number,
     14         max(decode(tag_details1,'Capacity 150',tag_details2)) Capacity_150,
     15         max(decode(tag_details1,'Capacity 250',tag_details2)) Capacity_250,
     16         max(decode(tag_details1,'Capacity 350',tag_details2)) Capacity_350
     17  from   test
     18  group by tag_number;
    
    TAG_NUMBER CAPACITY_150 CAPACITY_250 CAPACITY_350
    ---------- ------------ ------------ ------------
    000-ME-002 000-TS-M-226 000-TS-M-227 000-TS-M-228
    000-ME-001 000-TS-M-226 000-TS-M-227 000-TS-M-228
    000-ME-003 000-TS-M-226 000-TS-M-227
    

    Nicolas.

  • [Oracle 8i] How to convert a string (timestamp) in a date?

    I find it difficult to know how to convert a string to a date time stamp (or possibly several).

    The timestamp is 20 positions, character (NOT NULL, CHAR (20))
    in the format: YYYYMMDDHHMMSSUUUUUU
    where Y = year, M = month, D = day, M = Minutes, S = seconds and U = microseconds

    The reason why I want to convert it is so that I can compare a timestamp to each other (that is, I want to be able to find the MIN (timestamp), MAX (timestamp) and make comparisons of inequality).

    Is this possible?

    Thanks in advance for the help on this!

    Hello

    As Damorgan said, if all you want to do is find which is the earlier or later, then you can just compare the strings: they are in a format where it works.

    If you need to do other things, such as compare to today date or see the difference between two of your lines of days, you will need to convert it to date. (He has no reason to convert them to numbers).

    A new TIMESTAMP data type, which manages the fractions of a second, was introduced in Oracle 9.
    Since you use Oracle 8 (depending on your subject line), or it must be
    (1) ignores the microseconds, or
    (2) use a separate column for microseconds.

    Whatever it is, use TO_DATE to convert the first 14 characters in DATE:

    TO_DATE ( SUBSTR (txt, 1, 14)
            , 'YYYYMMDDHH24MISS'
            )
    

    where txt is your column of type CHAR.
    To convert microseconds to a number (between 0 and 999999):

    TO_NUMBER (SUBSTR (txt, 15))
    
  • How to convert a single column in the primary key column

    Hi all

    I have a column that's unique cnstraint, this column contains the value as digital and also null.

    So how do you convert to primary key column

    Concerning
    Prashant

    Prashant wrote:
    Hi all

    I have a column that's unique cnstraint, this column contains the value as digital and also null.

    So how do you convert to primary key column

    Concerning
    Prashant

    Prashant,

    You must assign new values to null values. You can use a sequence to produce the figures in this column.

    Select max (your_unique_column) from your_table; -find the maximum value of this column, so you can start the sequence of this number.

    create sequence seq_for_your_table with XXXX - value max + 1 you have found

    Update your_table set your_unique_column = seq_for_your_table.nextval () where your_unique_column is null

    You can create a primary key on this column.

    Best regards

    Grosbois

    -------------------------------------------------------
    If you answer this question, please mark appropriate as correct/useful messages and the thread as closed. Thank you

  • a date column, with timestamp... How to remove the timestamp

    Hello

    I have a table name WRESTLING, with one of its fieldnamed DATE, using the DATE data type.
    The date format incudes timestamp, can someone help me how to remove the timestamp part.
    I want only the part of date only. I tried this:

    Update DATE is to_char(date,'DD-MON-YYYY') set of CATCH;.
    but the result of all the date inside the table always have timestamp.

    can I use this:
    Update DATE is to_date(date,'DD-MON-YYYY') set of CATCH;.
    and still the same result.

    Can anyone advice on this? pls.
    Thank you

    user9353110 wrote:
    Thank you very much.. If this is the case, we can remove the timestamp when creating view for this table?

    No, you can never remove the component "hour" of a DATE.

    If you do not want to display a date in time (display purposes only!), use TO_CHAR to "transform" the DATE to a string with the format mask

    SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi'
      2  /
    
    Session altered.
    
    SQL> select sysdate
      2    from dual
      3  /
    
    SYSDATE
    ----------------
    17-03-2010 09:28
    
    SQL> select to_char (sysdate, 'dd-Mon-yyyy')
      2    from dual
      3  /
    
    TO_CHAR(SYSDATE,'
    -----------------
    17-Mar-2010
    
    SQL> select to_char (sysdate, 'yyyy-MON-dd')
      2    from dual
      3  /
    
    TO_CHAR(SYSDATE,'
    -----------------
    2010-MAR-17
    
    SQL> 
    

    NOTE: the example of last two are not DATEs! They are STRING

  • How to convert varchar to DateTime?

    Hi all

    I have a field - "final payment".

    Data - type Varchar.

    Last completion date must be in the date format. So I want to convert Varchar to Date.

    How can I convert? Can someone please help me solve this problem.

    Hi Nicolas,.

    Gayathri Venugopal wrote:

    I have a table - order and I have a field " Latest_Completion_Date " which is in the format Varchar - ' 20150804'.

    select Latest_Completion_Date from order 
    output- 20150804
    

    I want to convert Latest_Completion_Date - '20150804' in Date format - 15-SEP-07 ".

    How to convert it?

    The column ORDER. LATEST_COMPLETION_DATE with the VARCHAR2 data type?

    How are "Last date" element filling in the form?

    You can use to_date and to_char in combination to get the required format:

    select to_char(to_date(latest_completion_date,'YYYYMMDD'),'DD-MON-RR') latest_completion_date
      from order
    

    Kind regards

    Kiran

  • How to convert datetime in a JSF page or within the object entity of seconds since 1970

    Please HELP I have a column of type bigdecimal seconds since 1970 representing datetime.

    for example

    DateTimeCol

    1333382669.06

    expected output for the datetime type is 2012-04-02 16:04:29

    I build JSF form that display the column DateTimeCol. DateTimeCol type and Date format

    YYYY-MM-DD hh: mm: but the output of the column DateTimeCol is 9616-11-09 03:09:06 and it won't.

    I do not know how to convert (1333382669.06 seconds since 1970) in datetime (2012-04-02 16:04:29)

    I'd appreciate your help.

    Your problem is that the date data type coming milliseconds and not in seconds. You should be abel to do the math and use a

    java.util.Date(your_sec*1000).tostring ();

    Google for a timestamp converter (e.g. Epoch Converter - Unix Timestamp converter) and enter your number

    Entry 1333382669.06 * 10 = 1333382669060 lets you get: (here I use only * 10 that you already have 1/100th of a second!)

    Assuming that this timestamp is in milliseconds:

    GMT: Sunday, March 24, 1974 06:24:26 GMT

    Timo

  • How to convert char Spanish AL32UTF8 to ISO-8859-1 with sqlplus in linux?

    I have the server 11g with NLS_CHARACTERSET with AL32UTF8.  I need to have a varchar2 column, which contains the Spanish character, converted to ISO-8859-1 the output of sqlplus.

    So, I put in the bash shell script

    'export NLS_LANG = AMERICAN_AMERICA. UTF8'

    or

    'export NLS_LANG = AMERICAN_AMERICA. AL32UTF8'

    And then, I don't

    iconv-f UTF-8--t TRANSLIT ISO_8859-1 / / infile.txt > outfile.txt

    Two NLS_LANG settings have the problem.

    For the two parameters of lang, if I

    file - bi infile.txt

    It gives text/plain; CharacterSet = utf-8

    However

    iconv translated

    Who Gomez in Gomez who.

    Why the e and o and others not translated correctly?

    How I translated the Spanish character correctly from the output of sqlplus?

    Thank you.

    The problem is that your data is stored in the form of decomposed Unicode, which is legal but rarely used for Western European languages.  'e' is stored as 'e' (0 x 65 = U + 0065) more combining acute accent (0xcc, 0 x 81 = U + 0301).  Most of simple conversion, including the conversion of standard Oracle client/server tools, do not take into account this and does not convert the characters broke into a character previously composed of ISO 8859-1. They are trying to convert each of the two codes regardless, 'e' performance as well as a replacement for the character of emphasis, that does not exist in ISO 8859-1. You see the result correctly in SQL Developer, because there is no conversion involved and the rendering of SQL Developer code is able to combine the two codes into a single character, as expected.

    As the 'e' and 'o' made up forms in Unicode and ISO 8859-1, the work around is to add the COMPOSITION function in your query. Thus, set NLS_LANG as I've mentioned previously and add new MESSAGE around the expressions of columns to your query.

    SELECT COMPOUND (title) OF...

    Thank you

    Sergiusz

  • How to convert a single byte in UTF8 characters

    Hello
    I have problem with the export of data to the file with UTF8 encoding.

    I varchar2 columns in the database with NLS_CHARACTERSET = EE8ISO8859P2 (Czech Republic) and I need to export the columns in the file with UTF8 encoding.

    So I need to make a single byte FOR byte conversion multi.

    I tried sql CONVERT (CONVERT ('my_char', 'UTF8') command) in the forms, but without effect. The encoding of the file created is UTF8, but the characters are corupted.

    Registry settings on my client is NLS_LANG = REPUBLIC of AMERICAN_CZECH. EE8MSWIN1250

    Could you tell me some thing how to export data from the column with characters on a single byte of file with UTF8 encoding?

    I use Text_io package to write in the shapefile.

    Thank you

    my last try so if you can afford an empty space in your output file in the fist line. I tested hv it works

    create a foo.txt with empty space and then add the file as a normal procedure or try to re - open the file later and replace the space in the first row using SUBSTR etc etc.

    TEXT_IO has very limited functionality try to package DDE it might solve your problem

    Good luck
    Bangoura

  • How to convert sysdate to any given time zone

    Hello friends,

    I have asked this question in an interview and I couldn't respond.

    Question:


    How to convert sysdate to any given time zone

    as sysdate IST or EDT etc.

    Sriram_91 wrote:

    Hello friends,

    I have asked this question in an interview and I couldn't respond.

    Question:

    How to convert sysdate to any given time zone

    as sysdate IST or EDT etc.

    Don't know if you want, but here goes:

    My current timzone, I am in the time zone of Phoenix, AZ is (including 7 hours BEHIND GMT aka - 07:00).  Therefore, the MST.  To convert it to EDT (aka New York City), I do this:

    SELECT SYSTIMESTAMP AS Phoenix_TZ
          ,CAST(SYSTIMESTAMP AT TIME ZONE 'America/New_York' AS TIMESTAMP WITH TIME ZONE) AS NY_TZ
      FROM dual;
    

    @

    I hope this helps.

  • How to convert Date months in the database that points to the EBS, DWH not.

    Hi friends,

    We intend to create reports in OBIEE and the Source is EBS. This means that we do not want depends on Datawarehouse and Informatica and OBIApps. Simply create us some reports and that they refer to the EBS database.

    End of test, we took an HR report and it contains under columns:

    Months (Sun)
    Revenue by Division (Fact)
    Average cost per numbers of workforce (Fact)

    In my little survey, we found that the income column is of EBS: GL_BALANCES. And we have configured the base of W_Day_D table in DAC has no column months in EBS (not sure).

    Come to my problem, how can I call the month column in my data base stressed EBS. How to convert the Date months in my database.

    I can deceive me, but someone please look into this... How can I create columns for this exact report of OBI in EBS database instead of DwH.

    Thanks in advance...

    Raghu Jen7782

    Just confused here.

    Hang on, if I get it, you want to create report based on columns of EBS directly then using rt BI applications?

    There is then no question of using the W_DAY_D table then.

    Follow

    As long as you have Date column, you can use DB functions to convert them into months (just use the string SUBSTR to extract the month and the year).
    Create your own query instead of using the tables of BI APPS and try to bring a hybrid product.

    Sorry I'm wrong in the understanding of your needs, if I had properly then do the steps above.

    Mark correct or useful if this can help,

    Kind regards
    Rayan Vieira

  • OpenScript/Bank of data/how to convert string to int

    Hello

    As far as I know, the values read from the database is a type of Sting. Now, I want to convert a character number stored in the database of type int.
    For example, in "Test.csv" I stored the '9' in the column 'Number' character, then I use the following code to read the character and convert an int in one:
    getDatabank("Test").getNextDatabankRecord ();
    String Testnumber = "{{db." Test.Numberr}} '; Info (Testnumber);
    int number = Integer.parseInt (Testnumber);

    However, it seems this does not work, because he says "basic unexpected failure caused by: NumberFormatException occurred." For the input string: «{{db.» Test.Numberr}}.
    I think that this error can be caused by the conversion of character '9' int 9.
    Can someone tell me how to convert a character to be read from database in an int?

    Thank you very much!

    Kind regards
    Angyoung

    Hello

    You can use the same approach. Use eval()

    getDatabank("Test").getNextDatabankRecord();
    String Testnumber =eval("{{db.Test.Numberr}}") ;
    info(Testnumber);
    int number = Integer.parseInt(Testnumber);
    

    Kind regards
    Dembélé M

Maybe you are looking for