I want to update  timestamp(3) column with respect to varchar2

Hi all,
I have a date field column with varchar2 as datatype :
create table t1 (id number,date1 varchar2(35))
insert into (1,' 3/13/2011 10:22 AM');
insert into (2,' 3/14/2011 10:22 AM');
insert into (3,' 3/15/2011 10:22 AM');
I want to update table2
create table t1 (id number,date1 timestamp(3))
insert into (1,' ');
insert into (2,' ');
insert into (3,' ');I want to update t2 with date column in t1
can any one help me
Thanks in advance!!!!!

Hi,
846773 wrote:
Hi all,
I have a date field column with varchar2 as datatype : That's not a very good idea. You should always use a DATE or TIMESTAMP column for dates.
create table t1 (id number,date1 varchar2(35))
insert into (1,' 3/13/2011 10:22 AM');Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful.
Test them and make sure they work before you post them. You forgot the table name (after the keyword INTO).
insert into (2,' 3/14/2011 10:22 AM');
insert into (3,' 3/15/2011 10:22 AM');
I want to update table2
create table t1 (id number,date1 timestamp(3))This is the same name you used for the other table. I'll assume you meant to say t2 here, not t1.
insert into (1,' ');Don't try to insert a string (such as ' ') into a TIMESTAMP column, You can INSERT a literal NULL, or simply not INSERT anything into that column.
insert into (2,' ');
insert into (3,' ');I want to update t2 with date column in t1Use TO_TIMESTAMP to convert the string into a TIMESTAMP:
MERGE INTO     t2     dst
USING  (
           SELECT  id
        ,        TO_TIMESTAMP ( date1
                          , 'MM/DD/YYYY HH:MI AM'
                   )      AS ts
        FROM    t1
       )          src
ON     (src.id     = dst.id)
WHEN MATCHED THEN UPDATE
SET     dst.date1 = src.ts
;

