Update statement with Date field

I'm trying to run an update statement and I want to update the date in the format:

04/05/2010 12:31:54

If I run this query on the double it appears correctly: select the double to_char(sysdate,'DD/MM/YYYY HH12:MI:SS PM')

If I run this well query on my table, I get a 'not one month valid' error.


UPDATE WR_MEASURE_VALUE SET HOST_CORRECTED_VALUE = 35,
HOST_CORRECTED_DATE = to_char(sysdate,'DD/MM/YYYY HH12:MI:SS PM') WHERE WR_MEASURE_VALUE_OID = 474066


what I am doing wrong and how can I get my update statement to update date correctly in the ' HH12:MI JJ/MM/AAAA: SS PM' form?

Thank you


Guess all I had to say was HOST_CORRECTED_DATE = SYSDATE

Thanks anyway

Published by: Rich75 on May 5, 2010 07:10

If you want:

'UPDATE WR_MEASURE_VALUE SET ' || p_FieldToInsertUpdate || '=' || v_ValueAfterFactored || ',' ||
                                  v_DateToUpdate || '= to_date(''' || to_char(sysdate, 'dd/mm/yyyy hh12:mi:ss PM') || ''', ''dd/mm/yyyy hh12:mi:ss PM'')'||
' WHERE WR_MEASURE_VALUE_OID= ' || v_MeasureValueOID_arr(i) ||
' AND ' || v_Current_25Month_Value || ' != ' || v_DisplayValue;

But... smacks of dubious design if you do not know what columns you update at compile time, IMO.

Tags: Database

Similar Questions

  • 5.4 ACS import users with date field expiration

    Hello

    between the fields of import model file (add or update) for internal users is no column for expiration date)

    ( http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.4/user/guide/my_wkspc.html#wp1057769). This field is also set for the export file.

    My question is: (how) is it possible existing import new users (or update) internal db with expiration date field?

    --

    Martin

    Don't know if it's any consolation, but there is only a CDETS open on this issue

    CSCuf16224: no Import / Export for user internal "disable account if Date is:

    I'm not aware of any planning closed again to solve this problem

  • Update statement with joins of tables and where Clause

    Hi, I have MS SQL background and I try to execute an update statement in Oracle with joins of tables. However, the syntax below does not work but I think it works for MS SQL.

    Basically, the base table must be attached to a master table trend with monthly snapshots, an account will be only an entry for a given date monthly. Where clause must be limited to accounts within a certain range of interest rates.

    The first approach returns command SQL ORA-00933 not correctly completed, and the second approach returns ORA-01427 row below query returns multiple rows. Can anyone help? Thanks in advance!



    1:

    Update PenaltyAll
    Set a.indicator = month (b.)
    of PenaltyAll an inner join Master b on a.acctno = b.accountnumber
    where a.monthend='01/31/2009' and b.date='12/31/2008' and b.apr < 20

    2:

    Update PenaltyAll
    adjustment indicator =
    (select to_char (b., 'MM')
    of PenaltyAll an inner join Master b on a.acctno = b.accountnumber
    "where to_char (a.monthend,'mm/dd/yyyy ') = 31 January 2009"
    (et to_char(b.date,'mm/dd/yyyy') = December 31, 2008 "
    and b.apr < 20)

    Published by: sqlrookie on August 21, 2009 07:04

    I edited my post, that was my mistake, ANC you try now?

  • Problems updating default_where with date values

    Hello

    I want to update the attribute default_where with date values. the form is initialized, the attribute default_where = Lieferdatum > =: AB2.von AND Lieferdatum < =: AB2. BIS
    Then, I select the query.
    by fireing the trigger when-click of the mouse, I want to select only the witch value content items: Lieferdatum

    declare
    v_bestellnr varchar (200);
    test varchar (200);

    Start

    v_bestellnr: =: k_falschgeladen_vw. Lieferdatum;
    test: = 'LIEFERDATUM =' | v_bestellnr;
    Set_Block_Property ('K_FALSCHGELADEN_VW' test, DEFAULT_WHERE),
    EXECUTE_QUERY;

    end;

    I get the message FRM-40505 query could not be reached

    Paper copy of the formdeveloper http://www.neusob.de/~RobertKoch/dok1-Dateien/image002.jpg

    so, how can I get good value in the default_where attribute

    I hope that the: k_falschgeladen_vw. Lieferdatum is date data type. If so, try the following:

    Set_Block_Property('K_FALSCHGELADEN_VW', DEFAULT_WHERE, 'LIEFERDATUM=TO_DATE(''' || TO_CHAR(:k_falschgeladen_vw.Lieferdatum, 'DD.MM.YYYY') || ''', ''DD.MM.YYYY'')');
    EXECUTE_QUERY;
    
  • Update statement with multiple joints

    Hello

    I use Oracle 12 c and here my Question:

    /*

    ledgerstb is an Oracle the ITO (TransNo column is the primary key)

    vledgerstb_gtt is a global temporary Table

    vledgervc_gtt is a global temporary Table

    */

    UPDATE

    (, SELECT ledgerstb. TransNoVC AS TransNoVC_Old,

    vledgervc_gtt.transnovc AS TransNoVC_New

    OF ledgerstb

    INNER JOIN vledgerstb_gtt ON ledgerstb. TransNo = vledgerstb_gtt.transnostb

    INNER JOIN vledgervc_gtt ON ledgerstb. STBNo = vledgervc_gtt. STBNo

    ) T

    SET T.TransNoVC_OLD = T.TransNoVC_NEW;

    This update statement gives the following error message:

    Error report-

    ORA-01779: cannot modify a column that is mapped to a table not preserved key

    ORA-06512: at "RELYC. STBPKG', line 597

    ORA-06512: at line 201 level

    01779 00000 - 'impossible to change a column that is mapped to a non-preserved table at key'

    * Cause: An attempt was made to insert or update columns in a join finds out who

    map to a table not kept the key.

    * Action: Change the directly underlying base tables.

    For your reference, the following result internal instruction select (in blue color police) give;

    TransNo: 1 STBNo: VAAAABM315711131

    TransNo: STBNo 2: VAAAABM315711214

    TransNo: STBNo 3: VAAAABM315711262

    TransNo: STBNo 4: VAAAABM316410986

    Please suggest if I'm doing something wrong or it is not possible to update the table like that.

    (I know that I can use ForAll Update statement, but I do not want to use Collections here.)

    Thank you carine, finally I found my answer,

    the update query requires that each record that will be updated should be updated only once. so if I do join 1<->1 it updates successfully.

    Thanks to all who contributed, or at least tried. Thanks again.

  • Update statement with join other tables

    Hello
    I have two table is one that contains the xml file, basically, I need to read the xml file, then upgrade to another table based on certain conditions.
    UPDATE TRCB_XBRL_STG_2 STG 
    SET PROFIT = 
      case when xbrl.isconsolidatedacc='Y' and EXTRACTVALUE(XBRL.XBRLFILE,'//PROFIT ', 'xmlns:acra="..."') is not null
      THEN EXTRACTVALUE(XBRL.XBRLFILE,'//PROFIT ', 'xmlns:acra="..."')
      WHEN XBRL.ISCONSOLIDATEDACC='N' AND EXTRACTVALUE(XBRL.XBRLFILE,'//PROFIT ', 'xmlns:acra="..') IS NOT NULL
      THEN extractValue(XBRL.xbrlfile,'//PROFIT ', 'xmlns:acra=".."')
      ELSE STG.PROFIT
      END,
      SET REVENUE= 
      case when xbrl.isconsolidatedacc='Y' and EXTRACTVALUE(XBRL.XBRLFILE,'//REVENUE', 'xmlns:acra="..."') is not null
      THEN EXTRACTVALUE(XBRL.XBRLFILE,'//REVENUE.', 'xmlns:acra="..."')
      WHEN XBRL.ISCONSOLIDATEDACC='N' AND EXTRACTVALUE(XBRL.XBRLFILE,'//REVENUE', 'xmlns:acra="..') IS NOT NULL
      THEN extractValue(XBRL.xbrlfile,'//REVENUE', 'xmlns:acra="REVENUE"')
      ELSE STG.REVENUE
      END,
      ....
      ... (around 100 columns)
    FROM  TRCB_XBRL xbrl ,TRCB_XBRL_STG_2 STG 
    WHERE STG.XBRL_ID = XBRL.XBRL_ID 
    About 100 the number of columns, please someone suggest how to use the update with a join of two tables.

    Hello

    If all the values needed to update a given line from table_x come from the same line of table_y (or in the same row of a result set of a query on a number any of tables), then you can do something like this:

    UPDATE  table_x  x
    SET     (col1, col2, col3, ...)
    =     (
             SELECT  NVL (y.col1, x.col1)
             ,         NVL (y.col2, x.col2)
             ,         NVL (y.col3, x.col3)
             FROM    table_y  y
             WHERE   x.pkey   = y.expr
             AND         ...
         )
    WHERE   ...
    ;
    

    If the WHERE clause is based on the same line of table_y, then it will be probably easier and more efficient to use the MERGER instead of UPDATE.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the or the tables changed after the DML.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • Create dummy records using the model cluase with date field condition

    Hi all

    I have two tables below:

    create the table Interest_date

    (

    date of interest_date_field,

    Number of Interest_amount

    );

    create the table sys_date

    (type varchar2 (30),)

    date_value date

    );

    Insert all

    IN Interest_date values (to_date('01-11-2012','DD-MM-YYYY'), 20)

    IN Interest_date values (to_date('01-12-2012','DD-MM-YYYY'), 40)

    IN Interest_date values (to_date('02-01-2013','DD-MM-YYYY'), 60)

    IN Interest_date values (to_date('01-06-2013','DD-MM-YYYY'), 80)

    IN Interest_date values (to_date('01-07-2014','DD-MM-YYYY'), 10)

    IN Interest_date values (to_date('25-11-2014','DD-MM-YYYY'), 20)

    INTO SYS_DATE VALUES ('FIRST_DATE',TO_DATE('01-06-1900','DD-MM-YYYY'))--note: the year is not important but the date is used for other

    INTO SYS_DATE VALUES ('FIRST_DATE',TO_DATE('01-12-1900','DD-MM-YYYY'))--note: the year is not important but the date is used for other

    Select * twice;

    Requirement:

    I need to write a select statement that retrieves all the records in interest_date and add a dummy record according to what follows:

    -in NO case of JJ - MM interest_date_field for a given year (year group) = DD - MM of the date_value in sys_date where the type is "FIRST date"-> add a dummy record (date_value for type FIRST_DATE yyyy = year of interest_date_field, - 1)

    -in NO case of JJ - MM interest_date_field for a given year (group by year) = DD - MM of the date_value in sys_date where the type is 'SECOND DAY'-> add a dummy record (date_value for type SEOND_DATE yyyy = year of interest_date_field, - 1)

    Desired output:

    Interest_date_field Interest_amount

    06/01/2012-1

    11/01/2012 20

    12/01/2012 40

    01/02/2013 60

    06/01/2013 80

    12/01/2013-1

    06/01/2014-1

    07/01/2014 10

    25/11/2014 20

    01/12/2014-1

    Thank you very much

    Ferro

    Why not combine the first with the second approach:

    with the years as)

    Select distinct

    TO_CHAR (interest_date_field, "YYYY") y

    of Interest_date

    )

    year_dates as)

    Select

    to_date(y||) MD, 'YYYYMMDD') d

    years

    (to_char(date_value,'MMDD') md by selecting in SYS_DATE)

    )

    Select

    I have interest_date

    an interest_amount

    of interest_date

    model

    dimension (interest_date_field i)

    measures (Interest_amount a)

    rules)

    a [for i (select year_dates d)] = nvl (a [cv ()],-1)

    )

    i order

  • Update statement with a subquery

    Hello gurus,

    I am having trouble with an Update query.  Basically, I want to just update some documents in my DB Oracle (version 11.2.0.2) according to certain criteria in my WHERE clause.  That's what I have below.

    Select count (*)

    From Table_1 a, b Table_2

    Where a.unique_id = b.unique_id and b.Doc_Type = 'AP' and a.Doc_Title is null;  < == returns 540 records

    Update Table_1

    Define Doc_Title = 'data '.

    Where Doc_Title = (select a.Doc_Title

    from Table_1 a, b Table_2

    where a.unique_id = b.unique_id and b.Doc_Type = 'AP' and a.Doc_Title is null

    A.Doc_Title group);  < == lines updates 0 (I expect it, updated the 540 chronogram my query earlier than I used to check)

    Any ideas?  Thank you!

    Update Table_1 one

    Define Doc_Title = 'data '.

    When there is)

    Select 1

    in Table_2 b

    where a.unique_id = b.unique_id

    and b.Doc_Type = 'AP '.

    and a.Doc_Title is null

    )

    /

    SY.

  • Update statement with joins

    Hello
    I tried to update the 50 rows in a table using joins

    But the error
    ORA-01732 data manipulation operation not legal on this view
    But the table I worked is not a view
    update
    (
      select *
       from   (Select *from tran where tid in (select TID from isum where settld is null  and oper='ABCD')
    and rec_exists='Y' and status ='A'
    order by prd desc)
    where rownum<51
    )
    set status =null
    Please help thsis

    You cannot update a subquery. To update the table tran instead.

    To select the 50 lines you want, your logic in the WHERE clause of the nesting.

    UPDATE tran
    SET status = NULL
    WHERE ROWID IN ( SELECT ROWID
                        FROM ( SELECT ROWID
                                  FROM tran
                                 WHERE tid IN (SELECT TID FROM isum
                                                WHERE settld IS NULL
                                                  AND oper='ABCD' )
                                   AND rec_exists='Y'
                                   AND status ='A'
                                ORDER BY prd DESC)
                    WHERE ROWNUM < 51 )
    
  • If/then statement with hidden fields

    I have a form with a drop-down list field that has 3 possible values (today, tomorrow, next week). In this drop-down field is the text (TextField10) field that must be filled by the user if "Next week" is selected in the menu dropdown. I want to TextField10 to hide unless "Next week" is selected.

    For TextField10, I "this.presence ="hidden"wrote in the initialize event if it's hidden when the user opens the form. This method works.

    For the field drop-down list, I have:

    if (this.rawValue == 'Next week') then TextField10.presence = 'visible';

    endif

    written in the event exit in FormCalc. I need this in FormCalc because I have a lot of other scripts in the event already written exit in FormCalc and I don't want to have to change all the. I checked 'Specify item values' tab in the drop-down list box control liaison.

    Could someone please tell me what I'm doing wrong. TextField10 is hidden, but no matter what I select in the dropdown field never appears.

    Thank you very much for your help!

    Gene-O

    It may be recorded in a form dynamic, not sure. What's your dynamic test form?

  • Update statement with dups

    This query has worked well for me, but now the driving table (tt) has duplicates in it, due to an upgrade of database and the client wants to keep duplicates, there is value for them it...

    The problem is that now that I get, you guessed it: ORA-01427: einreihig subquery returns multiple rows

    I need help to be updated so that it can handle multiple lines, duplicates are ok.
    UPDATE /*+ PARALLEL (16) */ UPDATE_TABLE_07092011  ta
                         SET (ta.GO_TO_PERSON, ta.UPDATE_DT) = 
                                       (SELECT /*+ PARALLEL (16) */ tt.GO_TO_PERSON, SYSDATE
                                        FROM DRIVER_TABLE tt
                                        WHERE ta.cust_id = tt.cust_id
                                        AND ta.STAMP_DATE = tt.STAMP_DATE)
                          WHERE EXISTS (SELECT 1
                                       FROM  DRIVER_TABLE tt
                                       WHERE ta.cust_id = tt.cust_id
                                       AND ta.STAMP_DATE = tt.STAMP_DATE
                                       AND (NVL(ta.GO_TO_PERSON, 'X') != NVL(tt.GO_TO_PERSON, 'X')));
    Published by: Kodiak_Seattle on May 10, 2012 11:04

    How about adding "AND ROWNUM = 1" to the first subquery?

  • Strange problem with getting the handle on Date field

    Hi all
    I m facing a problem very very special, in the exercise of the labsolutions when we're going to create the page of the employee, I m trying to pull the handle on the end Date field and the Starting Date in the EmployeeCreateCO in this way

    OAMessageTextInputBean mytestbean1 = (OAMessageTextInputBean) webBean.findIndexedChildRecursive ("EndDate");

    OAMessageTextInputBean mytestbean2 = webBean.findIndexedChildRecursive (OAMessageTextInputBean) ("StartDate");

    but this line he started class cast exception, I m not able to understand why, when I tested with another area such as first name, last name, etc., it is working file, this error comes with date field only, i'm puzzeled, as id is very correct and bean type fields are also very correct.

    Thanks in advance

    thanx
    Pratap

    Pratap,

    In my opinion, using DateField. So, use OAMessageDateFieldBean instead of OAMessageTextInputBean.

    Thank you
    Kumar

    Published by: Kumar Kovela, April 29, 2009 01:58

    Published by: Kumar Kovela, April 29, 2009 01:58

  • How can I update form field with data using "on Blur.


    Perhaps also very easy for all the experts out there that you but I'm trying to update a form field with data in another field in the form when they come out the first form field.

    Basically creating a "billing" and a form "shipping" I want to be updated automatically.

    Any help would be extremely Grateful.

    Thank you

    Steve

    He does!

    shipFirstNameText.value = this.value

    It worked

  • Date field will not update

    Apex using pre-packaged "Group calendar" app I work on page 10. I updated the form to include a custom date field and added all the code to the EBA_ca_api package

    My problem is that my custom date field will not retain the value on the edition of an event. I have other custom fields that are not date fields (field numbers and text) that update without any problem...

    How can I update my date fields?

    Update:

    I am sure that the issue is somewhere in the package, the values are not updated for some reason any.

    The pre-existing app code uses this statement

    If to_char()c1.event_date_time,' DD-MON-RRRR HH:MIam ') ! = TO_CHAR ()p_event_date_time ' DD-MON-RRRR HH:MIam '( ) then

    Update EBA_ca_events

    set event_date_time = p_event_date_time

              where event_id = p_event_id ;

          end if ;


    and it works for this field when updating. I tried to use this code on my custom date field and it didn't work, so now I'm looking for something like this

    if TO_CHAR (nvl(c1.event_due_date,'0')) ! = TO_CHAR (nvl(p_event_due_date,'0')) then

    Update EBA_ca_events

    set event_due_date = p_event_due_date

               where event_id = p_event_id ;

    end if ;  -Copy the following code causes an error when you try to apply changes (not a month valid)


    Because the following code works and updates to my date no fields


    If nvl(c1.event_not1,'0')! = nvl(p_event_not1,'0') then

    Update EBA_ca_events

    Set event_not1 = p_event_not1

    where event_id = p_event_id;

    end if;

    Does the code work if I'm on the right track? -At the end of the day what I'm trying to do, it is to be able to add a date field for the application of group calendar pre-packaged on the creation form and event on page 10, and then later change this event and updated it to the database.


    Richie V wrote:

    No I did not, but do you know how to fix the error happen and allow the new field custom_date to be edited and saved in the database?

    Thereafter. The missing pieces of the puzzle were the type of the values concerned was TIMESTAMP WITH LOCAL TIMEZONE, and that type conversion had already been made in the process of page APEX. Therefore, the required code in the package:

    -- custom date code
    
    if nvl(to_char(c1.custom_date,'DD-MON-RRRR HH:MIam') , 'X')!= nvl(to_char(p_custom_date,'DD-MON-RRRR HH:MIam'), 'X')
    then
        update EBA_ca_events
        set custom_date = p_custom_date
        where event_id = p_event_id;
    end if;
    
  • Online Update Date field of the Table to SysDate

    This seems to be an easy thing to do, but I can't understand the best way to do it.

    I have a table with 2 input text areas and some areas of output text.  When either text entry box for a line change, I need to update the date in one of the text boxes in the same line to the current date. Then, when I commit the changes, the database should show the current date to this field date in this folder.

    I use JDev 11.1.1.6

    Thank you
    Ray

    I figured this out.  I used the method doDML and the Create method in the EntityImp class to set the Date field using the Set accessor method.

Maybe you are looking for

  • Want to extend the life of the battery in 5 days

    Hello Maybe it's more than a request for a new feature for the Apple Watch. I still need to use my fitbit when going hiking in the desert, because I can not connect my steps because of the battery of the watch. What I want to do is to disable all the

  • Satellite P10 - 792 HDD size instead of 60 GB 27 GB?

    Just unpacked and spent last week, install my P10-792 and now (...) I noticed that the C drive is only 27 GB while the drive itself is about 60 GB. There is a volume without the name of about the same size (27 GB).In the FAQ, I found a cure for the r

  • My Ipad 64 GB, I cannot update any application. It starts to update, but it never ends. How can I solve this?

    My Ipad 64 GB, I cannot update any application. It starts to update, but it never ends. It started with or Tube, which I had to errase, so it allows me to install again. How can I solve this?

  • WINDOWS XP3 unavailable to replace WGAN said imitations.

    It seems that MS have abandoned the manufacture of XP3, told by one of their local/regional office. They have no stocks. But the software is awailable with dealers / stores sharpened. What guarantee we have when we buy them, or, history is repeating

  • AutoCAD 2011 edition

    Hello I have a duty for a user to use AutoCAD... Is there advice / recommended measures to execute with vWorkspace Session host other applications? Note: These servers don't vGPU map there only the graphics card by default. Thank you