Help automate an UPDATE Statement with PL/SQL

Hello, I am on 10g R2, I am slowly learning PL/SQL, got a few books, watching videos on youtube and other things about like Best Practices and etc. I wanted to automate this SQL:
Basically each month I have to update a whole bunch of older Tables against the current months Table.
Older Table = ta
Newer Table = tt
I was thinking maybe I can like put into a list (like an array), and list all the older tables in there for ta, I have 26 so far and each month I add +1.
The tt table is just one, that's why I was thinking I could automate that inside a loop ?
UPDATE OLDER_TABLE_DATE ta
SET (ta.GTP, ta.UPDATE_DT) =
     (SELECT tt.GTP, SYSDATE
      FROM NEWEST_TABLE_UPDATED tt
      WHERE ta.customer_id = tt.customer_id
      AND ta.STAMP_DATE = tt.STAMP_DATE)
WHERE EXISTS (SELECT 1
        FROM NEWEST_TABLE_UPDATED tt
        WHERE ta.customer_id = tt.customer_id
        AND ta.STAMP_DATE = tt.STAMP_DATE
        AND (NVL(ta.GTP, 'X') != NVL(tt.GTP, 'X')));
COMMIT;What do you guys think ? example or help would be appreciated. I can run this as an anonymous block for now, that's fine, thank you!

Assumptions:-
-Your all old/new tables are in same schema.
- Their names have word "OLDER".
- You will run the procedure from the same schema where all old and new tables exits.
NOTE: - Please handle exceptions in the given code accordingly, for example, when update fails then handle the exceptions.
-As mention earlier, this approach does not sound very good. A good solution will be change in design such a way that one table(partition on months) stores all the monthly data.
CREATE OR REPLACE PROCEDURE UPDATE_TABLES_PROC
AS
cursor c1 is
select table_name from user_tables
where table_name like '%OLDER%';
type t_current_table is table of c1%rowtype;
v_current_table t_current_table;
SQL_STMT VARCHAR2(3000):=0;
BEGIN
OPEN C1;
LOOP
    FETCH C1 BULK COLLECT INTO  v_current_table  LIMIT 10;
    IF v_current_table.count>0 then
    FOR i in v_current_table .first..v_current_table .last
    LOOP
    SQL_STMT:='UPDATE ' ||v_current_table(i).table_name|| ' ta
                     SET (ta.GTP, ta.UPDATE_DT) =
                                   (SELECT tt.GTP, SYSDATE
                                    FROM NEWEST_TABLE_UPDATED tt
                                    WHERE ta.customer_id = tt.customer_id
                                   AND ta.STAMP_DATE = tt.STAMP_DATE)
                      WHERE EXISTS (SELECT 1
                                   FROM NEWEST_TABLE_UPDATED tt
                                   WHERE ta.customer_id = tt.customer_id
                                   AND ta.STAMP_DATE = tt.STAMP_DATE
                                   AND (NVL(ta.GTP, ''X'') != NVL(tt.GTP, ''X'')))';
    EXECUTE IMMEDIATE SQL_STMT;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    END IF;
COMMIT;
EXIT WHEN c1%NOTFOUND;
END LOOP;
CLOSE C1;
END UPDATE_TABLES_PROC;

Similar Messages

  • Dynamic Update Statement in Native SQL

    Hi Experts,
    I want to dynamically pass the field in Update statement in Native SQL. For eg.
    data: str1 type string.
    str1 = 'MARKETS'.
    EXEC SQL.
          UPDATE PRDT.TBVEHDS4 SET (str1) = :'U'
          WHERE  VEH_NO       =  :'K1WK-54520'
          AND    SEGMENT_NO   =  :'01'
    ENDEXEC.
    But this is not taking (str1) as MARKETS field to update as U , its taking STR1 itself, Giving native SQL exception as Invalid Token as we are using DB2 as external DB system.
    I checked with field-symbols also, but nothing helped.
    Please help, thanks in Advance.
    Regards,
    Abhishek

    Hi,
    Check this demo program in SE38  ADBC_DEMO, take as example to construct your own dynamic native sql
    Regards,
    Felipe

  • Update statement with inner join

    Hello everyone. I am am trying to do an update statement with an inner join. I have found several examples of SQL statements that work with Sql server and mysql but they don't work in Oracle. Does anyone know the proper way in Oracle 10G? I am trying to update all fields in one table from fields in another table.
    for example:
    UPDATE table3
    SET
    TL3.name = TL2.name,
    TL3.status = TL2.status,
    TL3.date = TL2.date
    FROM table3 TL3 JOIN table2 TL2
    ON (TL3.unique_id = TL2.unique_id);
    any help will be appreciated.

    Hi,
    You can also use MERGE, like this:
    MERGE INTO  table3     dst
    USING   (
             SELECT  unique_id
             ,         name
             ,         status
             ,         dt          -- DATE is not a good column name
             FROM    table2
         )          src
    ON     (dst.unique_id     = src.unique_id)
    WHEN MATCHED THEN UPDATE
    SET     dst.name     = src.name
    ,     dst.status     = src.status
    ,     dst.dt          = src.dt
    ;Unlike UPDATE, this lets you avoid essentially doing the same sub-query twice: once in the SET clause and then again in the WHERE clause.
    Like UPDATE, you don't acutally join the table being changed (table3 in this case) to the other table(s); that is, the FROM clause of the suib-query does not include table3.
    Riedelme is right; you'll get better response to SQL questions like this in the SQL and PL/SQL forum:
    PL/SQL

  • Update statement with joins

    Hi all, consider the tables and data below
    CREATE TABLE table1 (id NUMBER, a NUMBER, b NUMBER) ;
    CREATE TABLE table2 (id NUMBER, c NUMBER, d NUMBER);
    INSERT INTO table1 VALUES(111,2,0);
    INSERT INTO table1 VALUES(111,1,2);
    INSERT INTO table1 VALUES(111,1,3);
    INSERT INTO table1 VALUES(222,1,3);
    INSERT INTO table2 VALUES(111,5,8);
    INSERT INTO table2 VALUES(222,6,7);
    what i want to do is write a UPDATE STATEMENT that joins the two tables BY id
    and update table1 rows. i want to include the following CASE statement
    UPDATE COLUMN a intable1 according to this logic
    case
    WHEN b >0
    THEN nvl(c,b)
    ELSE
    d
    END
    so table1 after the update should look like this
    id    a   b
    111   8   0
    111   5   2
    111   5   3
    222   6   3can somebody help write a update statement that update table1 according to case statement and joins both tables to get the values necessary? thanks

    Hooray for sample tables!
    SQL> alter table table2 add constraint table2_pk primary key (id);
    Table altered.
    SQL> update
      2     (select t1.a
      3            ,case when t1.b > 0 then nvl(t2.c, t1.b)
      4                  else t2.d
      5             end new_value
      6      from   table1 t1
      7      join   table2 t2
      8             on t1.id = t2.id
      9     )
    10  set a = new_value;
    4 rows updated.
    SQL> select * from table1;
                      ID                    A                    B
                     111                    8                    0
                     111                    5                    2
                     111                    5                    3
                     222                    6                    3

  • Update statement with joining other tables

    Hi ,
    I have two table one is containing xml file , basically i need to read from those xml file then update to another table based on some condition.
    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 Number of columns are around 100 , please anyone suggest how to use update statement with joining two tables.

    Hi,
    If all the values needed to update a given row of table_x are coming from the same row of table_y (or from the same row of a result set of a query involving any number 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 depends on the same row of table_y, then it will probably be simpler and more efficient to use MERGE instead of UPDATE.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Adobe automatic flash update crashes with error

    This is a frequently recurring, time wasting problem. When will Adobe get the update installation right ?
    Doesn't happen with any other update from any other vendor. Frustrating!
    XP Pro SP3
    Error detail:
    Line:     1
    Char:    13976
    Code:    0
    URL:     ...\index.js
    What to do ?
    Pradip_A

    Aside from the Flash update failure on my Desktop, I still can't fathom why
    I haven't been able to install Flash ever on my HP Compaq Pressario 1000 Laptop ever.
    This too sports XP Pro SP3 IE8.
    If you have any ideas on this other problem, please let me know.
    Thanks,
    Pradip.
    To repeat:
    The original post on this current thread stareted with the crash showing a notification window
    with the error Object Expected and the following detail:
    Line:     1
    Char:    13976
    Code:   0
    URL:     ...\index.js
    Here's the requested log file:
    2012-9-15+12-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+17-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+20-20-15.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+21-20-15.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+22-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-15+23-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+0-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+11-20-0.156 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+13-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+15-20-16.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+17-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-16+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+0-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+10-20-15.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+11-20-15.156 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+12-20-15.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+13-20-15.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+14-20-15.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+15-20-15.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+16-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+17-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-17+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+0-20-15.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+10-20-0.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+11-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+12-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+14-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+16-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+17-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+19-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+21-20-0.15 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+22-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-18+23-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+0-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+1-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+2-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+10-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+11-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+12-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+17-20-0.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+19-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+21-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+22-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-19+23-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+9-20-15.625 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+10-20-0.218 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+11-20-0.59 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+12-20-0.43 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+13-20-0.59 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+14-20-0.43 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+15-20-0.137 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+16-20-0.43 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+17-20-0.59 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+20-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+21-20-15.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+22-20-15.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-20+23-20-15.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+7-20-15.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+8-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+9-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+11-20-0.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+14-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+17-20-15.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-21+23-20-15.140 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-22+9-20-15.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-22+10-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-22+11-20-15.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-22+12-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-22+18-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+11-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+15-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+17-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+21-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+22-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-23+23-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+0-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+1-20-0.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+2-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+8-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+9-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+10-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+15-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+16-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+17-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+20-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+21-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+22-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-24+23-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+0-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+10-20-0.156 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+11-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+12-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+16-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+17-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+18-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-25+19-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+0-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+1-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+9-20-0.140 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+10-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+11-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+14-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+15-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+17-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+20-20-15.171 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+21-20-15.15 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+22-20-15.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-26+23-20-15.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+0-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+5-20-18.390 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+6-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+7-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+8-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+12-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+14-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+16-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+17-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+18-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+20-20-15.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+21-20-15.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+22-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-27+23-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+0-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+9-20-15.359 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+10-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+11-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+21-20-0.141 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+22-20-0.32 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-28+23-20-0.32 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+0-20-0.32 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+1-20-0.48 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+9-20-15.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+10-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+11-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+12-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+15-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+17-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+20-20-15.875 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+21-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+22-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-29+23-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+10-20-15.140 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+11-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+12-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+13-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+15-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+17-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+21-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+22-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-9-30+23-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+0-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+1-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+2-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+3-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+11-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+17-20-0.140 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+21-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+22-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-1+23-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+0-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+10-20-15.140 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+11-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+12-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+13-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+16-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+17-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-2+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+0-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+10-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+11-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+12-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+17-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+19-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-3+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-4+0-20-15.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-4+11-20-0.156 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-4+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-4+13-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+0-20-0.140 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+8-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+9-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+10-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+11-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+12-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+19-20-15.156 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+20-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+21-20-0.53 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+22-20-0.37 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-5+23-20-0.115 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+0-20-0.37 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+1-20-0.53 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+7-20-15.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+8-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+9-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+10-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+11-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+13-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+15-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+16-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+17-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+20-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+21-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+22-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-6+23-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+0-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+1-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+2-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+11-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+14-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+16-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+17-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-7+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+10-20-0.734 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+11-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+12-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+13-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+14-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+16-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+17-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+20-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+21-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+22-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-8+23-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+0-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+9-20-15.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+10-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+11-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+12-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+14-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+15-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+16-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+17-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+18-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+19-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+21-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+22-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-9+23-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+0-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    =O====== M/11.4.402.287 2012-10-10+11-08-11.906 ========
    0000 Re: Adobe automatic flash update crashes with error 00000010 "D:\Temp\{C1AD15FE-05B3-464A-BE7E-986871B6FB95}\InstallFlashPlayer.exe" -iv 4
    0001 Re: Adobe automatic flash update crashes with error 00000020 C:\WINDOWS\system32\FlashPlayerCPLApp.cpl
    0002 Re: Adobe automatic flash update crashes with error 00001015 C:\WINDOWS\system32\Macromed\Flash\FlashUtil32_11_4_402_265_ActiveX.dll 5
    0003 Re: Adobe automatic flash update crashes with error 00001015 C:\WINDOWS\system32\Macromed\Flash\FlashUtil32_11_4_402_265_ActiveX.exe 5
    0004 Re: Adobe automatic flash update crashes with error 00000013 C:\WINDOWS\system32\Macromed\Flash\Flash32_11_4_402_287.ocx
    0005 Re: Adobe automatic flash update crashes with error 00000015 C:\WINDOWS\system32\Macromed\Flash\FlashUtil32_11_4_402_287_ActiveX.exe
    0006 Re: Adobe automatic flash update crashes with error 00000016 C:\WINDOWS\system32\Macromed\Flash\FlashUtil32_11_4_402_287_ActiveX.dll
    0007 Re: Adobe automatic flash update crashes with error 00000019 C:\WINDOWS\system32\FlashPlayerCPLApp.cpl
    0008 Re: Adobe automatic flash update crashes with error 00001024 C:\WINDOWS\system32\FlashPlayerCPLApp.cpl 183
    0009 Re: Adobe automatic flash update crashes with error 00001024 C:\WINDOWS\system32\FlashPlayerApp.exe 183
    0010 Re: Adobe automatic flash update crashes with error 00000021 C:\WINDOWS\system32\Macromed\Flash\FlashPlayerUpdateService.exe
    0011 Re: Adobe automatic flash update crashes with error 00001106
    0012 Re: Adobe automatic flash update crashes with error 00001106
    0013 Re: Adobe automatic flash update crashes with error 00001024 C:\WINDOWS\system32\Macromed\Flash\FlashPlayerUpdateService.exe 183
    0014 Re: Adobe automatic flash update crashes with error 00000012
    =X====== M/11.4.402.287 2012-10-10+11-08-31.921 ========
    =O====== M/11.4.402.265 2012-10-10+10-56-43.031 ========
    0000 Re: Adobe automatic flash update crashes with error 00000010 "C:\WINDOWS\system32\Macromed\Flash\FlashUtil32_11_4_402_265_ActiveX.exe" -update activex
    0001 Re: Adobe automatic flash update crashes with error 00000011 0
    =X====== M/11.4.402.265 2012-10-10+11-08-32.078 ========
    2012-10-10+11-20-0.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+12-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+14-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+15-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+16-20-0.234 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+17-20-0.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+18-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+19-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+22-20-0.187 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-10+23-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+0-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+11-20-0.187 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+12-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+17-20-18.546 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+18-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+19-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+20-20-0.62 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+21-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+22-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-11+23-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+10-20-0.203 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+11-20-0.78 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+12-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+13-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+17-20-15.125 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+18-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+19-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+20-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+21-20-0.52 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+22-20-0.36 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-12+23-20-0.177 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+0-20-0.36 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+10-20-15.187 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+11-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+12-20-0.93 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+13-20-0.46 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+20-20-0.109 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+21-20-0.31 Re: Adobe automatic flash update crashes with error 1223 1058
    2012-10-13+22-20-2.156 Re: Adobe automatic flash update crashes with e

  • Need help to write a query for Update statement with  join

    Hi there,
    The following update statement gives me error as the given table in set statement is invalid. But its the right table .
    Is the statement correct? Please help .
    update (
           select distinct(vpproadside.VEHICLE_CRED_OVERRIDE.vin)            
             from vpproadside.VEHICLE_CRED_OVERRIDE
             join vpproadside.vpp_vehicle
               on vpproadside.vpp_vehicle.vin = vpproadside.VEHICLE_CRED_OVERRIDE.vin
            where VPP_CARRIER_SEQ_NUMBER = 90
              and EXPIRY_DATE = '17-MAR-10'
       set vpproadside.VEHICLE_CRED_OVERRIDE.EXPIRY_DATE = '15-SEP-10';Edited by: Indhu Ram on Mar 12, 2010 1:00 PM
    Edited by: Indhu Ram on Mar 12, 2010 1:22 PM
    Edited by: Indhu Ram on Mar 12, 2010 2:35 PM
    Edited by: Indhu Ram on Mar 15, 2010 8:04 AM
    Edited by: Indhu Ram on Mar 15, 2010 8:06 AM
    Edited by: Indhu Ram on Mar 15, 2010 8:28 AM

    Ask Tom has very good discussion about this, if UPDATE does not work for PK issue, you can use MERGE
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:760068400346785797

  • Update statement with Aggregate function

    Hi All,
    I would like to update the records with sum of SAL+COMM+DEPTNO into SALCOMDEPT column for each row. Can we use SUM function in Update statement. Please help me out this
    See below:
    Table
    CREATE TABLE EMP
    EMPNO NUMBER(4) NOT NULL,
    ENAME VARCHAR2(10 CHAR),
    JOB VARCHAR2(9 CHAR),
    MGR NUMBER(4),
    HIREDATE DATE,
    SAL NUMBER(7,2),
    COMM NUMBER(7,2),
    DEPTNO NUMBER(2),
    SALCOMDEPT NUMBER
    Used update statement :
    UPDATE emp e1
    SET e1.salcomdept= (select sum(sumsal+comm+deptno) from emp e2 where e2.empno=e1.empno)
    WHERE e1.deptno = 10
    commit
    Thanks,
    User

    Adding these columns makes no sense, so I'll assume this is just an exercise.
    However, storing calculated columns like this is generally not a good idea. If one of the other columns is updated, your calculated column will be out of sync.
    One way around this is to create a simple view
    SQL> CREATE view EMP_v as
      2  select EMPNO
      3        ,ENAME
      4        ,JOB
      5        ,MGR
      6        ,HIREDATE
      7        ,SAL
      8        ,COMM
      9        ,DEPTNO
    10        ,(nvl(sal,0) + nvl(comm,0) + nvl(deptno,0)) SALCOMDEPT
    11  from   emp;
    View created.
    SQL> select sal, comm, deptno, salcomdept from emp_v;
                     SAL                 COMM               DEPTNO           SALCOMDEPT
                     800                                        20                  820
                    1600                  300                   30                 1930
                    1250                  500                   30                 1780
                    2975                                        20                 2995
                    1250                 1400                   30                 2680
                    2850                                        30                 2880
                    2450                                        10                 2460
                    3000                                        20                 3020
                    5000                                        10                 5010
                    1500                    0                   30                 1530
                    1100                                        20                 1120
                     950                                        30                  980
                    3000                                        20                 3020
                    1300                                        10                 1310
    14 rows selected.

  • Update statement with CASE and banding

    Hello Folks,
    I am stuck and am going nowhere.
    I have two tables
    MinuteCategory
    Minute
    MinuteCategory
    MinuteLookup
    MinuteCategoryId (surrogate key)
    MinuteLow
    MinuteHigh
    MinuteCategory
    Sample from Minute Lookup table ..
    1 1
    15 <15 min
    2 16
    30 <30 min
    3 31
    45 <45 min
    4 46
    60 <60 minutes
    5 61
    75 <1 hour 15 minutes
    I am trying to update the MinuteCategory column in the MinuteCategory table using the MinuteLookup table.
    For example if the minute = 33 then the corresponding lookup value would be 3 (from the lookup table), because the 
    33rd minute falls in between 31 min and 45 min and the corresponding surrogate key is 3
    Is this possible with an Update statement in SQL? The only thing i can think of is use case statement as the join key between
    the two tables but i don't think it's going to work :(
    UPDATE
    SET MinuteCategory = ml.MinuteCategoryId
    FROM MinuteCategory mc join MinuteLookup ml on mc.Minute = 
    CASE WHEN mc.Minute between ml.MinuteLow and ml.MinuteHigh THEN ml.MinuteCategoryId ELSE NULL
    END
    Would appreciate any help.
    SS

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I have two tables <<
    Have you read any book on data, so you have some idea what a “<something>_category” means? THINK!! A minute is unit of temporal measurement. By definition, it cannot be a category. 
    There is no such thing as a “<something>_category_id”; a data element is a “<something>_category” or a “<something>_id”, as per basic data modeling. 
    Use a table of time slots set to one more decimal second of precision than your data. You can now use temporal math to add it to a DATE to TIME(1) get a full DATETIME2(0). Here is the basic skeleton. 
    CREATE TABLE Timeslots
    (slot_start_time TIME(1) NOT NULL PRIMARY KEY,
     slot_end_time TIME(1) NOT NULL,
     CHECK (start_time < end_time));
    INSERT INTO Timeslots  --15 min intervals
    VALUES ('00:00:00.0', '00:14:59.9'),
    ('00:15:00.0', '00:29:59.9'),
    ('00:30:00.0', '00:44:59.9'),
    ('00:45:00.0', '01:00:59.9'), 
    ('23:45:00.0', '23:59:59.9'); 
    Here is the basic query for rounding down to a time slot. 
    SELECT CAST (@in_timestamp AS DATE), T.start_time
      FROM Timeslots AS T
     WHERE CAST (@in_timestamp AS TIME)
           BETWEEN T.slot_start_time 
               AND T.slot_end_time;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Dynamic UPDATE statement with parameters for column names.

    Hello,
    On this* website I read "The SQL string can contain placeholders for bind arguments, but bind values cannot be used to pass in the names of schema objects (table or column names). You may pass in numeric, date, and string expressions, but not a BOOLEAN or NULL literal value"
    On the other hand, in this Re: execute immediate with dynamic column name update and many other
    posts people use EXECUTE IMMEDIATE to create a dynamic UPDATE statement.
    dynSQL:='UPDATE CO_STAT2 CO SET CO.'||P_ENT_B_G_NAME||' = '||P_ENT_E_G_WE||'
    WHERE ST IN
    (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
    '||P_ST||' = CO.ST AND
    CO.'||P_ENT_E_G_NAME||' > '||P_ENT_E_G_WE||' AND
    CO.'||P_ENT_B_G_NAME||' < '||P_ENT_E_G_WE||');';
    EXECUTE IMMEDIATE dynSQL ;
    Since this statement is part of a Stored Procedure, I wont see the exact error but just get a ORA-06512.
    The compiling works fine and I use Oracle 11g.
    http://psoug.org/definition/EXECUTE_IMMEDIATE.htm

    OK I extracted from all of your posts so far that I have to use "bind-variables with :"
    From all the other tuorials and forums posts, I assume using the pipe is correct so I added those as well into the script:
    set serveroutput on format wraped;
    DECLARE
    dynSQL VARCHAR2(5000);
    P_ENT_E_G_NAME VARCHAR2 (100) :='test1'; P_ENT_E_G_WE VARCHAR2 (100) :='01.02.2012'; P_ENT_B_G_NAME VARCHAR2 (100) :='01.01.2012';
    P_ST                VARCHAR2 (100) :='32132';
    BEGIN
    dynSQL:= 'UPDATE CO_STAT2 CO SET CO.'||:P_ENT_B_G_NAME||' = '||:P_ENT_E_G_WE||'
                  WHERE ST IN (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
                  '||:P_ST||'                           = CO.ST                  AND
                  CO.'||:P_ENT_E_G_NAME||'     > '||:P_ENT_E_G_WE||' AND
                  CO.'||:P_ENT_B_G_NAME||'    
    < '||:P_ENT_E_G_WE||')';
    --this is somehow missing after the last < '||:P_ENT_E_G_WE||')';
    dbms_output.enable;
    dbms_output.put(dynSQL);
    --EXECUTE IMMEDIATE dynSQL;    
    END;Problem:I think I figured it out, the dates that I parse into the query need additional '

  • Update statement with Case syntax

    I want to put case statement in an update statement using Oracle 10g
    I'm getting a syntax error on the last line Ora-00933: SQL command not properly ended
    Help please
    UPDATE EMP a
    SET EMP.TYPE = CASE
    WHEN 'Y' = 'A' THEN 'DIV'
    WHEN 'Y' = '1' THEN 'DEF'
    END CASE;

    Hi,
    Samim wrote:
    I want to put case statement in an update statement using Oracle 10g
    I'm getting a syntax error on the last line Ora-00933: SQL command not properly ended
    Help please
    UPDATE EMP a
    SET EMP.TYPE = CASE
    WHEN 'Y' = 'A' THEN 'DIV'
    WHEN 'Y' = '1' THEN 'DEF'
    END CASE;The closing keyword that corresponds to "CASE" is "END", not "END *CASE* ".
    The string 'Y' is never equal to 'A', or to '1'.
    If you have a column named y in the table, then you might want to say:
    UPDATE EMP
    SET EMP.TYPE = CASE
                        WHEN Y = 'A' THEN 'DIV'
                        WHEN Y = '1' THEN 'DEF'
                  END;I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statemnts to re-create your emp table as it exists before the UPDATE), and the results you want from that data (that is, the contents of the emp table after the UPDATE).

  • Update Statement With Decode and Business Dates

    Hello everyone,
    I need to write a UPDATE statement using business date rule. In general, the due date is 30 days from the checkout date. If the due date falls on a Saturday or Sunday then the loan period is 32 days.
    I know that to test for a weekday, I'd need to use the to_char function in Oracle with the format of ‘D’. I did some research and found that to test which weekday November 12, 2007 falls on, I'd need to use the expression to_char(’12-NOV-2007’,’D’). This function returns a number between 1 and 7. 1 represents Sunday, 2 Monday, …,7 Saturday.
    What I really would need to do is write one UPDATE statement using an expression with the Decode function and the to_Char function:
    UPDATE book_trans SET due_dte = expression
    These are the transactions that will need to be updated:
    ISBN 0-07-225790-3 checked out on 15-NOV-2007 by employee 101(book_trans_id=1)
    ISBN 0-07-225790-3 checked out on 12-NOV-2007 by employee 151(book_trans_id=2)
    ISBN 0-201-69471-9 checked out on 14-NOV-2007 by employee 175(book_trans_id=3)
    ISBN 0-12-369379-9 checked out on 16-NOV-2007 by employee 201(book_trans_id=4)
    I manually calculated the due-dte and wrote update statement for each book_trans_id:
    UPDATE book_trans SET due_dte = '17-dec-07' WHERE book_trans_id = 1;
    UPDATE book_trans SET due_dte = '12-dec-07' WHERE book_trans_id = 2;
    UPDATE book_trans SET due_dte = '14-dec-07' WHERE book_trans_id = 3;
    UPDATE book_trans SET due_dte = '18-dec-07' WHERE book_trans_id = 4;
    As you can see, it's very cumbersome and I'd just like to know how to incorporate everything in one Update statement:
    UPDATE book_trans SET due_dte = expression
    so that if due date falls on Saturday or Sunday, the loan period is 32 days; weekday, loan period is 30 days.
    Any tips or help will be greatly appreciated. Thanks!

    Hi,
    882300 wrote:
    Hello everyone,
    I need to write a UPDATE statement using business date rule. In general, the due date is 30 days from the checkout date. If the due date falls on a Saturday or Sunday then the loan period is 32 days. That's equivalent to saying that the due date is normally 30 days after the checkout date, but if the checkout date falls on a Thursday or Friday, then the due date is 32 days after the checkout date. I used this equivalent in the statement below.
    I know that to test for a weekday, I'd need to use the to_char function in Oracle with the format of ‘D’. I did some research and found that to test which weekday November 12, 2007 falls on, I'd need to use the expression to_char(’12-NOV-2007’,’D’). This function returns a number between 1 and 7. 1 represents Sunday, 2 Monday, …,7 Saturday.That's just one way to find out the weekday, and it's error-prone because it depends on your NLS_TERRITORY setting. A more reliable way is to use 'DY' or 'DAY' as the 2nd argument to TO_CHAR. That depends on NLS_DATE_LANGUAGE, but you can explicitly set the language in the optional 3rd argument to TO_CHAR, which means your code will work the same no matter what the NLS settings happen to be. It's also easier to debug: you may have to think whether '1' means Sunday or Monday, but it's easy to remember that 'SUN' means Sunday.
    What I really would need to do is write one UPDATE statement using an expression with the Decode function and the to_Char function:
    UPDATE book_trans SET due_dte = expressionHere's one way:
    UPDATE  book_trans
    SET     due_dte = checkout_dte + CASE
                                      WHEN  TO_CHAR ( checkout_dte
                                             , 'fmDAY'
                                     , 'NLS_DATE_LANGUAGE=ENGLISH'
                                     ) IN ('THURSDAY', 'FRIDAY')
                             THEN  32
                             ELSE  30
                                  END
    WHERE   book_trans_id      IN (1, 2, 3, 4)
    ;This assumes that checkout date is a column in the same table.

  • How to automate this update statement

    Hello:
    I need to convert this update statement to a pl/sql procedure so that I can update this for each mk_product_id at a time because the primary update table has 80 million lines, If I do this for one mk_product_id is very fast, I need to update closely 2 million lines for month_id =55
    update processor a set a.mkrptqty =
    (select b.mkqty*p.rpt_conv_factor
    from
    processor b,
    product p
    where a.mk_record_id = b.mk_record_id
    and a.mk_line_nbr = b.mk_line_nbr
    and b.mk_product_id = p.part_code
    and a.mk_product_id = '480'
    and b.month_id = 55)
    where
    a.month_id = 55
    and a.mk_product_id = '480'
    Thanks,
    Mohan

    PL/SQL is slower than SQL.
    Keep your update as a single large update statement, but better correlate your inner select with your outer table:
    UPDATE processor a
    SET a.mkrptqty =
      (SELECT b.mkqty*p.rpt_conv_factor
         FROM processor b,
        product p
        WHERE a.mk_record_id = b.mk_record_id
      AND a.mk_line_nbr      = b.mk_line_nbr
      AND b.mk_product_id    = p.part_code
      AND a.month_id         = b.month_id
      WHERE a.month_id  = 55
    AND a.mk_product_id = '480';As you can see in the above code I correleated processor b completely with processor a from the outer update statement. But in the process noticed that you could probably completely dispose of processor b as noted below:
    UPDATE processor a
    SET a.mkrptqty =
      (SELECT a.mkqty*p.rpt_conv_factor
         FROM product p
        WHERE a.mk_product_id    = p.part_code
      WHERE a.month_id  = 55
    AND a.mk_product_id = '480';Please note that neither of these pieces of code have been tested as I don't have relevant tables at hand to test on.
    To update many mk_product_id's at a time just use the IN operator providing it with either a select list, or list of values:
    UPDATE processor a
    SET a.mkrptqty =
      (SELECT a.mkqty*p.rpt_conv_factor
         FROM product p
        WHERE a.mk_product_id    = p.part_code
      WHERE a.month_id  = 55
    AND a.mk_product_id in ('480','481');or
      WHERE (a.month_id, a.mk_product_id)
         in ((55,'480'), (65,'481'));or
      WHERE (a.month_id, a.mk_product_id)
         in (select month_id, mk_product_id from some_table where some_conditions = 'are met');Edited by: Sentinel on Sep 17, 2008 2:25 PM

  • Help me to update table with condition's

    this table is an alert table which will update when the sql server down , not pinging and drive space low.
    Every 15 mins the monitoring system run. if the any issue came then it will update the information in this table. if  the issue not solved by 15 mins the table will update again with the same details.. 
    I would like update tickeraised = Y  only on first time and  if i got same issue less then 30 min the it should not change to Y..  based on server name , type and message. 
    min >10 and <20 min if any value is there then the table should not update with same value. can any one help me with tsql query...

    In future please post DDL and DML. For now I have created a scenario which will help you understand solution to your own requirement.
    CREATE TABLE Tickets_Log(
    Ticked_ID SMALLINT IDENTITY(1,1) PRIMARY KEY,
    Ticket_Type VARCHAR(20) NOT NULL,
    Log_Date DATETIME2 NOT NULL DEFAULT DATEADD(MINUTE,-15,GETDATE()),
    Machine_Name VARCHAR(50) NOT NULL,
    Message VARCHAR(100) NOT NULL,
    Ticket_Status CHAR(2) NOT NULL DEFAULT 'N',
    Update_Status SMALLINT DEFAULT 0)
    INSERT Tickets_Log(Ticket_Type,Machine_Name,Message)
    SELECT 'Pinging','HOD-400-651','Server Not Pinging' UNION
    SELECT 'Low Drive Space','HOD-400-652','Drive Space Low' UNION
    SELECT 'Connection','HOD-400-653','Unable to Connect to Server'
    UPDATE TL
    SET Log_Date=NewTickets.Log_Date,
    Update_Status=1
    FROM( SELECT 'Pinging' Ticket_Type,'HOD-400-651' Machine_Name,'Server Not Pinging' Message,GETDATE() Log_Date UNION
    SELECT 'Pinging','HOD-400-653','Server Not Pinging',GETDATE() Log_Date) NewTickets
    LEFT JOIN Tickets_Log TL ON NewTickets.Machine_Name=TL.Machine_Name AND NewTickets.Ticket_Type=TL.Ticket_Type
    WHERE TL.Ticket_Type IS NOT NULL AND TL.Machine_Name IS NOT NULL AND DATEDIFF(MINUTE,TL.Log_Date,NewTickets.Log_Date)>=15 AND Update_Status=0
    INSERT Tickets_Log(Ticket_Type,Machine_Name,Message,Log_Date)
    SELECT NewTickets.*
    FROM( SELECT 'Pinging' Ticket_Type,'HOD-400-651' Machine_Name,'Server Not Pinging' Message,GETDATE() Log_Date UNION
    SELECT 'Pinging','HOD-400-653','Server Not Pinging',GETDATE() Log_Date) NewTickets
    LEFT JOIN Tickets_Log TL ON NewTickets.Machine_Name=TL.Machine_Name AND NewTickets.Ticket_Type=TL.Ticket_Type
    WHERE TL.Ticket_Type IS NULL AND TL.Machine_Name IS NULL
    Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
    The climb is all there is.

  • Some Systems Restarted Automatically after Updates Deployment with Restart Suppressed

    I've searched the forum and multiple blogs - but, I'm still confused about what is causing some of our workstations to restart after applying a software updates deployment.
    I deployed the Dec 2013 Patch Tuesday updates to a collection of workstations. The deployment was set to:
    Not allow restarts outside of a maintenance window (box is unchecked)
    Suppress restarts on workstations (box is checked).
    There is no maintenance window defined for any of our workstations
    On all the workstations, the HKEY_LOCAL_MACHINE\Software\...\WindowsUpdate\  values are:
    WUServer: http address of our SCCM SUP server
    WUStatusServer: http address of our SCCM SUP server
    Also, the key in HKEY_LOCAL_MACHINE\...\WindowsUPDATE\AU is:
    UseWUServer: 1  (which I understand disables the use of the automatic Windows update service)
    Some set of workstations automatically restarted shortly after 3:00 am the next morning. Clearly that's the Windows Update Agent jumping in a restarting the systems. However, I don't understand why it would do that. I really don't understand why it would
    have occurred on only some of the workstations while others are still waiting for users to manually restart 36 hours later.
    All of the workstations are in the same active directory OU - so the same set of GPOs applies to all.
    Note: none of the registry keys were set directly in any GPOs - I assume the values were set by the SCCM client.
    Any assistance would be appreciated.
    Larry

    depending on the OS version, this could be relevant:
    http://blogs.technet.com/b/wsus/archive/2013/06/11/wsus-blog-managing-updates-with-deadlines-in-an-era-of-automatic-maintenance.aspx
    http://blogs.technet.com/b/wsus/archive/2013/10/08/enabling-a-more-predictable-windows-update-experience-for-windows-8-and-windows-server-2012-kb-2885694.aspx
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

Maybe you are looking for

  • What does this error message mean ?

    I put in a CD-R of uncopywritten music. Previously it has come up like any other CD; i.e. iTunes opens and asks me if I want to import the songs. Now for some reason I get an error message that says "You have inserted a disk containing no volumes tha

  • Unknown charecters for polish letters in pdf when generated through RAD.

    Hi, I have created a report in Crystal Reports which extracts data from SQL Server database. In crystal report viewer, when i extract to  pdf or any other form , i get expected result. When I use this .rpt file in my application which is deployed in

  • Bootcamp problems on 24" Imac

    So I installed windows 7 ultimate on my 24" Imac 2.93GHZ with a Nvida GT 120. I installed the boot camp software on windows, which installed the graphics driver and everything. Anyway so I downloaded Dungeons and Dragons online cause I wanted to see

  • Cant get lightroom to download, do you know why?

    I have just downloaded the package with photoshop and lightroom, but I can only download photoshop. Is it because I dont have enough space in my computer? It says error..

  • JD3.2: DACF: Error distribution

    I am trying to process errors which arise when user tries to commit empty value for NOT NULL column in GridControl. I successfully intercept DAC-603 error and handle it. But, there are actually two errors raised in response of this user action: one f