Similar Messages

  • HT4802 I want to update m'y iPad with my MacBook pro it com error 9003

    I want to update m'y iPad with my MacBook pro it com error 9003

    You can share the files via your iCloud account, if they are Pages or Numbers files. You can email them as attachments to the other person, or provide them on a flash drive so they can import them on their computer.
    I would not try to copy the files direct from my computer to someone else's iPad.

  • How can I update a Site Column with the content of an array with javascript CSOM?

    I'm relative new to Sharepoint 2013, I'm trying to update the content of a Site column with the content of an array, I can retrieve and visualize the content of my site column, the user is able to change and save the necessary part and the changes are
    saved into an array, now I have to update the content of the site column with the content of the array, but for some kind of reasons I can't accomplish that, any suggestion/example? This is my code so far to retrieve, visualize the site column and store the
    mofication into my array.
        <body>
                <select id="dropdown" name="dropdown" onchange="optSelect()">
                    <option value="EngineType_Cylinders">EngineType_Cylinders</option>
                    <option value="EngineType_EngineCycle">EngineType_EngineCycle</option>
                    <option value="EngineType_EngineFamily">EngineType_EngineFamily</option>
                    <option value="EngineType_Euro">EngineType_Euro</option>
                    <option value="EngineType_FamilyEvolution">EngineType_FamilyEvolution</option>
                    <option value="EngineType_GasEmissionLevel">EngineType_GasEmissionLevel</option>
                    <option value="EngineType_Power">EngineType_Power</option>
                    <option value="EngineType_PowerSupply">EngineType_PowerSupply</option>
                    <option value="EngineType_Use">EngineType_Use</option>
                </select><br />
                <textarea id="textareadisplay" rows="25" cols="23"></textarea><br />
                <input type ="button" value="Update values" onclick="addItemsToColumns()" />
            </body>
    My Javascript
        $(function () {
            SP.SOD.executeOrDelayUntilScriptLoaded(Function.createDelegate(this, function () {
               var select = document.getElementById('dropdown').value;
                console.log(select);
                getSiteColumns(select);
            }), 'SP.js');
        var fieldChoice;
        var choices;
        var addFields = [];
        var slc;
        var clientContext;
        function optSelect() {
            slc = document.getElementById('dropdown').value;
            getSiteColumns(slc);
        function getSiteColumns(selection) {
           clientContext = SP.ClientContext.get_current();
            if (clientContext != undefined && clientContext != null) {
                var web = clientContext.get_web();
                fieldChoice = clientContext.castTo(web.get_availableFields().getByTitle(selection), SP.FieldChoice);
                clientContext.load(this.fieldChoice);
                clientContext.executeQueryAsync(Function.createDelegate(this, this.OnLoadSuccess), Function.createDelegate(this, this.OnLoadFailed));
        function OnLoadSuccess(sender, args) {
            choices = fieldChoice.get_choices();
            var textarea = document.getElementById("textareadisplay");
            textarea.value = choices.join("\n");
        function OnLoadFailed(sender, args) {
            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        function addItemsToColumns() {
            clientC = SP.ClientContext.get_current();
            var arrayForUpdate = $('#textareadisplay').val().split('\n');
            fieldChoice.set_item(, arrayForUpdate);
            fieldChoice.update();
            clientContext.executeQueryAsync(function () { }, function () { });
        function OnUpdateSuccess(sender, args) {
            var newchoices = fieldChoice.get_choices();
    My problem is on the function addItemsToColumns() please help! Thanks in advance.

    Let's look at your stylesheet -
    <style type="text/css">
    body {
    background-image: url(assets/images/Business%20Men%20In%20Reception%20Col.2.jpg);
    background-repeat: no-repeat;
    background-color: #003;
    margin-left:auto;
    margin-right:auto;
    position: relative;
    width: 960px;
    It's a good idea not to use spaces or any punctuation in your filenames when working for the web.
    #header {
    margin-left:auto;
    margin-right:auto;
    position: relative;
    width: 960px;
    #heading {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 36px;
    font-style: italic;
    font-variant: normal;
    margin-left:auto;
    margin-right:auto;
    There's no need to specify the default values (font-variant:normal) or to specify auto margins for any block element without an explicitly defined width. And wouldn't it make more sense to put the font style on the body tag, where it will inherit into the rest of the page than to restate it as you have done in the next rule?
    #bodytext {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 18px;
    line-height: 25px;
    font-variant: normal;
    width: 300px;
    #container {
    width: 960px;
    position: relative;
    margin-left:auto;
    margin-right:auto;
    .rightimg {
    float: right;
    margin-left: auto;
    padding-right: 40px;
    #heading #navbar ul li {
    padding: 30px;
    </style>
    Margin-left:auto can't work without knowing what the width of the element is....  Keep your CSS lean and targeted - it will help you to debug your layouts.

  • How to Update a particular column with custom SQL in JHeadstart

    Hi Friends,
    I was trying to keep an update SQL statement in VO (missing right Parenthesis exception is thrown)
    Please to let you know about my Requirement.
    I have a column in Sales_Person Table "TARGET' and in Sales_Admin Table "INCENTIVE"
    So Admin will allot a particular Amount in Incentive column for all the sales. (i.e globally for one and all)
    When a Sales_Person enter a target of some number say 80 in the Target field.
    while saving i want to deduct the target from incentive and the result must be update in Incentive column.
    can you please suggest me where should i keep this functionality
    Can you please help me out in solving this issue.
    Thanks in advance.
    Rahul

    Rahul,
    You can do this in the doDMl method of your Entity Object.
    See this white paper:
    http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
    If you have follow-up questions, please use the JDeveloper forum, since your question is not related to JHeadstart.
    Steven Davelaar,
    JHeadstart Team.

  • UPDATE value in column with value in SAME TABLE

    Hi all,
    Here's my issue...
    I have a table which records all incidents for a person.
    The table looks something like this:
    tbl_connect(person_Id NUMBer,
    OLD_ID VARCHAR2(24),
    CASE_NUMBER     VARCHAR2(10),
    CASE_TYPE     VARCHAR2(10),
    PERSON_ROLE     VARCHAR2(30),
    INCIDENT_TYPE     VARCHAR2(40));
    The table is populated from a source table with all fields except person_id. Person_id is a sequence number that gets generated if the person comitting the incident is a NEW PERSON to our system. OLD_Id is the unique identifier between the source table and tbl_connect to identify a person.
    The problem: If an existing person commits a new incident, a new record will be inserted into tbl_connect without PERSON_ID. Since the person already is in the database the person_id already exists in tbl_connect for that person. I now need to UPDATE person_id column with the person_id that already exists for this person. How can i achieve this.
    Ive been trying all sorts of update queries but nothing seems to work. ANy help will be appreciated. Thanks in advance.

    Frank,
    Thanks for the speedy reply. Here is a sample table.
    I know it's a bit confusing. The data that is being dumped into this table is information from a old system. The OLD_ID is in here because it is the relationship between this table and the old table. PERSON_ID is new to this system to identify a person uniquely. That is why i need them both in this table for right now.
    So say my tbl_connect got populated with new info from the old table. As you can see, old_id=567A has comitted another incident. Since he already exists in tbl_connect, now i need to update person_id with the value of 1. Does that make sense now????? If old_id did not exist, all i would do is insert a new row and set person_id to the next sequence number.
    TBL_CONNECT
    PERSON_ID OLD_ID      CASE_NUMBER CASE_TYPE          
    1     567A     12345          IR          
    1     567A     15236          MV
         567A     98547          IR<--newly inserted record of same person

  • How do you integrate a column with respect to another column

    I have two columns of data, one is time and the other is velocity. I want to be able to integrate velocity with respect to time, but I can not find a function which will let me do this. Preferably, I'd like to do a cumulative trapezoidal integration, such as the one in Matlab. The function "cumtrapz" does not work the same in mathscript as it does in matlab. The "trapz" function did not seem to integrate the columns in the way that I wanted it to, leaving me with just a number.
    Is there any way I can recreate the "cumtrapz" function from Matlab in Mathscript?
    Thanks.

    The cumtrapz in MathScript can not accept a time array as input. Then, you have to write your own script to calculate the cumulative trapezoid integration. For example, the following script generates a sin wave and calculates the cumulative trapezoidal integration.
    t = 0:0.1:pi;
    x = sin(t);
    y = 0.5*(x(1:(end-1))+x(2:end)).*(t(2:end)-t(1:(end-1)​)); %trapizoidal integration
    y = cumsum(y); %cumulative sum

  • How come my local variable is not updating it's value with respect to what's happening in the while loop?

    Hello,
    I am trying to extract data out of a while loop as my declarations update with respect to the iteration number. I have attempted to use both local variables and shift registers, but with no luck.
    I have also done the following example: http://www.ni.com/white-paper/7585/en and it works like a charm.
    I attached the PNG file with local variable declaration circled in red. Will attach a VI in the next respnose.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Local Variable.png ‏366 KB

    OK, looking at the code...
    Can you explain what it is supposed to do? What's the purpose of the value property node read which only seems to update an indicator.
    The inner while loop should proably be a FOR loop, because the number of iterations is known before the loop starts.
    Your use of formula nodes seems overly complicated.
    LabVIEW Champion . Do more with less code and in less time .

  • Query To update a date column with a date of my interest

    All,
    How to update a column in a table which is in date format with a date of my interest??
    Pls suggest.

    Please detail :
    1. what exactly you are trying to do
    2. what exactly you have done
    Nicolas.

  • Updating Object Type Columns with SQL

    Please note that is a re-post from a different forum. I thought I would try this forum as reading through it, it made more sense to post here. Problem:
    I am trying to update a column inside a Nested Table Type in my Table.
    This is what I got from some documentation I found from Oracle.
    UPDATE TABLE(SELECT PROGRAMS FROM TB_ITEM_MASTER WHERE ITEM_NO_ID =1748) IM
    SET IM.PROGRAM_ID = 1;
    WHERE IM.ITEM_NO_ID = 1748;
    Where PROGRAM_ID is a field from the nested table (ITEMS_IN_PROGRAMS_NT) and ITEM_NO_ID is the Primary Key in my TB_ITEM_MASTER table. When I run this it gives me an error of:
    ORA-22908: REFERENCE TO NULL TABLE VALUE
    I assume this is because PROGRAM_ID is currently NULL, and when it pulls the record back, I am pulling a NULL value. Currently all the values will be NULL in the table, but I would like to create a UPDATE Statement that I will call that will update that value, from NULL to whatever ID.
    Here are my def'n's of all my objects for this problem:
    --Object Type def'n
    CREATE OR REPLACE TYPE ITEMS_IN_PROGRAMS_TY AS OBJECT(
    PROGRAM_ID NUMBER(38));
    --Object Type def'n for Nested Table
    CREATE OR REPLACE TYPE ITEMS_IN_PROGRAMS_NT
    AS TABLE OF ITEMS_IN_PROGRAMS_TY;
    --Table def'n
    CREATE TABLE TB_ITEM_MASTER
    (ITEM_NO_ID NUMBER(38) NOT NULL,
    ITEM_NO VARCHAR2(75) NOT NULL,
    NOMENCLATURE VARCHAR2(100) NULL,
    PROGRAMS DMISDBA.ITEMS_IN_PROGRAMS_NT NULL);
    Can someone please help me....I am pulling my hair out on this problem!!! All I want to do is update the column inside a Nested Table. This can not be that hard!!!

    Save your hair...
    SQL> CREATE OR REPLACE TYPE items_in_programs_ty AS OBJECT(
      2  program_id NUMBER(38));
      3  /
    Type created.
    SQL> CREATE OR REPLACE TYPE items_in_programs_nt
      2  AS TABLE OF items_in_programs_ty;
      3  /
    Type created.
    SQL> CREATE TABLE tb_item_master
      2  (item_no_id number(38) not null,
      3  item_no varchar2(75) not null,
      4  nomenclature varchar2(100) null,
      5  programs items_in_programs_nt )
      6  NESTED TABLE programs STORE AS nested_programs
      7  /
    Table created.
    SQL>
    SQL> INSERT INTO tb_item_master (item_no_id, item_no, nomenclature)
      2  VALUES (1748, 'APC/1748', 'Gizmo')
      3  /
    1 row created.
    SQL> UPDATE tb_item_master tmi
      2  SET    tmi.programs =  items_in_programs_nt(items_in_programs_ty( 1))
      3  WHERE  tmi.item_no = 'APC/1748'
      4  /
    1 row updated.
    SQL>
    SQL> Cheers, APC

  • Stored procedure to update particular key column with increment of +1

    Hi,
    This is my table
    EMPID,NAME
    1 SSS
    2 AAA
    I NEED STORED PROCEDURE TO UPDATE EMPID WITH INCREMENT OF +1.BASED ON
    MAX(EMPID).fOr example if i execute stored procedure once it will update empid 2 as 3,
    if i run same procedure again it will take increment +1 then emp id should be 4 like that i want output.
    Any one please help me on this scenario...

    937506 wrote:
    Hi All,
    I have two tables,one is date dimension table,one is fact table.
    when we load data through informatica (source as csv file),then key will be populated in fact table based on lookup on
    date dimension table.it will create corresponding date key in fact table.
    My scenario:we load data in to fact table with etl with "n" number of records only once at a time.
    But next time onwords we will update that datekey in fact table through stored procedure.stored procedure
    will take only max(date_key) from fact table then update that key as like +1(logic n+1)
    If i run stored procedure nextday it will update that record with increment +1.
    we wil schedule this storedprocedure to run daily once.For this i need stored procedure..
    I think you will clear now................
    thxSo, are you saying you want to keep the same data you loaded "yesterday" but update the date_key so it appears as if it was from today?
    Still seems strange: why aren't you loading today's data?
    Also, you are assuming that the date_key in the date dimension table increments with no gaps: if it was sequence generated, that might not be true.

  • HT4061 wanted to update my Ipad 2 with the iSO 7.0...and can not restared my ipad anymore, is in recovery mood . Please advice

    was trying to update my ipad with iOS 7.0.2, but went in recovery mode and have no idea what happen, because can not be switch on anymore.There is all the time the sign of itunes. Tryed to connect to iTunes in the PC and it says that I have to restore...I did even that but no results...can anybody advice....

    Thanks, I was really hoping this was possible though.

  • How to select the column with respect to language in sql server

    USE Master
    SELECT * FROM SysMessages
    GO
    when i execute the above query, in description column am getting English and Chinese , here if i want to select only English .
    how can i select only English language by using WHERE condition.
    And why am getting data in Description column in Chinese also any reason behind it.
    If there is any reason please suggest me.

    Bro , here am not getting what is Unicode and all
    Specially ,
    Why does we need N' string ' while inserting and Why we need to place N and String in Unicode while inserting data and what does it mean.
    Insert into T1 Values
    (N'找不到由給定的 @article 或 @artid ''%1!'' 所參考的物件。'),
    (N'Unclosed quotation mark after the character string .')

  • Need to update a single column in a table with some other column value

    Hi experts,
    I was about to change one column data type in a table. Then I renamed that column name to "old_column_name" . Later I added new column name with required datatype( My case its NCLOB). Now I want to update the new column value with old column value.I mean i have to copy the data. But data amount is very huge. Its more than 1.5 crores of data. But on promote day, I have only 1 hr of outage. Please suggest the effective solution to achieve this.

    Hi Stew
    I have 1 primary key in my table and 11 foreign keys in my table.there are 20 check constraints as well.
    If i go for an online redefine of a table, these objects will be created back automatically?
    Please clarify.
    This is my table. Here Remarks is the column with CLOB datatype. To support multi language, I need to change it to NCLOB. That column having data so i cant rename it.
    So I added new column , after renaming that remarks to old_remarks. Now new column remarks is ready with NCLOB data type, but no data in it.
    To copy the old remarks column into new remarks column, i thought to write one script. But how it is achievable using "DBMS_REDEFINITION". Please explain me,
    create table XXXXXXXXXX
    ID NUMBER(8),
    COMPLETED_DATE DATE,
    COMMUNICATION_MEDIUM VARCHAR2(32),
    REMARKS1 VARCHAR2(4000),
    COPY VARCHAR2(1),
    IO_MARKER VARCHAR2(3),
    EVENT_DATE DATE,
    CON_REF_NO NUMBER(8),
    DEP_CODE VARCHAR2(6),
    SFM_STAFF_NO NUMBER(8),
    CRPD_ID NUMBER(8),
    CRPD_ID_COPY NUMBER(8),
    STATUS VARCHAR2(2),
    COMEBACK_NO NUMBER(2),
    ADD_ADD_ID NUMBER(10),
    AEV_ID NUMBER(8),
    OLAY_ID NUMBER(8),
    COE_TYPE VARCHAR2(3),
    CET_CODE VARCHAR2(6),
    DEP_CODE_RAISED_BY VARCHAR2(6),
    SFM_STAFF_NO_RAISED_BY NUMBER(8),
    USR_CREATED VARCHAR2(30),
    CREATED DATE,
    USR_CHANGED VARCHAR2(30),
    CHANGED DATE,
    EXT_REF_ID VARCHAR2(150),
    REPLY_EXPECTED_DATE DATE,
    SEC_ID VARCHAR2(8) not null,
    PROTECTED VARCHAR2(1),
    APPROVED_BY NUMBER(8),
    DOCUMENT BLOB,
    OLD_REMARKS CLOB,
    CTS_ID NUMBER(8),
    MESSAGE_STATUS VARCHAR2(4),
    WORD_DOCUMENT NCLOB,
    REMARKS NCLOB
    Edited by: Hema on Jul 2, 2012 8:31 AM
    Edited by: Hema on Jul 2, 2012 8:31 AM

  • Need help in updating "TIMESTAMP" column

    Hi,
    Below is my table description, i want to update timestamp column but i could not able to do, please help me on this.
    ID VARCHAR2(4 BYTE),
    TYPE VARCHAR2(1 BYTE),
    DATET TIMESTAMP(6),
    TYPE NUMBER
    Currently i have value "5/1/2009 9:00:00.000000 AM" for DATET column, now i want to update it to "5/1/2009 9:00:00.000000 PM". Please help me out.
    Thanks.

    Hi,
    Here's one way:
    UPDATE     table_x
    SET     datet     = datet + INTERVAL '12' HOUR
    WHERE     datet     = TO_TIMESTAMP ( '01/05/2009 09:00:00'
                          , 'DD/MM/YYYY HH24:MI:SS'     -- or whatever
                          );

  • Update column with ROW_NUMBER() value

    I have a column that I would like to update with a ROW_NUMBER() value partitioned by a specific column.
    CREATE TABLE ##tmp (id INT NULL,
    value1 VARCHAR(10),
    value2 VARCHAR(10))
    INSERT INTO ##tmp (value1,
    value2)
    VALUES ('A', 'asdfasdf'),
    ('A', 'asdf'),
    ('A', 'VC'),
    ('B', 'aasdf'),
    ('C', 'sdfgs'),
    ('C', 'xdfbhsdty'),
    ('C', '23sdgfg'),
    ('C', '234')
    -- update the ID column with the values below
    SELECT ROW_NUMBER() OVER (PARTITION BY Value1 ORDER BY Value2),
    Value1,
    Value2
    FROM ##tmp
    I have 14 million records.  Can someone explain the best way to do this?  Does the ORDER BY destroy performance for this many records?
    Thanks!

    CREATE TABLE ##tmp (id INT NULL,
    value1 VARCHAR(10),
    value2 VARCHAR(10))
    INSERT INTO ##tmp (value1,
    value2)
    VALUES ('A', 'asdfasdf'),
    ('A', 'asdf'),
    ('A', 'VC'),
    ('B', 'aasdf'),
    ('C', 'sdfgs'),
    ('C', 'xdfbhsdty'),
    ('C', '23sdgfg'),
    ('C', '234')
    -- update the ID column with the values below
    ; with cte as (
    SELECT ROW_NUMBER() OVER (PARTITION BY Value1 ORDER BY Value2) as RowNumber,
    Value1,
    Value2
    FROM ##tmp
    update cte
    set Id = RowNumber;
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

Maybe you are looking for