Convert from timestamp to date in a table

Hi All,
I have a table in oracle 10g r2.
I want to convert from time-stamp to date in a column of my table.
The table contain 10 million records.Please help me out with the easiest way to proceed.
Thanks in advance
USR0072

Add a date column to the table
run an UPDATE statement to update the date column from the timestamp column
mark the timestamp column unused (or drop the column)

Similar Messages

  • Cannot convert from java.util.Date to java.sql.Date

    In the below code am trying to get the current date and 60 days prior date:
    Date  todayDate;
              Date  Sixtydaysprior;
              String DATE_FORMAT = "MM/dd/yy";
              DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
             Calendar cal = Calendar.getInstance();
              todayDate = sdf.parse(sdf.format(cal.getTime()));
              cal.add(Calendar.DATE, -60);
             Sixtydaysprior = sdf.parse(sdf.format(cal.getTime()));I have imported following files:
    <%@page
         import="java.util.Calendar,
                   java.text.SimpleDateFormat,
                   java.text.ParseException,
                            java.util.*"
    %>Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    Thanks.
    Edited by: MiltonDetroja on May 22, 2009 11:03 AM

    Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    I don't think this exception is thrown from the portion of code you have shown. As clearly specified in exception message, you cannot cast an instance of java.util.Date to java.sql.Date. you will need to do something like this
    java.util.Date today = new java.util.Date();
    long t = today.getTime();
    java.sql.Date dt = new java.sql.Date(t);

  • How can I convert from Modbus raw data to engineering units using a formula?

    Within Lookout, I have several Modbus numerical input types that do not have a linear corespondence to the Engineering values they represent.  How can I display these values accurately using a formula to convert from the raw data to an engineering value?

    I don't quite understand your reply.  I'm using Lookout 6.0.2, logged in as Administrator, in Edit Mode.  The Modbus object is named RTU06_SAV.  The Active member is 30002 with an alias of SAVfmSMT_RSL.
    Following your instructions, I opened Object Explorer and right-clicked on RTU06_SAV. 
    This opened a menu containing:  Refresh, Cut, Copy, Rename, Delete, Edit connections..., Edit Data Member Configuration, Configure Network Security and Properties.
    I assumed that I should select Edit Data Member Configuration, but maybe I'm wrong. 
    Within Data Member Configuration I can set up Linear Scaling between Raw data and Engineering data.  I know how to do that, but what I need to know is how to convert Raw data to Engineering data using a formula representing a non-linear transformation (such as a converion to a logarithmic value or perhaps a formula derived by fitting the formula to a curve on a calibration chart).
    Once I have this my Engineering data can be represented on a control panel as both a numeric value AND as a correctly reading Gauge.  It can also be properly represented on a HyperTrend graph.
    What do you suggest?

  • Conversion from timestamp to date

    Hi All,
    Does anyone know how to convert a timestamp value to a date???
    Any help is appreciated

    I want to send the value as a date. This is because
    in other .java file i accept this value as
    java.sql.Date as a parameterWhy do you have java.sql.Timestamp objects then?
    Why not directly getting java.sql.Date object from database?
    Why do your java classes use java.sql.Date instead of java.util.Date?

  • Convert from NUMBER to DATE

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

    Hi,
    Unfortunately, TO_DATE doesn't accept NUMBERs as arguments. You have to convert them to characters first, like this:
    SELECT  TO_DATE ( TO_CHAR (month, '00') ||
                      TO_CHAR (day,   '00') ||
                      TO_CHAR (year,  '0000)     -- not '00', as originally posted
                    , ' MM DD YYYY'
    FROM  DATA_TABLE;Edited by: Frank Kulash on Jan 15, 2009 10:18 AM
    This assumed the full year was stored, e.g. 2009. It turns out that OP is actually storing only the last two digits, which caused ORA-01841 errors. In that case
    code}
    SELECT TO_DATE ( TO_CHAR (month, '00') ||
    TO_CHAR (day, '00') ||
    TO_CHAR (year, '00)
    , ' MM DD RR'
    FROM DATA_TABLE;
    is correct.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to convert from line chart data to CSV format

    Hi ,
    I am using Flex 3 and AS.
    I am getting data from MS SQL and display the data as line
    chart this is ok.
    But i want to convert this line chart data to CSV or .xsl
    format.I find one example in fourms the from data grid to CSV
    For this URL is
    http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagriddataexporter.php
    But i want Line chart to CSV.Please help me.

    Line chart is a just a visual representation of some data
    that's sitting in your database. Isn't it? You load this in Flex,
    probably using HTTPService class, and pass it to some chart object.
    Now when use says that she needs it in CSV format, you're
    gonna have to send another request to the server to produce the
    same data, convert into CSV or XLS format and let user download it.
    Of course, if use doesn't want to download, you don't have to
    go to the server, at least for CSV format. You can convert the same
    data that used plot the chart to convert to CSV.
    Am I missing something here?
    ATTA

  • How to convert a timestamp to date/time in CDS View?

    Dear experts,
    I would like to convert a timestamp to a date and time within a CDS view.
    This is what I tried to do:
    Cast (Cast(<timestamp> as abap.dec(8,0)) as abap.dats) as <date>
    I also thought about first converting the timestamp into a plain numerical character, then using substring and then casting it to abap.dats. Then its giving me an error that says: "dec can't be converted into numc".
    The above written code also throws an error - "function not allowed/ no cast within a cast".
    It is quite nasty not being able to write a cast within a cast - how else am i supposed to achieve a date here?
    I am looking forward to have your answers!
    Thanks and BR
    Anja

    Hi Anja,
    what you try to do is currently not possible, a feature not available in CDS views.
    Yet it surely is a feature, ABAP developers would like to see on the feature request list .
    Cheers,
      Jasmin

  • Convert Creationtime column to date format in table cwsys.cw_workspaces_tab

    How to convert the creationtime column value to date in the table cwsys.cw_workspaces_table using sql or otherwise.
    -Tarun

    I'm pretty interested in this one as several reports can be created using this field, any inside help??

  • How to convert the flat file data into sap tables . ?

    how to upload flat file data into sap table . before upload mapping is also there in some filds . any one can give me some steps how to upload and mapping . ?

    Hi
    See the sample code
    REPORT zmmupload.
    Internal Table for Upload Data
    DATA: i_mara like MARA occurs 0 with header line
    PARAMETERS: p_file LIKE ibipparms-path.  " Filename
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    Upload the File into internal Table
      CALL FUNCTION 'UPLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
        TABLES
          data_tab                = i_mara
        EXCEPTIONS
          conversion_error        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          OTHERS                  = 7.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Upload the Data from Internal Table
      MODIFY MARA from TABLE i_MARA.
    Regards
    Anji.

  • Bug when converting from text to date

    Hello Guys,
    I have a table with about 700 rows and the first column is for date.
    Most rows correctly have the cell content as date, but some rows show it as text, and even when I try to change it to date, nothing happens. It sticks as text.
    Main problem is I can't sort correctly of even do calculations.
    For me it really seems to be a bug.
    The only solution I see is to create a new column to convert the values with formula, but this is a shame to need to do this to workaround such simple bug.
    Best regards,
    Bruno

    Hi Wayne,
    LOL.
    Here's the cell that came from text file exactly like the next one. After setting as date in the format panel, it stays as expected:
    The row below came from another paste from the same text file, but it insists on not becoming date:
    After setting date, and leaving the cell selection, it goes back to "Automatic".
    In the bar at the bottom, it is shown as "Text".
    I have already tried to select the entire column and set as Date, and also to do it individually, but only some are converted. Other stays as Texts.
    Best regards,
    Bruno

  • Convert from String to Date for storing in SQL Server 2000

    Hi,
    I've accepted some values from a user using a form in HTML.Now using Servlets I transfer the value to my java code .
    I want to know how can I convert a DATE accepted from the user thats presently in "String" format to the "datetime" format for SQL Server2000.
    Please guide me with some steps and I shall be grateful.
    Thanks

    The java.text.SImpleDateFormat class is most probably of use.
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    String enteredDate = "25/12/2006";
    java.util.Date utilDate = sdf.parse(enteredDate);
    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());You can then use the java.sql.Date with the "setDate()" method of a prepared statement. This method would be database independant, as you are setting an actual date, not depending on a specific format on the database end.

  • Imp into Dev from Prod - schemas, data only, truncate tables

    Hello,
    I am going to impdp from Prod to Dev. This is a data only import. I plan to do a schema impdp. This is the command I plan to use:
    impdp system/password schemas=user1,user2,user3,user4 directory=dir_123
    logfile=imp123.log dumpfile=dump123.dmp content=data_only table_exists_action=truncate
    1) Do I need to disable the contraints/triggers in Dev before doing impdp?
    Is disabling contraints necessary in Dev since the contraints in Prod have no violations?
    2) What is going to happen if in Dev the objects already exist? For example, an index on a table, would this index be over written during the impdp? Or do I drop the index in Dev prior to the import and then let the import create new ones?
    3) What impdp options should I use, if I only want to truncate the tables belonging to the schemas being imported? What about existing objects, such as indexes, what is going to happen to the existing objects? Are they going to be over-written by the impdp?

    Hello,
    I am going to impdp from Prod to Dev. This is a data only import. I plan to do a schema impdp. This is the command I plan to use:
    impdp system/password schemas=user1,user2,user3,user4 directory=dir_123
    logfile=imp123.log dumpfile=dump123.dmp content=data_only table_exists_action=truncate
    1) Do I need to disable the contraints/triggers in Dev before doing impdp?
    Is disabling contraints necessary in Dev since the contraints in Prod have no violations?
    2) What is going to happen if in Dev the objects already exist? For example, an index on a table, would this index be over written during the impdp? Or do I drop the index in Dev prior to the import and then let the import create new ones?
    3) What impdp options should I use, if I only want to truncate the tables belonging to the schemas being imported? What about existing objects, such as indexes, what is going to happen to the existing objects? Are they going to be over-written by the impdp?

  • Need you help !!! -- Convertion from Char to Date

    Dear experts:
    I am new to abap and here is one thing need your help:
    Currently I have a char type field defined in the source table, after I retrive this field into my work area, I need to convert it to Date type and then calculate the last day of this date.
    for example: WA_TEST-CHAR = '20100801'. This value in orignal ECC table is char type.
    Then How can I convert this value to a date type, and calculate its last day?
    My expected result is "20100731".
    BTW, does anybody know how to convert a date type field to a number type field like To_number() or something?. If I need to get the period between 2 different date, how can I get this?
    Any post will be appreciate and thank you all in advance!
    Best Regards
    Tim
    Moderator message: sorry, date conversion and date calculation are very basic and FAQs, please search for available answers, also read ABAP online documentation.
    locked by: Thomas Zloch on Aug 23, 2010 9:56 AM

    Hi,
    For your question:
    BTW, does anybody know how to convert a date type field to a number type field like To_number() or something?. If I need to get the period between 2 different date, how can I get this?
    use this FM FIMA_DAYS_AND_MONTHS_AND_YEARS.
    regards,

  • Converting unix timestamp to date after Daylight Saving Time change

    Hello,
    in one of the products we use the internal scheduler stores dates (and times) in an Unix-like format, that is seconds since 1st of January 1970. We have used this SQL to extract the actual date:
    TO_CHAR(t.next_fire_time/(24*60*60*1000) +to_date('19700101020000','yyyymmddhh24miss'),'yyyymmddhh24miss')
    Everything worked fine until the time has changed this weekend from UTC+2 to UTC+1 (we are located in Eastern Europe). Since then the query above returns one hour later than it should.
    I.e. timestamp *1320067800000* is returned as *20111031153000* even thought correct is (and the actual time the event was scheduled) *31-OCT-11 02.30.16.000000 PM*
    I found queries like this on different forums and no one seems to worry much about the daylight savings. Is this a configuration issue in the DB or is it a bug in our code?
    I tried selecting the SESSIONTIMEZONE and DBTIMEZONE and both were +1.
    Any help appreciated.

    Your problem is hard-coded 2hour offset:
    to_date('19700101<font size=5 color=red>02</font>0000','yyyymmddhh24miss')You need to calculate current offset to adjust it to current DST situation:
    with sample_table as (
                          select date '1970-01-01' + 1320067800000 / 1000 / 3600 / 24 dt_utc from dual
    select  dt_utc,
            dt_utc +
            extract(
                         timezone_hour
                    from
                         from_tz(cast(dt_utc as timestamp),'utc') at time zone 'Europe/Prague'
                   ) / 24 dt_prague,
            extract(
                         timezone_hour
                    from
                         from_tz(cast(dt_utc as timestamp),'utc') at time zone 'Europe/Prague'
                   ) tz_offset
      from  sample_table
    DT_UTC              DT_PRAGUE            TZ_OFFSET
    2011-10-31 13:30:00 2011-10-31 14:30:00          1
    SQL> SY.

  • Converting from the windows date format

    Folks,
    I have no doubt this has been answered before somewhere in deep dark recesses of these forums, but I'm having trouble finding a solution...
    I have a csv file that contains a date and time field that has been stored in what I gather is a Microsoft format whereby the date and time are represented as a flaoting point number. The data can look something like 38410.25 which turns out to be 27/02/2005 06:00:00. Anyone been through this movie before?
    Thanks,
    overcanyon.

    Peter,
    From snippets I've seen about the place, the microsfot calendar started in 1 jan 1900. I'm not even gonna think about the timezone but there is leap years an' stuff to think about and I'm feeling lazy in a kinda 'this code must be done before sorta way'.
    You're making me feel guilty now. Like maybe there's not as much to it as I think.
    Nah, thinking about leap years is makin' my brain ache. Yeah, Y2K flashbacks comin' on...
    Any takers on where a ready made class might be living? :)
    overcanyon

Maybe you are looking for

  • Can I print wireless from iphone

    Can I print wirelessly from iphone 4 to my wireless home printer?  Thanks!

  • How to use Bapi BAPI_ACC_DOCUMENT_POST for g/l account document posting

    Hi all, I am using BAPI_ACC_DOCUMENT_POST bapi for g/l account documents posting.as I am first time using BAPI in my program.can anyone give details about how to use this BAPI for document postings.what importing parameters need to be passed , which

  • Reg. Calender in SAP CRM

    Hi Gurus, I have an issue with regarding the calender for one employee. One of the employee has appointments in his SAP mobile calender. But in his calendar no data available. Could you please give me your views regarding this issue. Swift responeses

  • Attaching the same function to multiple mouse actions

    Please excuse my ignorance, I'm trying to learn, and upgrade my old way of doing things. If I am going about this all wrong, please let me know. I'm attaching my code below. My question is, how do I trigger this function with different mouse interact

  • What is this technique

    I am still trying to improve my professional photographer skills and I would really appreciate if someone could please point me to a tutorial on how i can achieve an image such as this?