Update two different tables by a single sql query:

Hi All,
i need to update two different talbes in a single sql query..
i m using the following query
UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12
AND
UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
i m getting the following error:
Odbc driver returned an error (SQLExecDirectW).
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12 . [nQSError: 17011] SQL statement execution failed. (HY000)
SQL Issued: EXECUTE PHYSICAL CONNECTION POOL writeback UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
but when i m ushin the same query in Microsoft SQL Server it executes properly:
please help me out...

Duplicate thread. I've already answered on your other thread...
update two different tables by a single sql query:

Similar Messages

  • How to update two different tables by ony one sql query???

    Hi All,
    i need to update two different talbes in a single sql query..
    i m using the following query
    UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12
    AND
    UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
    i m getting the following error:
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12 . [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL writeback UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
    but when i m ushin the same query in Microsoft SQL Server it executes properly:
    please help me out...

    There's no valid syntax for this, but there are some tricks you could do to achieve it.
    i) You could place an update trigger on TABLE1 to update TABLE2 automatically.
    ii) You could define a view across both tables and add an INSTEAD OF UPDATE trigger to it to maintain them.
    If I had to do this I'd choose option2, but frankly I'd just be running two updates if it really was me.

  • Use two different table in a single alv

    hi all , i m working on zproggram but in display i have a problem that i have data in two int table which do not have common field,i m using  fm REUSE_ALV_BLOCK_LIST_APPEND  and 'REUSE_ALV_BLOCK_LIST_DISPLAY but it is displaying data in this format
    matnr  demand dispatch_ quant   balance
    721008 2000     1000                   1000.
    pdc mc paint fg
    50  80   80   80
    but i want it should come into single coloum  for eg in this format
    matnr    demand   dispatch_ quant   balance  pdc mc paint fg
    721008   2000       1000                   1000.    50   80   80    80
    can anybody help please.
    points will be rewarded surely
    721008 2000     1000                   1000.

    Hi Sarabjit,
    In normal ALV, i dont think it is possible to display two internal tables side by side.....one way is you can club both the internal tables into one internal table (By introducing common fields).
    If not i think using OOPS ALV, with help of containers you can acheive this functionality..
    Best Regards,
    Ram.

  • Insert same record on two different tables (no master detail)

    Hi all,
    I'd like to know how to insert 1 record into two different
    tables.
    the first table is corni_dati the second is cornidati_prev
    anytime someone inserts a new record both tables should be
    filled.
    if ((isset($HTTP_POST_VARS["MM_insert"])) &&
    ($HTTP_POST_VARS["MM_insert"] == "form1")) {
    $insertSQL = sprintf("INSERT INTO corni_dati (corni_id,
    disciplina,
    codice_modulo, insegnanti, classi, obiettivi, prerequisiti,
    ud1, ud2,
    ud3, ud4, ud5, ud6, metodologia, collegamenti, verifiche,
    verifiche_note, durata, periodo_inizio, periodo_fine, note,
    indirizzo,
    modnum, modulo_titolo, `data`, compilato, descrizione) VALUES
    (%s, %s,
    %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
    %s, %s, %s,
    %s, %s, %s, %s, %s, %s, %s)",
    GetSQLValueString($HTTP_POST_VARS['corni_id'],
    "int"),
    GetSQLValueString($HTTP_POST_VARS['disciplina'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['codice_modulo'], "text"),
    GetSQLValueString($HTTP_POST_VARS['insegnanti'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['classi'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['obiettivi'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['prerequisiti'], "text"),
    GetSQLValueString($HTTP_POST_VARS['ud1'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['ud2'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['ud3'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['ud4'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['ud5'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['ud6'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['metodologia'], "text"),
    GetSQLValueString($HTTP_POST_VARS['collegamenti'], "text"),
    GetSQLValueString($HTTP_POST_VARS['verifiche'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['verifiche_note'], "text"),
    GetSQLValueString($HTTP_POST_VARS['durata'],
    "int"),
    GetSQLValueString($HTTP_POST_VARS['periodo_inizio'], "text"),
    GetSQLValueString($HTTP_POST_VARS['periodo_fine'], "text"),
    GetSQLValueString($HTTP_POST_VARS['note'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['indirizzo'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['modnum'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['modulo_titolo'], "text"),
    GetSQLValueString($HTTP_POST_VARS['data'],
    "date"),
    GetSQLValueString($HTTP_POST_VARS['compilato'],
    "text"),
    GetSQLValueString($HTTP_POST_VARS['descrizione'], "text"));
    mysql_select_db($database_itiscorni, $itiscorni);
    $Result1 = mysql_query($insertSQL, $itiscorni) or
    die(mysql_error());
    $insertGoTo = "creacodice_doc.php";
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
    header(sprintf("Location: %s", $insertGoTo));

    If you are doing this then you really should have a look at
    your database
    design. Read up on the first 3 normal forms.
    Pat.
    "darrel" <[email protected]> wrote in message
    news:ee77jg$302$[email protected]..
    >
    >
    > --
    >> Hi all,
    >> I'd like to know how to insert 1 record into two
    different tables.
    >
    > In your SQL query, just use two inserts:
    >
    > INSERT into TABLE1...; INSERT into TABLE2...
    >
    > Darrel
    >

  • Sum two different columns from two different tables

    Can you select and sum two different columns, from two different tables in the same sql statement?
    i.e.
    table1
    Item----OnHand_Qty
    A--------10
    A--------15
    B--------10
    B--------10
    C--------20
    table2
    Item----Trx_Qty
    A--------2
    A--------4
    A--------6
    B--------1
    B--------1
    C--------4
    I'm looking for the following results from a query
    Item----Sum(Onhand_Qty)---Sum(Trx_Qty)
    A--------25

    Like this?
    SQL> create table table1 (item,onhand_qty)
      2  as
      3  select 'A', 10 from dual union all
      4  select 'A', 15 from dual union all
      5  select 'B', 10 from dual union all
      6  select 'B', 10 from dual union all
      7  select 'C', 20 from dual union all
      8  select 'D', 30 from dual
      9  /
    Tabel is aangemaakt.
    SQL> create table table2 (item, trx_qty)
      2  as
      3  select 'A', 2 from dual union all
      4  select 'A', 4 from dual union all
      5  select 'A', 6 from dual union all
      6  select 'B', 1 from dual union all
      7  select 'B', 1 from dual union all
      8  select 'C', 4 from dual union all
      9  select 'E', 3 from dual
    10  /
    Tabel is aangemaakt.
    SQL> select nvl(t1.item,t2.item) item
      2       , t1.sum_onhand_qty
      3       , t2.sum_trx_qty
      4    from ( select item, sum(onhand_qty) sum_onhand_qty
      5             from table1
      6            group by item
      7         ) t1
      8         full outer join
      9         ( select item, sum(trx_qty) sum_trx_qty
    10             from table2
    11            group by item
    12         ) t2
    13         on (t1.item = t2.item)
    14  /
    I SUM_ONHAND_QTY SUM_TRX_QTY
    A             25          12
    B             20           2
    C             20           4
    E                          3
    D             30
    5 rijen zijn geselecteerd.Regards,
    Rob.

  • Taking data from two different server in a single table

    Hi All,
    can u plz tell me i want take a data from a two different server in a single table
    Thanks,
    Bell.

    Again, you have written the same sentence. I have 2 servers Server1 and Server2 and one table called my_table (You or God knows where this table is).
    Now tell us what you want to do ?
    Sidhu
    http://amardeepsidhu.blogspot.com

  • Sum of same fields in two different tables

    Hi ,
    I am facing a problem, hope anyone would help
    I have two tables.. here is the sample data..
    create table t1
    (item_ID NUMBER(2),
    book_ID NUMBER(2),
    price NUMBER(2))
    insert into t1 (item_ID, book_ID, price) values (1,1,60);
    insert into t1 (item_ID, book_ID, price) values (1,2,70);
    insert into t1 (item_ID, book_ID, price) values (1,3,80);
    insert into t1 (item_ID, book_ID, price) values (2,1,10);
    insert into t1 (item_ID, book_ID, price) values (2,1,20);
    insert into t1 (item_ID, book_ID, price) values (1,3,40);
    create table t2
    (item_ID NUMBER(2),
    book_ID NUMBER(2),
    price NUMBER(2))
    insert into t2 (item_ID, book_ID, price) values (1,1,89);
    insert into t2 (item_ID, book_ID, price) values (1,2,29);
    insert into t2 (item_ID, book_ID, price) values (1,3,99);
    insert into t2 (item_ID, book_ID, price) values (2,1,55);
    insert into t2 (item_ID, book_ID, price) values (2,1,90);
    insert into t2 (item_ID, book_ID, price) values (1,3,10);
    as you can see, both tables have the same column names with different data. what
    I require is that i need to calculate the SUM of price grouped by book_id from
    both the tables in a single SQL statement output.
    so my required output is this:
    BOOK_ID SUM(PRICE)
    1 323
    2 99
    3 229
    where the SUM(price) for each book_id is for all the books in both the tables
    where book_id = 1 and then 2 in the second row and then 3 in the third row.
    Would anyone please help, as I am unable to write the query for this.?
    Thanks,
    Sonali.

    <quote>I was just curious if we can do that by some other SQl query and using UNION ALL operator...</quote>
    Of course there are other ways to do it ... but not necessarily better ... just to satisfy your curiosity:
    flip@FLOP> select book_id,sum(price) from t1 group by book_id;
       BOOK_ID SUM(PRICE)
             1    5898240
             2    4587520
             3    7864320
             4    2621440
    Elapsed: 00:00:01.02
    flip@FLOP> select book_id,sum(price) from t2 group by book_id;
       BOOK_ID SUM(PRICE)
             1   30670848
             2    3801088
             3   15597568
             5    1310720
    Elapsed: 00:00:02.06
    flip@FLOP> SELECT book_id, sum(price)
      2  FROM ( select * from t1
      3         union all
      4         select * from t2
      5       )
      6  GROUP BY book_id;
     
       BOOK_ID SUM(PRICE)
             1   36569088
             2    8388608
             3   23461888
             4    2621440
             5    1310720
     
    Elapsed: 00:00:04.01
    flip@FLOP>
    flip@FLOP> with a1 as
      2       (
      3         select book_id, sum(price) p
      4         from   t1
      5         group by book_id
      6       )
      7      ,a2 as
      8       (
      9         select book_id, sum(price) p
    10         from   t2
    11         group by book_id
    12       )
    13  select nvl(a1.book_id,a2.book_id), nvl(a1.p,0)+nvl(a2.p,0)  p
    14  from  a1 full outer join a2 on (a1.book_id = a2.book_id)
    15  ;
     
    NVL(A1.BOOK_ID,A2.BOOK_ID)          P
                             1   36569088
                             2    8388608
                             3   23461888
                             4    2621440
                             5    1310720
     
    Elapsed: 00:00:04.02

  • Single SQl Query with different where conditions

    Experts,
    I have a requirement to design a report. Here are the details
    I have Report table layout
    Profit center Gross sales (This Year) Gross Sales (Last Year) % change Year of Year
    The Report has a selection of entering the Start Date.
    I have a single table in oracle which has profit center and Gross Sales Values on daily basis.
    I want to write a single sql query to calculate both Gross Sales current year and Gross Sales Last Year. I can calculate Gross Sales Current Year by putting the where condition for start date = Current Year Date which i pass through report. I want to calculate the Gross Sales Last Year in the Same query by putting the different where condition i.e start date = Last Year date based on the date input.
    I dont know how to put two where conditions in single query for two different columns.
    Any help will be appreciated.
    Thanks in advance
    Regards
    Santosh

    instead of changing your where clause couldn't you just determine the yearly totals from your table and then use the lag statement to get last years total?
    something like this?
    I just made up 10,000 days worth of sales and called it fake table it is supposed to represent a variant of the table you were describing as your base table.
    with fake_table as
    ( select trunc(sysdate + level) the_day,
    level daily_gross_sales
    from dual
    connect by level < 10001
    select yr, year_gross_sale, lag(year_gross_sale) over (order by yr) prev_year_gross_sale,
    (year_gross_sale - lag(year_gross_sale) over (order by yr))/year_gross_sale * 100 percent_change
    from
    (select distinct yr, year_gross_sale from
    select the_day,
    daily_gross_sales,
    extract(year from the_day) yr,
    extract(year from add_months(the_day,12)) next_yr,
    sum(daily_gross_sales) over (partition by extract(year from the_day)) year_gross_sale
    from fake_table
    order by yr
    )

  • Extracting difference is attributes for a given row in two different tables

    Hope you are doing great. Below is the problem i am facing. There are two tables
    1: employeeinfo (HR maintains this table and we cannot alter the records of this table)
    2: cmp_employee_info (i have created this table with limited fields we need to monitor for changes, the records in this table are limited).
    Procedure:
    1: The second tabel stores the same information as employee info but is not updated by HR, but the first table can at any point be updated by HR.
    2: A program checks every day for differences in table employeeinfo and cmp_employee_info. If any changes are found it needs to aletr us via emiail regarding he changes and also it updated the cmp_employee_info table.
    I have this query in place.
    (SELECT cmp_employeeinfo_rms.logonid,cmp_employeeinfo_rms.firstname,cmp_employeeinfo_rms.lastname,cmp_employeeinfo_rms.emailaddr,cmp_employeeinfo_rms.Locationname,cmp_employeeinfo_rms.termdate,cmp_employeeinfo_rms.persontype,cmp_employeeinfo_rms.jobclass,cmp_employeeinfo_rms.assignmentstatus,cmp_employeeinfo_rms.mgrlogonid FROM cmp_employeeinfo_rms
    LEFT OUTER JOIN employeeinfo
    ON cmp_employeeinfo_rms.logonid = employeeinfo.logonid
    where (cmp_employeeinfo_rms.mgrlogonid != employeeinfo.mgrlogonid or cmp_employeeinfo_rms.lastname != employeeinfo.lastname or cmp_employeeinfo_rms.locationname != employeeinfo.locationname or cmp_employeeinfo_rms.termdate != employeeinfo.termdate or cmp_employeeinfo_rms.persontype != employeeinfo.persontype or cmp_employeeinfo_rms.jobclass != employeeinfo.jobclass or cmp_employeeinfo_rms.assignmentstatus != employeeinfo.assignmentstatus))
    UNION
    (SELECT employeeinfo.logonid,employeeinfo.firstname,employeeinfo.lastname,employeeinfo.emailaddr,employeeinfo.Locationname,employeeinfo.termdate,employeeinfo.persontype,employeeinfo.jobclass,employeeinfo.assignmentstatus,employeeinfo.mgrlogonid FROM employeeinfo JOIN cmp_employeeinfo_rms on cmp_employeeinfo_rms.logonid=employeeinfo.logonid)
    The output to the above query is.
    LOGONID
    FIRSTNAME
    LASTNAME
    EMAIL
    LOCATION
    TERMDATE
    TYPE
    DESIGNATION
    ASSIGNMENTSTATUS
    MGRID
    TEST1
    FIRST1
    LAST1
    EMAIL1
    L1
    NULL
    Associate
    D1
    Active Assignment
    M1
    TEST2
    FIRST2
    LAST2
    EMAIL2
    L2
    NULL
    Associate
    D2
    Active Assignment
    M2
    TEST3
    FIRST3
    LAST3
    EMAIL3
    L3
    NULL
    Associate
    D3
    Active Assignment
    M3
    TEST4
    FIRST4
    LAST4
    EMAIL4
    L4
    NULL
    Associate
    D4
    Active Assignment
    M4
    TEST5
    FIRST5
    LAST5
    EMAIL5
    L5
    NULL
    Associate
    D5
    Active Assignment
    M5
    TEST6
    FIRST6
    LAST6
    EMAIL6
    L6
    NULL
    Associate
    D6
    Active Assignment
    M6
    TEST7
    FIRST7
    LAST7
    EMAIL7
    L7
    NULL
    Associate
    D7
    Active Assignment
    M7
    TEST8
    FIRST8
    LAST8
    EMAIL8
    L8
    NULL
    Associate
    D8
    Active Assignment
    M8
    TEST9
    FIRST9
    LAST9
    EMAIL9
    L9
    NULL
    Associate
    D9
    Active Assignment
    M9
    TEST10
    FIRST10
    LAST10
    EMAIL10
    L10
    NULL
    Associate
    D10
    Active Assignment
    M10
    TEST11
    FIRST11
    LAST11
    EMAIL11
    L11
    NULL
    Associate
    D11
    Active Assignment
    M11
    TEST12
    FIRST12
    LAST12
    EMAIL12
    L12
    NULL
    Associate
    D12
    Active Assignment
    M12
    TEST13
    FIRST13
    LAST13
    EMAIL13
    L13
    NULL
    Associate
    D13
    Active Assignment
    M13
    TEST14
    FIRST14
    LAST14
    EMAIL14
    L14
    NULL
    Associate
    D14
    Active Assignment
    M14
    TEST15
    FIRST15
    LAST15
    EMAIL15
    L15
    NULL
    Associate
    D15
    Active Assignment
    M15
    TEST16
    FIRST16
    LAST16
    EMAIL16
    L16
    NULL
    Associate
    D16
    Active Assignment
    M16
    TEST17
    FIRST17
    LAST17
    EMAIL17
    L17
    NULL
    Associate
    D17
    Active Assignment
    M17
    TEST18
    FIRST18
    LAST18
    EMAIL18
    L18
    NULL
    Associate
    D18
    Active Assignment
    M18
    TEST18
    FIRST18
    LAST18
    EMAIL18
    L18
    NULL
    Outsorced
    D18
    Active Assignment
    M18
    TEST19
    FIRST19
    LAST19
    EMAIL19
    L19
    NULL
    Associate
    D19
    Active Assignment
    M19
    TEST20
    FIRST20
    LAST20
    EMAIL20
    L20
    NULL
    Associate
    D20
    Active Assignment
    M20
    TEST21
    FIRST21
    LAST21
    EMAIL21
    L21
    NULL
    Associate
    D21
    Active Assignment
    M21
    TEST22
    FIRST22
    LAST22
    EMAIL22
    L22
    NULL
    Associate
    D22
    Active Assignment
    M22
    TEST23
    FIRST23
    LAST23
    EMAIL23
    L23
    NULL
    Associate
    D23
    Active Assignment
    M23
    As you would have noticed that the following record appears twice as there is a change in persontype.
    TEST18
    FIRST18
    LAST18
    EMAIL18
    L18
    NULL
    Associate
    D18
    Active Assignment
    M18
    TEST18
    FIRST18
    LAST18
    EMAIL18
    L18
    NULL
    Outsorced
    D18
    Active Assignment
    M18
    I wish to extract any such change with the field changed. After recording the change i would update the second table as well.
    Edited by: Prashant_Dixit on Apr 20, 2012 10:25 PM

    Prashant_Dixit wrote:
    Hi,
    I just need a report of what the changes are.As another poster has suggested above, you may want to have a look at using a materialized view log instead of your approach. The MV log approach is better as it
    a) is maintained by database
    b) is easy to setup
    c) is easy to maintain
    d) is easy to query.
    Following is a demo of how you can use it.
    SQL> select * from v$version ;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production         
    PL/SQL Release 11.2.0.1.0 - Production                                         
    CORE     11.2.0.1.0     Production                                                     
    TNS for Linux: Version 11.2.0.1.0 - Production                                 
    NLSRTL Version 11.2.0.1.0 - Production                                         
    SQL> create user a identified by a ;
    User created.
    SQL> grant create session, create table to a ;
    Grant succeeded.
    SQL> alter user a quota unlimited on users ;
    User altered.
    SQL> create table a.empinfo as select * from hr.employees ;
    Table created.
    SQL> conn a/a
    Connected.
    SQL> select * from tab ;
    TNAME                          TABTYPE  CLUSTERID                              
    EMPINFO                        TABLE                                           
    SQL> alter table empinfo add constraint e_pk primary key (employee_id) ;
    Table altered.
    SQL> desc empinfo
    Name                                      Null?    Type
    EMPLOYEE_ID                               NOT NULL NUMBER(6)
    FIRST_NAME                                         VARCHAR2(20)
    LAST_NAME                                 NOT NULL VARCHAR2(25)
    EMAIL                                     NOT NULL VARCHAR2(25)
    PHONE_NUMBER                                       VARCHAR2(20)
    HIRE_DATE                                 NOT NULL DATE
    JOB_ID                                    NOT NULL VARCHAR2(10)
    SALARY                                             NUMBER(8,2)
    COMMISSION_PCT                                     NUMBER(2,2)
    MANAGER_ID                                         NUMBER(6)
    DEPARTMENT_ID                                      NUMBER(4)
    SQL> create materialized view log on empinfo with (salary) including new values ;
    Materialized view log created.
    SQL> select * from tab ;
    TNAME                          TABTYPE  CLUSTERID                              
    EMPINFO                        TABLE                                           
    MLOG$_EMPINFO                  TABLE                                           
    RUPD$_EMPINFO                  TABLE                                           
    SQL> desc mlog$_empinfo
    Name                                      Null?    Type
    EMPLOYEE_ID                                        NUMBER(6)
    SALARY                                             NUMBER(8,2)
    SNAPTIME$$                                         DATE
    DMLTYPE$$                                          VARCHAR2(1)
    OLD_NEW$$                                          VARCHAR2(1)
    CHANGE_VECTOR$$                                    RAW(255)
    XID$$                                              NUMBER
    SQL> update empinfo set salary = salary * 1.2 where department_id = 10 ;
    1 row updated.
    SQL> update empinfo set salary = salary * 1.1 where department_id = 30 ;
    6 rows updated.
    SQL> commit ;
    Commit complete.
    SQL> select count(*) from mlog$_empinfo ;
      COUNT(*)                                                                     
            14                                                                     
    SQL> select employee_id, salary, dmltype$$ from mlog$_empinfo order by snaptime$$ ;
    EMPLOYEE_ID     SALARY D                                                       
            200       4400 U                                                       
            200       5280 U                                                       
            114      11000 U                                                       
            114      12100 U                                                       
            115       3100 U                                                       
            115       3410 U                                                       
            119       2750 U                                                       
            116       3190 U                                                       
            117       2800 U                                                       
            117       3080 U                                                       
            118       2600 U                                                       
    EMPLOYEE_ID     SALARY D                                                       
            118       2860 U                                                       
            119       2500 U                                                       
            116       2900 U                                                       
    14 rows selected.Hope this helps.

  • How to load data from a flat file to two different tables at a time.

    I am not aware of Sql Loader so Please any body suggest me that is there any way to load data from excel sheet to two different tables at a time its very urgent.
    with regards,
    Srinivas.R

    Read Utilities Guide from the Oracle Documentation Library. See
    <br>
    Oracle Database FAQs
    </br>

  • BDC recording(updating two line items in a single call)

    Hi,
    I have a problem with the transaction PK31,while recording we enterd material number,plant,supply area in the first screen,after that it display line items for that control cycle,I want to update some fields in that line items,when i updated quantity and status fields in the first line item after that i cliked the change "qty/status button" and it saves that field values and it comes out from the transaction.
    can you please suggest what is the solution for updating two line items in a single call(PK31 transaction).

    Hi,
    In one screen . Put 2 containers with different names.
    cont1,cont2
    on each of the container call grid,grid1 like below .
    1. this is for item line display
    IF g_r_grid IS INITIAL.
          CREATE  OBJECT  g_r_cont
                      EXPORTING  container_name  =  'CONT1'.
        g_r_variant  =  sy-repid.
    *--Build  field  catalog
        PERFORM build_field_catalog.
    *--Layout selection
        g_r_layo-cwidth_opt  = g_c_set.
        g_r_layo-no_rowmark  = g_c_set.
        g_r_layo-sel_mode    = space.
        CALL METHOD g_r_grid->set_table_for_first_display
          EXPORTING
            i_buffer_active = g_c_set
            is_variant      = g_r_variant
            is_layout       = g_r_layo
            i_save          = g_c_set
            i_default       = g_c_set
          CHANGING
            it_outtab       = g_t_alv
            it_fieldcatalog = g_t_fieldcat
            it_sort         = g_t_sort.
      endif
    1. this is for error data display
    IF g_r_grid1 IS INITIAL.
          CREATE  OBJECT  g_r_cont
                      EXPORTING  container_name  =  'CONT2'.
        g_r_variant  =  sy-repid.
    *--Build  field  catalog
        PERFORM build_field_catalog.
    *--Layout selection
        g_r_layo-cwidth_opt  = g_c_set.
        g_r_layo-no_rowmark  = g_c_set.
        g_r_layo-sel_mode    = space.
        CALL METHOD g_r_grid->set_table_for_first_display
          EXPORTING
            i_buffer_active = g_c_set
            is_variant      = g_r_variant
            is_layout       = g_r_layo
            i_save          = g_c_set
            i_default       = g_c_set
          CHANGING
            it_outtab       = g_t_error
            it_fieldcatalog = g_t_fieldcat
            it_sort         = g_t_sort.
      endif

  • To find Common data in 2 columns in two different tables.

    Hi,
    Could someone help me out with a querry to find out common data from 2 columns in two different tables??
    Thanks
    Rajesh

    966915 wrote:
    suppose i hav 2 tables
    Table A
    s.No name EID
    1 aaa 123
    2 bbb 234 ... etc..
    and Table B
    S.no salary eid location
    1 mmm$ 123 india
    2 ddd$ 556 Uk
    3 fff$ 236 US
    How do i select the common entry in both the tables??why do you post in forum for SQL & PL/SQL; yet never post anything in either language?
    what do you mean by "common enrty"?
    does every column value must match exactly across 2 rows in different table?

  • Comparing row values in two different tables

    Hello,
    Does anyone know if it is possible to compare (and possibly highlight - which I know can be done) row values in two different tables?
    I have a ZIP Code column in table A that I want to compare to a ZIP Code column in table B and highlight those ZIP Codes that are present in table B but not in table A etc. Is this possible?
    Thanks,
    Kenneth

    To be able to apply conditional formatting, I must edit the formulas this way.
    =IF(ISBLANK(B)," ",IF(ISERROR(VLOOKUP(B,Tableau 2 :: B,1,0))," ",VLOOKUP(B,Tableau 2 :: B,1,0)))
    =IF(ISBLANK(B)," ",IF(ISERROR(VLOOKUP(B,Tableau 1 :: B,1,0))," ",VLOOKUP(B,Tableau 1 :: B,1,0)))
    I replaces the four empty strings by strings containing one space character.
    In the field supposed to contain the text which is not contained I just entered a single space character.
    Yvan KOENIG (from FRANCE vendredi 12 septembre 2008 20:52:11)

  • Extracting unique records from two different tables record

    Hello,
    In the following code of two different tables www.testing.com exists in both tables. I want to compare two different columns of the two different tables to get unique records.
    SQL> select unique(videoLinks) from saVideos where sa_id=21;
    VIDEOLINKS
    www.testing.com
    SQL> ed
    Wrote file afiedt.buf
      1* select unique(picLinks) from saImages where sa_id=21
    SQL> /
    PICLINKS
    test
    test14
    www.hello.com
    www.testing.comThanks & best regards

    Unfortunatly you didn't mention the expected output. I guess it would be the one line
    "www.testing.com"
    in that case simply join the two tables.
    select *
    from saVideos v
    join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks
    where v.sa_id=21;If needed then you could change the select list to retrieve only distinct values.
    select unique v.sa_id, v.videolinks
    from saVideos v
    join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks
    where v.sa_id=21;I usually avoid distinct/unique whereever possible. This requires the database to do a sort and makes the query slow.
    Edited by: Sven W. on Feb 10, 2011 1:55 PM

  • How to create a foreign key for the table from two different tables?

    Hi All,
    I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
    code 1:
    CREATE TABLE SAMPLE_CONS_CHECK
            (NAME VARCHAR2(10),
            SERIES  VARCHAR2(5)
    CREATE TABLE SAMPLE_CONS2_CHECK
            (NAME  VARCHAR2(5),
             MODEL  NUMBER
    CREATE TABLE SAMPLE_CONS3_CHECK
            (NAME  VARCHAR2(5),
             MODEL_NO  NUMBER
            )code 2
    alter table SAMPLE_CONS_CHECK
    add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS2_CHECK
    add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS3_CHECK
    add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS_CHECK
        NAME
    ) ON DELETE CASCADE;
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS2_CHECK
        NAME
    ) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
    How can i solve this problem? Can anyone halp me about this?
    Thanks
    Edited by: orasuriya on Aug 8, 2009 2:02 AM

    Actually the design is completely incorrect.
    What you say is
    I have
    'foo', 'foo series'
    'foo','foo model'
    'foo',666
    By virtue of table3 referring to both table1 and table2.
    This means you actually need to have 1 (one) table:
    'foo','foo series','foo model', 666
    And the 'problem' disappears.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • Vendor and Customer from 11.5.8 to R12

    Dear all, We are using E-Business Suite 11.5.8 and we will re-implement on R12. What is the quickest way to import vendor and customer informations from 11.5.8 to R12? so that we don't have to re-input all informatioin all over again. Please advice.

  • How do you upload a folder to a FTP site?

    I want to publish a .com site to the web. I was told to sign up to a FTP "client". So I chose Fetcher. I published the site to a desk top folder. (Did I really "publish" anything if no one can read it?) Apple HELP then tells me to "download an FTP cl

  • Function Module (Execution)

    Hi All, Kindly help me out with the below scenario Scenario: 1) I have to "CHEKIN" a file into DMS system using XI from file system, here DOC info is already present in the DMS system.Now only CHECKIN of file has to happen in correspond to particular

  • Android update for note3

    When will there be an update for the Samsung Note 3? The last update was May but ALL the bloat ware has been updated multiple times since then, Mu Microsoft has had multiple updates as well should I look for a windows phone instead???

  • Photoshop elements 11 trouble installing

    I am trying to install this on my mac laptop. I keep getting this message "Installation to case-sensitive drives not supported. Please choose a diferent drive location to install. What do I need to do???