Convert Varchar2 datatype Date Value To Date Datatype

Hello,
I have a date value like the following as varchar2 datatype.
31-DEC-10 08.40.53 AMI would like to convert this to_date as date datatype.
How could I do this?

Use the right format mask?
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions183.htm#SQLRF06132
SQL> select to_date('31-DEC-10 08.40.53 AM', 'dd-mon-yy hh.mi.ss am')
  2  from  dual;
TO_DATE('31-DEC-100
31-12-2010 08:40:53
1 row selected.
SQL> declare
  2    dt date;
  3  begin
  4    dt := to_date('31-DEC-10 08.40.53 AM', 'dd-mon-yy hh.mi.ss am');
  5    dbms_output.put_line(to_char(dt, 'dd-mm-yyyy hh24:mi:ss'));
  6  end;
  7  /
31-12-2010 08:40:53
PL/SQL procedure successfully completed.

Similar Messages

  • Dsiplay data values and data lables in a stacked column chart

    Hi All
    Is there a way to display data values and data labels in a stacked column chart. Mouse over or display of labels in legends wont help. It has to be in the chart .
    Regards,
    anshul

    Hi Anshul,
    You can display either data value or data label in a stacked column chart by checking the Data Label Displaying Mode option under Format Chart->Data Values.
    You can also do the same by checking the same option under Format chart->Area Display->Data Values.
    I dont think you would be able to display both in a column chart whereas you would be able to do it in a pie chart.
    Hope this helps.
    Regards
    Sri Harsha

  • Converting the user response date value to date data type

    Hi,
    I have a parameter which takes date as input (from date and to date).
    I need to get the difference between these two dates.
    So i can use the function todate(userresponsedate,"dd/mm/yyyy")
    but here i cannot hardcode the date format as dd/mm/yyyy.
    Because my reports needs to support to multiple locales and so if i change the browser locale to japanese the input date will appear some thing like yyyy/dd/mm.
    So my function  todate(userresponsedate,"dd/mm/yyyy") is failing over here.Its is giving #error
    Is there any option where it takes the browser locale date format.
    ex: todate(userresponsedate,browserlocaledateformat)
    So that it works irrespective of the browser locale
    Thanks in advance

    HI
    Try to use this formula
    formatdate(todate(userresponse("enter from date");"");"dd/MM/yyyy")
    In the report level you will see only dd/MM/yyyy as string
    Hope this helps u
    sunil

  • 'Merge Data Values' on data manager package

    Hi there
    I have a query with the 'Copy' data manager package.  We are currently selecting 'Merge Data Values' which appears to be finding anything where the key already exists and replacing it with the new data.  That's fine.
    However, our user is wanting to consolidate various different category members into a single category member.  Therefore, we would like to run a package to SUM new values with what is already in the cube rather than first delete and replace with the latest value.
    Is there a way to do this ?
    Thanks
    Ian

    Hi Ian,
    Please read this: BPC 7.5/10.0 : MOVE Data manager Package with keyfigure additions on move
    Or you can use script logic to add values like:
    *REC(EXPRESSION=%VALUE%+[CATEGORY].[DESTINATION],CATEGORY=DESTINATION)
    B.R. Vadim

  • Column formatting based on grouping data value- advanced data grid

    Hello Everyone,
    I am using advanced data grid to display hierarchial data nested upto depth 4. I have to color the leaf nodes conditionally based on  the grouped column value.
    Say for Eg.,
    If the data is something like
    Company
         Manager
              Jim          $4000
              John        $3000
         Accountant
              Smith     $2000
              Sam       $3000
    I have to color Jim and John based on they being a manager. In other words, how do I get Manager and Company information for the leaf rows. The data is serial to start with and I am grouping it before displaying.
    Please let me know how this could be done.
    Thanks
    Arun

    Once htmldb.oracle.com is available again, you may have a look in my demo application:
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    In the tab section I, you will find several examples on pop-up pages. There this conditional
    displaying is included as well.
    Denes Kubicek

  • Dynamic Date Value for Date Range Parameter - Scheduling in BI

    Hi,
    I am New to BO Enterprise XI R3. I want to schedule the Crystal report which takes Date Range as parameter. Is any option available to calculate From Date automatically based on Current Date based on the range required?
    Currently, Parameter option accepts parameters and enterprise process the report for configured parameters. In this case, report always prints only for configured date range eventhough report generated after one month. I am expecting report has to print data for date range (eg. 1 weeks, 4 days, or any range) based on system current date.
    Thanks in Advance,
    Venkateswaran.P

    I'm am in the same situation.  I need to be able to have the date parameter dynamically change based on the current day's date when I schedule a report.  However, because this parameter comes from a Stored Procedure from the database, it cannot be modified in the Report Designer (as far as I know).  I've tried to set a default for it to use "currentdate" but it doesn't seem to take.  Anyone know if this can be accomplished in the scheduler?
    Thanks
    -Tom

  • Column with header data value

    Hi All.
    I have a control file which i need to add a column with header data value.
    example
    data file:
    123456;201303
    santiago;producto1;100
    santiago;producto2;200
    valparais;producto1;400
    valparais;producto3;900
    The control file skip the first column and load the three columns on the table, but, now i need to add other column with 201303 value constant of the first record and load it on the table.
    Then
    select * from table:
    santiago producto1 100 201303
    santiago producto2 200 201303
    valparais producto1 400 201303
    valparais producto3 900 201303
    How i do this in the control file?
    Regards!

    SCOTT@orcl_11gR2> host type test.dat
    123456;201303
    santiago;producto1;100
    santiago;producto2;200
    valparais;producto1;400
    valparais;producto3;900
    SCOTT@orcl_11gR2> host type test1.ctl
    options (load=1)
    load data
    infile test.dat
    replace
    into table onecol_onerow
    fields terminated by ';'
    trailing nullcols
    (filler1 filler, newcol)
    SCOTT@orcl_11gR2> host type test2.ctl
    options (skip=1)
    load data
    infile test.dat
    append
    into table test_tab
    fields terminated by ';'
    trailing nullcols
    (col1, col2, col3,
    newcol expression "(select newcol from onecol_onerow)")
    SCOTT@orcl_11gR2> create table onecol_onerow
      2    (newcol number)
      3  /
    Table created.
    SCOTT@orcl_11gR2> create table test_tab
      2    (col1   varchar2(15),
      3     col2   varchar2(15),
      4     col3   number,
      5     newcol number)
      6  /
    Table created.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test1.ctl log=test1.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 6 10:46:44 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 1
    SCOTT@orcl_11gR2> select * from onecol_onerow
      2  /
        NEWCOL
        201303
    1 row selected.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test2.ctl log=test2.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 6 10:46:45 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 4
    SCOTT@orcl_11gR2> select * from test_tab
      2  /
    COL1            COL2                  COL3     NEWCOL
    santiago        producto1              100     201303
    santiago        producto2              200     201303
    valparais       producto1              400     201303
    valparais       producto3              900     201303
    4 rows selected.

  • View Panel : Change color of data values in channel table

    Hi,
    Is there a way wherein I can change the color of a particular data value or data block  in a channel in the VIEW panel and can this be done programtically? I am using DIAdem 2010.
    Looking forward for your response
    Thanks in advance
    Priya

    Hi Pria,
    There is no way to change the color of various cells in a VIEW table.  This can be done (for the text color, not the cell background) in a REPORT table with the help of a customer-defined UserCommand.  I can send you an example of this if having the display in REPORT would help.
    If you had a newer version of DIAdem, you could embed a SUDialog in a VIEW area, and this SUDialog could have an XTable control that would enable you to show this type of display-- not easy, and not with DIAdem 10.2, but at least something to consider.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How to convert number datatype to raw datatype for use in data warehouse?

    I am picking up the work of another grad student who assembled the initial data for a data warehouse, mapped out a dimensional dw and then created then initial fact and dimension tables. I am using oracle enterprise 11gR2. The student was new to oracle and used datatypes of NUMBER (without a length - defaulting to number(38) for dimension keys. The dw has 1 fact table and about 20 dimension tables at this point.
    Before refining the dw further, I have to translate all these dimension tables and convert all columns of Number and Number(n) (where n=1-38) to raw datatype with a length. The goal is to compact the size of the dw database significantly. With only a few exceptions every number column is a dimension key or attribute.
    The entire dw db is now sitting in a datapump dmp file. this has to be imported to the db instance and then somehow converted so all occurrences of a number datatype into raw datatypes. BTW, there are other datatypes present such as varchar2 and date.
    I discovered that datapump cannot convert number to raw in an import or export, so the instance tables once loaded using impdp will be the starting point.
    I found there is a utl_raw package delivered with oracle to facilitate using the raw datatype. This has a numbertoraw function. Never used it and am unsure how to incorporate this in the table conversions. I also hope to use OWB capabilities at some point but I have never used it and only know that it has a lot of analytical capabilities. As a preliminary step I have done partial imports and determined the max length of every number column so I can alter the present schema number columns tp be an apporpriate max length for each column in each table.
    Right now I am not sure what the next step is. Any suggestions for the data conversion steps would be appreciated.

    Hi there,
    The post about "Convert Numbers" might help in your case. You might also interested in "Anydata cast" or transformations.
    Thanks,

  • Need to raise an error if Users puts wrong value for date datatype in Forms

    Hi all,
    I've created a new form using Template.fmb in forms 10g having some text item with data type as DATE.
    and now i wanted to raise an error if users inputs any wrong data rather than DATE format.
    Please help me if anyone knows how to do this...

    b_kapsy wrote:
    As of now i am not looking for validation, i know the validation will automatically done but if you see by default it will not raise any error message if you fill any wrong value in text item with date data type. It will freeze the cursor to the text item.That is NOT the default. The default is to issue various FRM-nnnnn messages, between 50002 and 50026. From notes I have:
    -- 50002: Month must be between 1 and 12.
    -- 50003: Year must be 00-99 or 1000-4712
    -- 50004: Day must be between 1 and last of month.
    -- 50012: Date must be entered in a format like <fxMMDDRR>
    -- 50017,18,19: Hour,Min,Sec must be between 0 and 23,59,59.
    -- 50025: Date/time must be entered in a format like <xxyytttt>
    -- 50026: same as 50012 and 50025 with <yyyy> year.
    And from my old, dusty copy of the Oracle Developer/2000 "Messages and Codes Manual", those messages have an error level = 15.
    If you are not seeing those messages, then you have done one of two things:
    1. Set your System.Message_Level to a value of 15 or higher. You should NEVER set it above zero, since all that does is hides error messages like these. If you want to bypass or prevent an error message, it should be handled in the Re: FRM-40735:Pre_Insert trigger raised unhandled exception ORA-20011.
    2. You have some bad code in an On-Error trigger that fails to handle errors correctly.

  • Convert varchar2 to date in oracle

    how to covert varchar2 (30) to date fromat
    example '01/01/2007' to 01/01/2007
    thanks in advance
    Reddy

    I want to insert into my new table the data in the
    form DD-MON-RRRRIf your new table has the data type as DATE then you don't insert dates in any particular format, you just insert values that are DATE datatypes.
    The format is only important when you view the data.
    e.g.
    SQL> create table dt (mydate DATE);
    Table created.
    SQL> insert into dt values (to_date('01/01/2008','DD/MM/YYYY'));
    1 row created.
    SQL> insert into dt values (to_date('01-FEB-2008','DD-MON-YYYY'));
    1 row created.
    SQL> insert into dt values (to_date('20080402','YYYYMMDD'));
    1 row created.
    SQL> select * from dt;
    MYDATE
    01/01/2008 00:00:00
    01/02/2008 00:00:00
    02/04/2008 00:00:00
    SQL> alter session set nls_date_format='DD-MON-YYYY';
    Session altered.
    SQL> select * from dt;
    MYDATE
    01-JAN-2008
    01-FEB-2008
    02-APR-2008
    SQL>Edit:
    Sorry, forgot to say...
    This just demonstrates that any format of string can be inserted into a date column if the format string is specified correctly and it also demonstrates that what is stored is just a date, the format of which is determined by the settings of the tool you are using to retrieve the data (unless you specify e.g. to_char(date_column, 'DD-MON-YYYY') in the SELECT statement to convert it to a string again manually)
    Message was edited by:
    BluShadow

  • Conversion failed when converting the varchar value to data type int error

    Hi, I am working on a report which is off of survey information and I am using dynamic pivot on multiple columns.
    I have questions like Did you use this parking tag for more than 250 hours? If yes specify number of hours.
    and the answers could be No, 302, 279, No and so on....
    All these answers are of varchar datatype and all this data comes from a partner application where we consume this data for internal reporting.
    When I am doing dynamic pivot I get the below error.
    Error: Conversion failed when converting the varchar value 'No' to data type int.
    Query
    DECLARE @Cols1 VARCHAR(MAX), @Cols0 VARCHAR(MAX), @Total VARCHAR(MAX), @SQL VARCHAR(MAX)
    SELECT @Cols1 = STUFF((SELECT ', ' + QUOTENAME(Question) FROM Question GROUP BY Question FOR XML PATH('')),1,2,'')
    SELECT @Cols0 = (SELECT ', COALESCE(' + QUOTENAME(Question) + ',0) as ' + QUOTENAME(Question) FROM Question GROUP BY Question FOR XML PATH(''))
    SET @SQL = 'SELECT QID, QNAME' + @Cols0 + '
    FROM (SELECT QID, QNAME, ANSWERS, Question
    FROM Question) T
    PIVOT (MAX(ANSWERS) FOR Question IN ('+@Cols1+')) AS P'
    EXECUTE (@SQL)
    I am using SQL Server 2008 R2.
    Please guide me to resolve this.
    Thanks in advance..........
    Ione

    create table questions (QID int, QNAME varchar(50), ANSWERS varchar(500), Question varchar(50))
    Insert into questions values(1,'a','b','c'), (2,'a2','b2','c2')
    DECLARE @Cols1 VARCHAR(MAX), @Cols0 VARCHAR(MAX), @Total VARCHAR(MAX), @SQL VARCHAR(MAX)
    SELECT @Cols1 = STUFF((SELECT ', ' + QUOTENAME(Question) FROM Questions GROUP BY Question FOR XML PATH('')),1,2,'')
    SELECT @Cols0 = (SELECT ', COALESCE(' + QUOTENAME(Question) + ',''0'') as ' + QUOTENAME(Question) FROM Questions GROUP BY Question FOR XML PATH(''))
    SET @SQL = 'SELECT QID, QNAME' + @Cols0 + '
    FROM (SELECT QID, QNAME, ANSWERS, Question
    FROM Questions) T
    PIVOT (MAX(ANSWERS) FOR Question IN ('+@Cols1+')) AS P'
    EXECUTE (@SQL)
    drop table questions

  • How to select data in a LONG datatype

    Hello friends....
    We actually store some texts in a long column datatype, but we're facing the need of search this columns some specifics words. I tryed to select but it says me SQL was wiaintg for the NUMBER dt and got LONG.
    How can I search and select some words through this columns...
    Appreciated...

    SORRY SATYAKI...
    SQL> DESC CORREIO
    Nome Nulo? Tipo
    CHAVE NOT NULL NUMBER
    CHAVE_REMETENTE NOT NULL NUMBER
    NOME_REMETENTE NOT NULL VARCHAR2(50)
    CHAVE_DESTINATARIO NOT NULL NUMBER
    NOME_DESTINATARIO NOT NULL VARCHAR2(50)
    LOG_ENVIO NOT NULL DATE
    MENSAGEM LONG
    LIDA NOT NULL VARCHAR2(3)
    EXCLUIR NOT NULL VARCHAR2(3)
    STATUS NOT NULL VARCHAR2(20)
    ASSUNTO VARCHAR2(50)
    ENVIAR_PALM NOT NULL VARCHAR2(3)
    CHAVE_DEST_COPIA NUMBER
    NOME_DEST_COPIA VARCHAR2(50)
    COPIA VARCHAR2(3)
    CHAVE_TIPO_MENSAGEM NUMBER
    I' running Oracle 10gR2 in a MS Windows 2003 server .
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Here are some parameters to consider..
    PARAMETER VALUE
    NLS_LANGUAGE BRAZILIAN PORTUGUESE
    NLS_TERRITORY BRAZIL
    NLS_CURRENCY Cr$
    NLS_ISO_CURRENCY BRAZIL
    NLS_NUMERIC_CHARACTERS ,.
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD/MM/RR
    NLS_DATE_LANGUAGE BRAZILIAN PORTUGUESE
    NLS_CHARACTERSET WE8MSWIN1252
    NLS_SORT WEST_EUROPEAN
    NLS_TIME_FORMAT HH24:MI:SSXFF
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD/MM/RR HH24:MI:SSXFF
    NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR
    NLS_TIMESTAMP_TZ_FORMAT DD/MM/RR HH24:MI:SSXFF TZR
    NLS_DUAL_CURRENCY Cr$
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    SQL> select * from correio
    2 where mensagem like '%teste%'
    3 ;
    where mensagem like '%teste%'
    ERRO na linha 2:
    ORA-00932:inconsistent datatypes: waited NUMBER got LONG

  • How to Convert Varchar2 to Date format(Timestamp)

    I have a date saved in varchar2 column.
    how can I convert the values into date(including Time stamp), so I can use the date to compare data.
    Ex: I have the value '20-03-2007 05:31:29', but this value is saved as varchar2.
    how can I take from this value the date '20-03-2007 05:31:29' as date format because later i need that date completely to add days, hours and minutes?

    SQL> create table dd (a varchar2(15));
    Table created.
    SQL>
    SQL>
    SQL> insert into dd values (sysdate);
    1 row created.
    SQL> insert into dd values (sysdate);
    1 row created.
    SQL> insert into dd values (sysdate);
    1 row created.
    SQL> insert into dd values (sysdate);
    1 row created.
    SQL> insert into dd values (sysdate);
    1 row created.
    SQL> insert into dd values (sysdate);
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select * from dd;
    A
    01-OCT-12
    01-OCT-12
    01-OCT-12
    01-OCT-12
    01-OCT-12
    01-OCT-12
    6 rows selected.
    SQL>
    SQL>
    SQL> select to_date(a,'dd-mon-yyyy') from dd;
    TO_DATE(A
    01-OCT-12
    01-OCT-12
    01-OCT-12
    01-OCT-12
    01-OCT-12
    01-OCT-12
    6 rows selected.
    SQL> select to_timestamp(to_date(a,'dd-mon-yyyy'),'dd mon yy hh24.mi.ss' ) from dd;
    TO_TIMESTAMP(TO_DATE(A,'DD-MON-YYYY'),'DDMONYYHH24.MI.SS')
    01-OCT-12 12.00.00 AM
    01-OCT-12 12.00.00 AM
    01-OCT-12 12.00.00 AM
    01-OCT-12 12.00.00 AM
    01-OCT-12 12.00.00 AM
    01-OCT-12 12.00.00 AM
    6 rows selected.
    SQL>
    that's it......

  • Why there is no datatype which only stores date (without time part)

    Hi All,
    Is there any specific reason for not having a data type which only stores date (without time part) in ORACLE - I am asking this because DATE (without time) is a very frequently used data type in any application.
    Thanks.

    884476 wrote:
    Then why ORACLE is allowing to have scale and precision in a NUMBER data type. If I want to store an integer there is no harm in storin it just as NUMBER. But I habe option to give something like NUMBER(10). But in DATE, the time part is mandatory.a) because there's no need for seperate DATE and DATETIME datatatypes, and b) the time part is not 'mandatory'.
    SQL> create table mytable (x date);
    Table created.
    SQL> insert into mytable (x) values (to_date('01/01/1980','DD/MM/YYYY'));
    1 row created.
    SQL>The DATE datatype contains the Time as well, to make it flexible... a single datatype that can do both things without the need for any conversion between datatypes (either explicitly or implicitly).
    Yes, many application need to have fields on the screen that just show a date, such as a date of birth as you say, but that's simply a display issue, and any application interface will allow for a date format to be specified for displaying the data from the database, so in terms of such "Date only" dates, you would simply use a format mask that ignores the time portion.
    There's absolutely no issue with the fact that it's just a single datatype... it causes no problems... it's perfectly flexible at being used for just dates or for dates and times... so why such a concern?

Maybe you are looking for

  • Fi Issue

    Hello all, I have some query please solve it. The points are as follows: Whether TDS u/s 192 salary is covered in SAP or Not? 2.Under closing procedure whether daily option is available or not beside monthly and yearly? 3.Whether monthly tds certific

  • Lync 2013 Android will not sign in

    I deployed a test Lync 2013 environment on 3 Windows 2012 R2 boxes. I have one standard server, a reserves proxy and my edge server. I have able to access my Lync environment outside my network so my edge server is working correctly. I have created c

  • Letter of volatility for PXIe-1071

    I'm looking for a Letter (certificate) of Volatility for the following, please: PXIe-1071 PXIe-8135 PXIe-8234

  • How do I edit AIFC Audio files?

    I am using WireTap Pro, from Ambrosia Software, to record music off the radio. The resulting files are AIFC Audio files. How do I "cut them up" to remove unwanted sections and then join together just the material that I want? The only way I know to d

  • Opatch lsinventory  command not working

    Hello  everyone ; DB  VERSION : 10.2.0.4.0 OS : OEL 5.5 Where  can i get installed patch details  on my database ? $ pwd /u01/app/oracle/product/10.2.0/db_1/OPatch $ opatch lsinventory bash: opatch: command not found opatch lsinventory -details bash: