question using box with the update statement

Hi all

I have a region that uses a collection as its source and it has a check box. The intention is to check some lines and then use a PL/SQL block to update a table based on the audited lines. My problem is the table, I'm trying to update includes two primary keys.

I need to find a way to get both keys on the checked lines. How can I do this? I can get the first of the box, but when I try to refer to something like apex_application.g_f08 I get only the value in the first line and NOT the lines checked.

Here is my collection C007 represents ONE of the primary keys (header_id)

SELECT APEX_ITEM. CHECKBOX(7,C007,'UNCHECKED') ""
C001
C002
C003
C004
C005
C006
c007
c008
Of apex_collections
WHERE collection_name = "UNGROUPED_SETS."
order by C001, C002

Here are the PL/SQL that performs the update...

DECLARE

vRowNumber PLS_INTEGER;
l_rows_updated PLS_INTEGER: = 0;


BEGIN

-loop for checkboxs checkees
If NVL (apex_application.g_f07. COUNTY, 0) > 0 THEN

Start

because me in 1... apex_application.g_f07. COUNTING loop

-Updated forx_oe_line_partials with the data entered by the user in the region
Update forx_oe_line_partials_mlob
Set last_update_date = sysdate
, last_updated_by =: P6_CREATED_BY
, last_update_login =: P6_LAST_UPDATE_LOGIN
, comment_for_invoice =: P6_INVOICE_COMMENTS
where header_id = apex_application.g_f07 (i); -It works very well, but...
- AND set_id =? -put the second primary key here!

l_rows_updated: = l_rows_updated + sql rowcount %;

end loop; -Box loop

: P6_UPDATE_COUNT: = l_rows_updated;

end;

on the other

raise_application_error (-20001, 'Check box unchecked.');

end if;

END; -End main;

Check {message identifier: = 9430142}

Tags: Database

Similar Questions

  • need help with the Update statement

    Hello
    I received a question in a course and I tried my best to respond, and now my brain is giving. I would really appreciate help with the update statement. I don't mind if you do not validate a solution, a little nudge in the right direction would be really useful. I'll post that I got.

    THE QUESTION
    / * For these agents disabled on more than seven missions, change their date of deactivation of the first date of deactivation of all the agents that have been activated in the same year as the agent that you update currently.
    */

    I have it divided into parts, here is my select statement to agents disabled on more than 7 missions, which produces the deactivation_dates in the agents table that I want to update...
    SELECT
    s.deactivation_date
    FROM
    (
    SELECT
    a.deactivation_date,
    count(m.mission_id) as nomissions
    FROM
    agents a
    INNER JOIN
    missions_agents m
    on
    a.agent_id=m.agent_id
    GROUP BY
    a.deactivation_date
    ) s
    WHERE
    s.nomissions>7 AND s.deactivation_date IS NOT NULL
    .. .and the code for the first date of deactivation for each year of activation agent
    select 
    a2.deactivation_date
    from
    agents a2
    where a2.deactivation_date= 
    (
    select min(a.deactivation_date)
    from 
    agents a
    where to_number(to_char(a.activation_date,'YYYY'))=to_number(to_char(a2.activation_date,'YYYY'))
    )
    ..... I am not real to marry these two statements together in the Update statement. I can't extract each date of deactivation produced in the first select statement and their match against the first date of deactivation in the year they have been activated for the second select statement.

    Any help greatly appreciated... :))

    I began to wonder how things would :)

    user8695469 wrote:
    First of all why he chooses the date the earliest of all agents

    UPDATE  AGENTS_COPY AC /* (1) */
    SET     DEACTIVATION_DATE = (
    SELECT  MIN(AGS.DEACTIVATION_DATE)
    FROM    AGENTS_COPY  AGS
    ,       AGENTS_COPY AC /* (2) */
    WHERE   TRUNC(AGS.ACTIVATION_DATE,'YEAR') = TRUNC(AC.ACTIVATION_DATE,'YEAR') /* (3) */
    )
    

    He recovers as soon as the subquery has not been correctly set in the SET clause. It seems you are trying to update a correlated, but we are still having a conceptual shift. I have added a few comments to your code above and below will explain.

    (1): when you do a correlated update it is useful to the table alias that you did right here.

    (2): this table statement is not necessary and is the reason why the FIRST deactivation date is selected. The alias that you use (3) refers to THIS table, not the one defined in the update statement. Remove the line indicated by (2) in the FROM clause and a correlated update will happen.

    and secondly why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    user8695469 wrote: then why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    
    WHERE EXISTS
    (
    SELECT
    a.agent_id,
    count(m.mission_id)
    FROM
    agents a
    /* INNER JOIN AC ON AC.AGENT_ID = A.AGENT_ID */
    INNER JOIN
    missions_agents m
    ON
    a.agent_id=m.agent_id
    GROUP BY
    a.agent_id,
    a.deactivation_date
    HAVING
    count(m.mission_id)>7 AND a.deactivation_date IS NOT NULL
    )
    

    Once again this problem is similar to the question above that a correlation update doesn't work. Test existence of lines in an EXISTS subquery. Since your subquery is not related to the table that you are trying to update, it will be always return a line and, therefore, it returns true for EACH LINE in the AGENTS table. To limit the game to only agents > 7 missions results, you need to add a join condition that references the table in your update statement. I added one above (with comments) as a sample.

    I recommend you look over all material that you have associated with correlated subqueries, including documents that I posted above. This seems to be what you're having the problem more with. If you need me to explain the concept of correlated queries any better please let me know.

    Thank you!

  • Performance issue with the Update statement

    Oracle 10204

    I have a problem related to updaing one performance table.
    only 5000 lines should be updated.
    Hir are some details on the tables/M.V concerned:
    TABLE_NAME     LAST_ANALYZED          NUM_ROWS     SAMPLE_SIZE
    PS_RF_INST_PROD     1/20/2010 1:14:22 AM     7194402          7194402
    BL_TMP_INTRNT     1/27/2010 9:08:54 AM     885445          885445
    NAP_INTERNET     1/25/2010 11:47:02 AM     7053990          560777
    I tried to run the update with two options:
    1. with the plan than oracle choose.
    2. with notes I added.
    In both cases I he collapsed after more than an hour.

    Can any one suggest how to speed it up?

    Below are for the two option tkprof.
    Please note that beside the defualt statistics on those tables i also gathered statistics on two column level as followed:
    BEGIN
      SYS.DBMS_STATS.GATHER_TABLE_STATS (
          OwnName        => 'B'
         ,TabName        => 'BL_TMP_INTRNT'
        ,Estimate_Percent  => 100
        ,Degree            => 8
        ,Cascade           => TRUE
        ,No_Invalidate     => FALSE);
    END;
    /
    
    exec dbms_stats.gather_table_stats('B' , 'BL_TMP_INTRNT', cascade=>TRUE, method_opt=>'for columns SERVICE_UID size 254');
    exec dbms_stats.gather_table_stats('B' , 'BL_TMP_INTRNT', cascade=>TRUE, method_opt=>'for columns FIX_IP_USER size 254');
    Plan 1
    UPDATE BL_TMP_INTRNT A
       SET A.FIX_IP_USER =
              (SELECT C.PRODUCT_ID
                 FROM NAP_INTERNET B, PS_RF_INST_PROD C
                WHERE B.INST_PROD_ID = A.SERVICE_UID
                  AND B.SETID = 'SHARE'
                  AND C.INST_PROD_ID = B.NAP_SURF_UID)
     WHERE A.TERM_DESC LIKE '%ip%'
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.03       0.02          0          0          0           0
    Execute      1   1166.64    4803.78   17989002   18792167        117           0
    Fetch        0      0.00       0.00          0          0          0           0
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        2   1166.67    4803.81   17989002   18792167        117           0
    
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 13
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
          0  UPDATE  BL_TMP_INTRNT (cr=0 pr=0 pw=0 time=2 us)
         46   TABLE ACCESS FULL BL_TMP_INTRNT (cr=586400 pr=22228 pw=0 time=15333652 us)
         15   HASH JOIN  (cr=18170453 pr=17931639 pw=0 time=3991064192 us)
         46    MAT_VIEW ACCESS FULL NAP_INTERNET (cr=5659886 pr=5655436 pw=0 time=988162557 us)
    329499624    MAT_VIEW ACCESS FULL PS_RF_INST_PROD (cr=12545734 pr=12311281 pw=0 time=2636471644 us)
    plan 2
    UPDATE BL_TMP_INTRNT A
       SET A.FIX_IP_USER =
              (SELECT /*+ index(b NAP_INTERNET_PK) index(c PS_RF_INST_PROD_PK)*/ C.PRODUCT_ID
                 FROM NAP_INTERNET B, PS_RF_INST_PROD C
                WHERE B.INST_PROD_ID = A.SERVICE_UID
                  AND B.SETID = 'SHARE'
                  AND C.INST_PROD_ID = B.NAP_SURF_UID)
     WHERE A.TERM_DESC LIKE '%ip%'
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.02       0.02          0          0          0           0
    Execute      1   4645.25    4613.70      95783   39798095        735           0
    Fetch        0      0.00       0.00          0          0          0           0
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        2   4645.27    4613.73      95783   39798095        735           0
    
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 13
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
          0  UPDATE  BL_TMP_INTRNT (cr=0 pr=0 pw=0 time=1 us)
        473   TABLE ACCESS FULL BL_TMP_INTRNT (cr=10461 pr=10399 pw=0 time=4629385 us)
        408   MAT_VIEW ACCESS BY INDEX ROWID PS_RF_INST_PROD (cr=39776109 pr=85381 pw=0 time=4605125045 us)
       1350    NESTED LOOPS  (cr=39784584 pr=84974 pw=0 time=4601874262 us)
        470     MAT_VIEW ACCESS BY INDEX ROWID NAP_INTERNET (cr=23569112 pr=50472 pw=0 time=2544364336 us)
        470      INDEX FULL SCAN NAP_INTERNET_PK (cr=23568642 pr=50005 pw=0 time=2540300981 us)(object id 11027362)
        408     INDEX FULL SCAN PS_RF_INST_PROD_PK (cr=16215472 pr=34502 pw=0 time=2057500175 us)(object id 10980137)
    
    
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1300        0.50          4.27
      db file sequential read                     85707        0.51         29.88
      latch: cache buffers chains                     1        0.00          0.00
      log file sync                                   1        0.00          0.00
      SQL*Net break/reset to client                   1        0.00          0.00
      SQL*Net message to client                       1        0.00          0.00
      SQL*Net message from client                     1       14.73         14.73
    ********************************************************************************

    The problem in your update statement that is the query in your set clause is executed many times that there are lines in BL_TMP_INTRNT of 'intellectual property' in their column of term_desc. You mentioned there are about 5000, then the query joining NAP_INTERNET with PS_RF_ISNT_PROD is begun 5000 times.
    The trick is to join only once, be updated using join views - provided that it is preserved - key or by using the merge statement.

    Here is an example:

    SQL> create table bl_tmp_intrnt (fix_ip_user,service_uid,term_desc)
      2  as
      3   select level
      4        , level
      5        , 'aipa'
      6     from dual
      7  connect by level <= 5000
      8  /
    
    Tabel is aangemaakt.
    
    SQL> create table nap_internet (inst_prod_id,setid,nap_surf_uid)
      2  as
      3   select level
      4        , 'SHARE'
      5        , level
      6     from dual
      7  connect by level <= 10
      8  /
    
    Tabel is aangemaakt.
    
    SQL> create table ps_rf_inst_prod (product_id,inst_prod_id)
      2  as
      3   select level
      4        , level
      5     from dual
      6  connect by level <= 10
      7  /
    
    Tabel is aangemaakt.
    
    SQL> exec dbms_stats.gather_table_stats(user,'bl_tmp_intrnt')
    
    PL/SQL-procedure is geslaagd.
    
    SQL> exec dbms_stats.gather_table_stats(user,'nap_internet')
    
    PL/SQL-procedure is geslaagd.
    
    SQL> exec dbms_stats.gather_table_stats(user,'ps_rf_inst_prod')
    
    PL/SQL-procedure is geslaagd.
    
    SQL> set serveroutput off
    SQL> update ( select a.fix_ip_user
      2                , c.product_id
      3             from bl_tmp_intrnt a
      4                , nap_internet b
      5                , ps_rf_inst_prod c
      6            where a.term_desc like '%ip%'
      7              and a.service_uid = b.inst_prod_id
      8              and b.setid = 'SHARE'
      9              and b.nap_surf_uid = c.inst_prod_id
     10         )
     11     set fix_ip_user = product_id
     12  /
       set fix_ip_user = product_id
           *
    FOUT in regel 11:
    .ORA-01779: cannot modify a column which maps to a non key-preserved table
    

    Join is one key kept in the case of b.inst_prod_id and c.inst_prod_id are unique. Please refer to the documentation for more information here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/views.htm#sthref3055

    SQL> alter table nap_internet add primary key (inst_prod_id)
      2  /
    
    Tabel is gewijzigd.
    
    SQL> alter table ps_rf_inst_prod add primary key (inst_prod_id)
      2  /
    
    Tabel is gewijzigd.
    
    SQL> update /*+ gather_plan_statistics */
      2         ( select a.fix_ip_user
      3                , c.product_id
      4             from bl_tmp_intrnt a
      5                , nap_internet b
      6                , ps_rf_inst_prod c
      7            where a.term_desc like '%ip%'
      8              and a.service_uid = b.inst_prod_id
      9              and b.setid = 'SHARE'
     10              and b.nap_surf_uid = c.inst_prod_id
     11         )
     12     set fix_ip_user = product_id
     13  /
    
    10 rijen zijn bijgewerkt.
    
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'))
      2  /
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID  c7nqbxwzpyq5p, child number 0
    -------------------------------------
    update /*+ gather_plan_statistics */        ( select a.fix_ip_user               , c.product_id            from bl_tmp_intrnt
    a               , nap_internet b               , ps_rf_inst_prod c           where a.term_desc like '%ip%'             and
    a.service_uid = b.inst_prod_id             and b.setid = 'SHARE'             and b.nap_surf_uid = c.inst_prod_id        )
    set fix_ip_user = product_id
    
    Plan hash value: 1745632149
    
    ---------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                      | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    ---------------------------------------------------------------------------------------------------------------------------------------
    |   1 |  UPDATE                        | BL_TMP_INTRNT   |      1 |        |      0 |00:00:00.01 |      32 |       |       |          |
    |   2 |   NESTED LOOPS                 |                 |      1 |     10 |     10 |00:00:00.01 |      21 |       |       |          |
    |   3 |    MERGE JOIN                  |                 |      1 |     10 |     10 |00:00:00.01 |       9 |       |       |          |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| NAP_INTERNET    |      1 |     10 |     10 |00:00:00.01 |       2 |       |       |          |
    |   5 |      INDEX FULL SCAN           | SYS_C00132995   |      1 |     10 |     10 |00:00:00.01 |       1 |       |       |          |
    |*  6 |     SORT JOIN                  |                 |     10 |    250 |     10 |00:00:00.01 |       7 |   267K|   256K|  237K (0)|
    |*  7 |      TABLE ACCESS FULL         | BL_TMP_INTRNT   |      1 |    250 |   5000 |00:00:00.01 |       7 |       |       |          |
    |   8 |    TABLE ACCESS BY INDEX ROWID | PS_RF_INST_PROD |     10 |      1 |     10 |00:00:00.01 |      12 |       |       |          |
    |*  9 |     INDEX UNIQUE SCAN          | SYS_C00132996   |     10 |      1 |     10 |00:00:00.01 |       2 |       |       |          |
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - filter("B"."SETID"='SHARE')
       6 - access("A"."SERVICE_UID"="B"."INST_PROD_ID")
           filter("A"."SERVICE_UID"="B"."INST_PROD_ID")
       7 - filter("A"."TERM_DESC" LIKE '%ip%')
       9 - access("B"."NAP_SURF_UID"="C"."INST_PROD_ID")
    
    32 rijen zijn geselecteerd.
    
    SQL> rollback
      2  /
    
    Rollback is voltooid.
    

    And it's your current statement. Please note the number of 5000 in the column begins:

    SQL> UPDATE /*+ gather_plan_statistics */ BL_TMP_INTRNT A
      2     SET A.FIX_IP_USER =
      3            (SELECT C.PRODUCT_ID
      4               FROM NAP_INTERNET B, PS_RF_INST_PROD C
      5              WHERE B.INST_PROD_ID = A.SERVICE_UID
      6                AND B.SETID = 'SHARE'
      7                AND C.INST_PROD_ID = B.NAP_SURF_UID)
      8   WHERE A.TERM_DESC LIKE '%ip%'
      9  /
    
    5000 rijen zijn bijgewerkt.
    
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'))
      2  /
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID  f1qtnpa0nmbh8, child number 0
    -------------------------------------
    UPDATE /*+ gather_plan_statistics */ BL_TMP_INTRNT A    SET A.FIX_IP_USER =           (SELECT
    C.PRODUCT_ID              FROM NAP_INTERNET B, PS_RF_INST_PROD C             WHERE B.INST_PROD_ID
    = A.SERVICE_UID               AND B.SETID = 'SHARE'               AND C.INST_PROD_ID =
    B.NAP_SURF_UID)  WHERE A.TERM_DESC LIKE '%ip%'
    
    Plan hash value: 3190675455
    
    -----------------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    -----------------------------------------------------------------------------------------------------------
    |   1 |  UPDATE                       | BL_TMP_INTRNT   |      1 |        |      0 |00:00:00.10 |    5076 |
    |*  2 |   TABLE ACCESS FULL           | BL_TMP_INTRNT   |      1 |    250 |   5000 |00:00:00.01 |       7 |
    |   3 |   NESTED LOOPS                |                 |   5000 |      1 |     10 |00:00:00.02 |      24 |
    |*  4 |    TABLE ACCESS BY INDEX ROWID| NAP_INTERNET    |   5000 |      1 |     10 |00:00:00.01 |      12 |
    |*  5 |     INDEX UNIQUE SCAN         | SYS_C00132995   |   5000 |      1 |     10 |00:00:00.01 |       2 |
    |   6 |    TABLE ACCESS BY INDEX ROWID| PS_RF_INST_PROD |     10 |     10 |     10 |00:00:00.01 |      12 |
    |*  7 |     INDEX UNIQUE SCAN         | SYS_C00132996   |     10 |      1 |     10 |00:00:00.01 |       2 |
    -----------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - filter("A"."TERM_DESC" LIKE '%ip%')
       4 - filter("B"."SETID"='SHARE')
       5 - access("B"."INST_PROD_ID"=:B1)
       7 - access("C"."INST_PROD_ID"="B"."NAP_SURF_UID")
    
    29 rijen zijn geselecteerd.
    

    Kind regards
    Rob.

  • Helps with the UPDATE statement

    Hello

    I have a table like this:
    create table test
    (id number,
    stat number,
    id_num number);
    data in the table:
    insert into table test (id,stat,id_num) values (1,112,'');
    insert into table test (id,stat,id_num) values (1,123,'');
    insert into table test (id,stat,id_num) values (2,134,'');
    insert into table test (id,stat,id_num) values (2,111,'');
    insert into table test (id,stat,id_num) values (3,112,'');
    insert into table test (id,stat,id_num) values (4,111,'');
    insert into table test (id,stat,id_num) values (4,12,'');
    insert into table test (id,stat,id_num) values (4,11,'');
    I want to update the column id_num with serial number under the same ID.
    Below is the table with coloumn successfully updated.
    insert into table test (id,stat,id_num) values (1,112,1);
    insert into table test (id,stat,id_num) values (1,123,2);
    insert into table test (id,stat,id_num) values (2,134,1);
    insert into table test (id,stat,id_num) values (2,111,2);
    insert into table test (id,stat,id_num) values (3,112,1);
    insert into table test (id,stat,id_num) values (4,111,1);
    insert into table test (id,stat,id_num) values (4,12,2);
    insert into table test (id,stat,id_num) values (4,11,3);
    Can someone give me a hint how to remove this?

    Thank you very much for your help!

    user13071990 wrote:
    Manik which is not a good solution because dat_document can also be duplicated.

    Alberto is no uniq key in the table, which is the main problem.

    It is not a good way to get the table without unique keys.

    To work around the problem, I suggest that, despite the fact that I do not use virtual ROWID.

    I did a test by inserting a date twice for the same id

    insert into test (id,dat_document,id_num) values (4,to_date('01.07.2012','dd.mm.yyyy'),'');
    

    Now, I used:

    MERGE INTO test a
         USING (SELECT rowid
                     , ROW_NUMBER () OVER (PARTITION BY id ORDER BY dat_document) AS val
                  FROM test) b
            ON (a.rowid = b.rowid)
    WHEN MATCHED
    THEN
       UPDATE SET id_num = val;
    
    SELECT *
      FROM test
    ORDER BY id, dat_document;
    
            ID DAT_DOCUMENT              ID_NUM
    ---------- --------------------- ----------
             1 01-01-2012 00:00:00            1
             1 01-02-2012 00:00:00            2
             2 01-03-2012 00:00:00            1
             2 01-04-2012 00:00:00            2
             3 01-05-2012 00:00:00            1
             4 01-06-2012 00:00:00            1
             4 01-07-2012 00:00:00            2
             4 01-07-2012 00:00:00            3
             4 01-08-2012 00:00:00            4
    

    Kind regards.
    Al

  • Question of sticking with the updated Illustrator

    Since the last update, I have graphic sticky questions of the Clipboard in Illustrator.

    It is

    Think for a good 20 seconds then glue an empty box

    or

    accidents of Illustrator.

    Everyone knows about this problem?

    Worm: 2015.2.0

    Win 10

    A complete re-installation has corrected this problem.

  • Problem with the update statement

    Hello

    Can someone tell me please the difference between

    H1. Select s.name, s.id, d.id, d.name in s, d where s.id = d.id;

    and

    H1. Select s.name, s.id, d.id, d.name in s d on s.id = d.id inner join;

    They give me the same result, but I would like to know how it works internally.

    And also

    update source X set name =)
    H3. Select Y.name in the destination Y where X.id = Y.id
    )
    where X.id in (select destination id);

    Is doing an update

    but when

    update source set name =)
    H3. Select Y.name in the destination source Y X on X.id = Y.id inner join
    )
    where X.id in (select destination id);

    using the above query, I get an error message stating "only query returns multiple lines.

    What is the error that I commit here?

    Thanks in advance

    Sana

    Assuming that table destination has PK/UK on id:

    SQL> create table source(id number,name varchar2(10));
    
    Table created.
    
    SQL> insert into source(id) select empno from emp
      2  /
    
    14 rows created.
    
    SQL> create table destination(id number,name varchar2(10));
    
    Table created.
    
    SQL> insert into destination select empno,ename from emp
      2  /
    
    14 rows created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> update (select s.id,s.name s_name,d.name d_name from source s inner join destination d on s.id = d.id)
      2  set s_name = d_name
      3  /
    set s_name = d_name
        *
    ERROR at line 2:
    ORA-01779: cannot modify a column which maps to a non key-preserved table
    
    SQL> alter table destination
      2    add constraint destination_pk
      3      primary key(id)
      4  /
    
    Table altered.
    
    SQL> update (select s.id,s.name s_name,d.name d_name from source s inner join destination d on s.id = d.id)
      2  set s_name = d_name
      3  /
    
    14 rows updated.
    
    SQL> select * from source
      2  /
    
            ID NAME
    ---------- ----------
          7369 SMITH
          7499 ALLEN
          7521 WARD
          7566 JONES
          7654 MARTIN
          7698 BLAKE
          7782 CLARK
          7788 SCOTT
          7839 KING
          7844 TURNER
          7876 ADAMS
    
            ID NAME
    ---------- ----------
          7900 JAMES
          7902 FORD
          7934 MILLER
    
    14 rows selected.
    
    SQL> 
    

    SY.

  • insertion of a comma in the records by using the update statement

    Hello
    I have a table with an address field LOCATIONS, and there are several files that contain Box or post office box before the street number, IE. "Box, 25 993 stone Ave", "1 194 John St box". What I would do, is add a comma between the box number and the street number for all records that start with "Box", IE 'box 25, Ave Pierre 993'. I have over 1000 addresses with a box number, an update statement would be more effective.

    I created a display to select addresses that have a number of box with 1 digit (only addresses such as 'Box 1 194 St John'). I don't know how to write a statement that inserts a comma in the 6th space to create ' box 1, 194 John St.

    Any ideas?

    You can use regular expressions

    update place set address = regexp_replace(address, 'Box ([[:digit:]]+)', 'Box \1,')
    
  • I have a question about the time machine. I recently updated my Quicken 2015 and there was something wrong with the update. Can I go back in just the Quicken file and restore it until I downloaded the update do I have to restore the entire

    I have a question about the time machine. I recently updated my Quicken 2015 and there was something wrong with the update. Can I come back in all the Quicken file and restore from time Machine before I downloaded the update to do, I need to restore the entire computer?

    Yes, you can just restore this file or application. Use Time Machine to back up or restore your Mac - Apple Support

  • I used to have a box with the letters/folder called "All messages" - I do not have. Don't know what happened to her - I guess I could have deleted by accident? Can someone tell me how to get it back? Thank you

    I use the MAIL function on my MacBook Pro. I used to have a box with the letters/folder called "All messages" - I do not have. Don't know what happened to her - I guess I could have deleted by accident? Can someone tell me how to get it back? Thank you

    What do you mean 'all messages '? all mail entering, or email any or all all. ?

  • How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    Ashley,

    What about window > show the rectangle enclosing (Ctrl / Cmd + Shift + B to toggle)?

  • How to use the user defined function in the Update statement

    Hi all

    I wrote under the update statement to update the column based on the return value of function. but it does not work. Could someone help me on this. This function returns a single value for each project.

    Thanks in advance.

    UPDATE dg2. OD_PROJ_LOOKUP_TEMP o
    SET Months_In_Stage_Cnt = Months_In_Stage_Cnt_ret (o.project_id) select the double;


    Thank you
    Deb

    PLS-00231: function 'MONTHS_IN_STAGE_CNT_RET' cannot be used in SQL

    -What is the function that is declared private in a package? If Yes, then it must be public, otherwise the SQL engine cannot be used.

    Published by: Dom Brooks on November 18, 2011 09:43

  • Try to update Photoshop today. Window filled with small boxes with the letter A inside of them.

    Screen Shot 2016-04-04 at 4.37.21 PM.png

    What happens in the world I can do about it? Tried to contact Adobe customer service, but they replied that "the issue is resolved" and dismissed the case. ?????????

    Hello

    Is ask your Admin username and password.

    Please enter the details and to proceed with the update.

    Let us know if this helps!

  • Problems with the update of Windows on Windows 8 and also updated to Windows 8.1.

    Original title: update windows 8 to 8.1

    I really hate this computer is a laptop HP 2000 I got it from a friend and the place its been annoying the * out of me, I try to install the KB update, so I can skip all the other updates and I get an error of BS I use windows update, and I get 188 updates and when im installing the 180th update just white out and stops off the coast while he was on the charger, so I start backup it and now its stuck in an endless loop with the "configuration of the updates to Windows restore changes Failure" he was giving me an infinite loop of spinning points and all I want is to install windows on that 10

    Hi Giovanni,.

    Thank you for your response with the current state of the question.

    I suggest you try directly upgrade to Windows 10 of Windows 8 through the media creation tool.

    I recommend you to check the system requirements for the installation of 10 Windows on the computer.

    https://www.Microsoft.com/en-in/Windows/Windows-10-specifications

    Also communicate with the computer manufacturing and try to confirm if your computer is compatible to install Windows 10 or not.

    If your computer meets all the system requirements, I suggest to use the media creation tool in the link below and choose the option PC this upgrading to Windows 10. Before moving to Windows 10, I recommend you make a backup of important files and folders on the external hard drive.

    https://www.Microsoft.com/en-in/software-download/home

    Let us know if you need further assistance on related issues of Windows and we will be happy to help you.

  • &gt;: everyone is having the same problem with all the days that I have now with the update on thursda after update, it could not be started "could not find xpcom" restored Dáil

    with the update of daily Thursday (Australia) after update owned couldn't boot received message "could not find xpcom.
    I then restored by day sauvegardΘ installed upgrading again every day would not restart with the same message
    I tried again on Saturday you have the same problem
    I'm now ignoring the update message that is very annoying because he wants me to update daily

    The bug in question should be solved with a daily update of today. However, I agree with the recommendation to go with 31.0 once it comes out next Tuesday, or at least to use the beta versions (once per cycle) as a compromise between stability and get the latest features and updates to the platform.

  • Dvd player MediaSmart not working - when a Blu - ray Disc I'm invited to be updated, but even with the update it will not play.

    I have laptop HP Pavilion dv7-1260.  When I put in a blu - ray disc I'm propmted to get an update.  Even with the update, it will not play a blu ray.

     

    Hello

    ·         What is the update message that you receive?

    ·         Do you have an error message when you try to read the Blu - ray Disc?

    ·         This problem occurs only with Blu ray discs or any of the others?

    To play a Blu - ray disc, you must use a non-Microsoft program that supports Blu - ray playback and a device that can play Blu - ray discs.

    See the link below:

    http://Windows.Microsoft.com/en-us/Windows7/MPEG-and-DVD-video-frequently-asked-questions

Maybe you are looking for

  • 'Sounds' disabled in the Notifications tab

    As far as I know, I don't have sounds cut permanently any where (I don't see that preference any place), but the option is disabled. Now, when I get a call, I know only the answer/ignore the UI appears on my screen. I want to cut _almost_ all the sou

  • Pavilion dv7: where can I get uninstalled video software

    I did a cleanup of my laptop and uninstalled a number of programs. Coincidentally, I think that I uninstalled the video software that came with the laptop. Then I emptied the Recycle Bin. So I think that it has gone completely Can someone tell me whe

  • Photosmart C5580 printer C5580: - Lack of CD

    The link to the HP Solution Center does not open so I tried to figure out what is wrong with him. I'm currently going by the doctor of printing & scanning HP and it's at a point where it tells me that I need the original CD for this step. I can't fin

  • using Remote Desktop for access the ddns domain how to

    Hello Hope someone can help me. I have a host pc that is running windows 7 Professional, that it has installed the TightVNC server. It works well with the connection to other machines using tightVNC viewer to connect to other PCs. I implemented the p

  • Unable to free application on the target

    I am having trouble running on a BB Z10 camera to test the Release version of my application native-built.  I use Momentics IDE 2.0 with NDK 10.2 Gold API installed. The specific error that I get from the IDE when you run the standard version is "una