Instead of trigger is NOT firing for merge statements in Oracle 10gR2

The trigger fires fine for a update statement, but not when I use a merge statement
with an update clause. Instead I get the normal error for the view ( which is a union all view, and therefore not updatable.)
The error is :-
ORA-01733: virtual column not allowed here
oracle release is 10.2.0.2 for AIX 64L
Is this a known bug ?
I've used a multi-table insert statement to work around the problem for inserts, but
for updates, I'd really like to be able to use a merge statement instead of an update.
Mark.

This is my cut-down version :-
In this case case I'm getting an :-
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
rather then the ora-01733 error I get in the real code ( which is an update from an involved
XML expression - cast to a table form)
create table a ( a int primary key , b char(30) ) ;
create table b ( a int primary key , b char(30) ) ;
create view vw_a as
select *
from a
union all
select *
from b ;
ALTER VIEW vw_a ADD (
PRIMARY KEY
(a) DISABLE);
DROP TRIGGER TRG_IO_U_ALL_AB;
CREATE OR REPLACE trigger TRG_IO_U_ALL_AB
instead of update ON vw_a
for each row
begin
update a targ
set b = :new.b
where targ.a = :new.a
if SQL%ROWCOUNT = 0
then
     update b targ
     set b      = :new.b
     where targ.a = :new.a
end if ;
end ;
insert into a values (1,'one');
insert into a values (2,'two');
insert into a values (3,'three');
insert into b values (4,'quatre');
insert into b values (5,'cinq');
insert into b values (6,'six');
commit;
create table c as select a + 3 as a, b from a ;
commit;
merge into vw_a targ
using (select * from c ) src
on ( targ.a = src.a )
when matched
then update
set targ.b = src. b
select * from vw_a ;
rollback ;
update vw_a b
set b = ( select c.b from c where b.a = c.a )
where exists ( select c.b from c where b.a = c.a ) ;
select * from vw_a ;
rollback ;

Similar Messages

  • Alert not firing for SQL Statement Script

    Hi All,
    I have defined an alter which will trigger when a requisition is stuck with the requestor.
    At the time i need to send an email to the requestor and update the status of the requisition to 'INCOMPLETE'.
    i have defined two action sets one for email and another for update. The email part is working fine but the sql script which updates the status is not firing.
    It is a standard script residing in PO directory sql.
    It has two parameters
    1) Requisition number 2) org_id
    these two are the output of the mail alert query.
    i have defined the application as 'Puchasing'
    arguments as &SQL_REQ_NUMBER &SQL_ORG_ID
    and gave the file name 'poresreq.sql' in the file location.
    but the status is not updating.
    how can i know the reason for not firing.
    Regards,
    Jana

    Hi Jana;
    What is your EBS and OS? Did you run query manualy? Did you get any error message?
    Regard
    Helios

  • I create trigger but not display massage after insert in oracle 10g

    I create trigger but not display massage after insert in oracle 10g
    **CREATE OR REPLACE TRIGGER TableName**
    **AFTER INSERT OR DELETE OR UPDATE ON test**
    **BEGIN**
    **if inserting then**
    **dbms_output.put('Message');**
    **end if;**
    **END;**

    What user interface are you using?
    If the tool doesn't support the SQL*Plus syntax (set serveroutput on), it probably has an option somewhere to enable DBMS Output. Not even knowing what tool you're using, it's impossible for us to guess where that option might be configured.
    As others have suggested, using DBMS Output to test code is less than ideal because you're dependent on the application you're using to display it to you and not every application can or will do that. If you want to use DBMS_Output, you may need to switch to a different GUI (SQL Developer or SQL*Plus are both free utilities from Oracle). Otherwise, you'd probably be better off having the trigger do something that you can subsequently query (i.e. write a row to a log table).
    Justin

  • Hierarchy INT does not exist for Financial Statement item 0glaccext

    Hi,
          I am facing a problem while executing the Standard Business content "Cash Flow statement" query. I am getting the message "Hierarchy INT does not exist for Financial Statement item 0glaccext".
    I am not able to find this Hierarchy in the "avaialble Hierarchies from OLTP". I think this is a standard SAP Hierarchy.
    Any thoughts on how to resolve this issue

    John,
    You can define FSVs for a specific chart of accounts, for a group chart of accounts, or without any specific assignment.
    In your case, double-check whether you are running the report for the same CoA assignment that you have defined your FSV for in the first place.
    As somebody's mentioned earlier, these reports are made using Report Painter (GRR1 / 2 / 3, etc.). Seems FSV = INT has been fixed in these reports for your system. You'll have to edit these reports (using GRR2) and the correct FSV.
    Regards
    Gulshan

  • Exit for batch no check not fired for Tr MFBF

    hi. experts,
    i'm new to abap.
    i've to check the manually entered BATCH No. entered in Tr. MFBF and accordingly throw a error message for wrong entry on the first screen.
    for this m using the exit SAPLV1ZE and its Function module EXIT_SAPLV01Z_004.
    i've created a project in Tr. CMOD and have assigned this exit. also i've created the include given inside the function module. i've activated all.
    But while i set a breakpoint there and try executing the transaction, the transaction doesnot stop at the specified break-point in debugger and hence the message doesnot get fired.
    Plz help as to why the exit is not fired and why it doesnot stop in the debugger.

    try this XMRM0001 enhance ment in smod for mfbf.
    NB : activate all the things.
    regards
    shiba dutta

  • Enum class not supported for switch() statement in 12.4 beta?

    Hi fellow 12.4 beta testers,
    It would appear "enum class" isn't supported for switch() statements in the 12.4 beta. This compiles fine under clang and g++. Will this be fixed for the final release? This currently causes compile errors for us, since __cplusplus >= 201103L evaluates to true, so our code uses "enum class" instead of plain "enum". It looks like the C++11 standard says it should be supported:
       Switching on enum class in C++ 0x - Stack Overflow
    Many thanks,
    Jonathan.
    $ cat test.cpp
    #include <iostream>
    enum class Ternary { KnownFalse = 0, KnownTrue = 1, Unknown = 2 };
    int main( void )
       Ternary foo;
       switch ( foo ) {
          case Ternary::KnownTrue:
          case Ternary::KnownFalse:
          case Ternary::Unknown:
             std::cout << "Success\n";
    $ clang++ -std=c++11 test.cpp
    $ g++ -std=c++11 test.cpp
    $ /opt/SolarisStudio12.4-beta_mar14-solaris-x86/bin/CC -std=c++11 test.cpp
    "test.cpp", line 8: Error: Cannot use Ternary to initialize integral type.
    "test.cpp", line 8: Error: Switch selection expression must be of an integral type.
    "test.cpp", line 9: Error: An integer constant expression is required for a case label.
    "test.cpp", line 10: Error: An integer constant expression is required for a case label.
    "test.cpp", line 11: Error: An integer constant expression is required for a case label.
    5 Error(s) detected.

    Thanks for reporting this problem! I have filed bug 18499900.
    BTW, according to the C++11 standard, the code is actually not valid. Section 6.4.2, switch statement, says an implicit conversion to an integral type is required, which is not the case for for a scoped enum (one using the "class enum" syntax). This limitation was raised in the C++ Committee as an issue to be fixed, and the C++14 standard makes the code valid.
    As a workaround, or to make the code conform to C++11, you can add casts to int for the enum variable and the enumerators.
    Message was edited by: Steve_Clamage

  • Syntax for Merge statement to insert into target and update source

    Hello All,
    I want to use Merge statement to insert records when not matched in my target and update records in source when matched. Is it possible to do using Merge statement.
    create table a (aa number)
    create table b (bb number)
    alter table a add flg char(1)
    merge b as target
    using a as source
    on (target.bb = source.aa)
    when matched then
    update set source.flg = 'Y'
    WHEN NOT MATCHED THEN
    insert (target.bb)
    values
    (source.aa)
    Thanks.

    Hi,
    I have no idea about the version of DB, else some new features with respect version can be specified - just for informaitve purpose and to post across the verison of DB in future posts.
    Coming to your issue and requirement.
    if you check the syntax and functionality , then its on Merge on target base only - with respect to Update (matched o columns) and insert (for unmatched columns). Source - as the term is clear. It might not work out on source table.
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • Not able to merge files in oracle 10g forms using webutil

    Hi,
    i ahve developed an application in oracle forms 10g in which i am generating xls file by report and saving on server. now i want to merge header file to file generated by reports and save on server and then trasfer it to client using webutil. but i am not able to do so. please help
    ---sachin

    do you have a solution for merging the headers ?
    for example a batch file, which does the work?
    then run this batch from forms with webutil on your client.

  • Help for merge statement?

    I have a problem in Merge statement. My merge statement is following:
    MERGE INTO hoadon hd
    USING (
    SELECT m.ma_ttoan, t.ma_ttoan ma_kh
    FROM tai_anhxa_makh t
    INNER JOIN hoadon m on t.ma_kh = m.ma_ttoan
    WHERE m.thang_nam = '200908' and m.ma_ttoan not like 'DLC%' and t.ma_ttoan IS NOT NULL
    GROUP BY m.ma_ttoan, t.ma_ttoan
    ) m ON (hd.ma_ttoan = m.ma_kh)
    WHEN MATCHED THEN
    UPDATE SET ma_ttoan = m.ma_ttoan
    WHEN NOT MATCHED THEN
    INSERT (thang_nam, ma_ttoan) VALUES('200908','thaodv')
    After execute this query, PS/SQL show error message: "ORA-00904: hd.ma_ttoan invalid identifier"
    I'm using Oracle version 9i
    Can anyone help me to resolve this problem?
    Thanks in advance

    In 9i you can't use the columns from the ON clause in your UPDATE part of the MERGE statement
    this is invalid:
    UPDATE SET ma_ttoan = m.ma_ttoanuse a different column here.

  • Order not maintained in MERGE statement

    I am using a MERGE statement as follows:
    MERGE INTO target T
    USING ( select * from source order by data_id ) S
    on ( T.data_id = S.data_id )
    when matched then update
    set t.code = s.code
    when not matched then insert
    (t.code, t.data_id )
    values
    (S.code, S.data_id )
    But the newly inserted records in the target table are not ordered in the same order as the source table.
    E.g
    source
    data_id(pk)     code     
    1     1
    2     2
    3     2
    target
    pk_col data_id     code
    1     3     1
    2     1     2
    3     1     2
    I was expecting records in noth tables to be sorted in order of data_id
    Is this a limitation of merge statement or is there any workaround.

    bony wrote:
    I was expecting records in noth tables to be sorted in order of data_id
    Is this a limitation of merge statement or is there any workaround.No, it is not a limitation. It is 101 of relational databases - there is no row order in table rows. Same query can return rows in a different order next time you run it unless ORDER BY is specified.
    SY.

  • Fatal Error During Solution Center Install - "Key Not Valid for Specified State"

    I have encountered an error while trying to install HP Solution Center for my J6480 All-In-One.  The software I'm installing is "OJJ6400_Full_10.exe"
    I can get past the installation option selections (i.e., the screens that allow selection of which components you want installed) as well the online check for updates to the software.  However, shortly after that I get a fatal error the full text of which are:
    Error Situation Code: 23551631
    The following lines were retrieved from the installation error logs.
    Now Launching=X:\hpzmsi01.exe -m dot4wrp "-*"
    ".\autorun_network.inf" "-networkonly" -| XXX -f X:\DIVins??.DAT
    Error message received: Key not valid for use in specified state.
    X:\cioum32.msi failed with return code 1603
    MSIInstall() failed with 1603
    Exit code=1603
    Your help is appreciated.  Thanks.

    Hey @redleader74,
    At this time I am going to have you unlock the hidden System Administrator Account and attempt an install under there. Ideally, if everything installs fine you should be able to log back into your normal User Account and the complete software and driver package for your HP Officejet J6480 All-in-One Printer will be installed and functional. Can I please have you follow the steps below.
    Step 1: Uninstall Drivers:
    Click on your Start menu
    Select All Programs
    Select the HP folder
    Select your HP Officejet
    Select Uninstall
    Please follow any onscreen prompts to complete the uninstall. Once the uninstall is complete please proceed to the next step.
    Step 2: Clear Temp Files:
    Click on your Start menu
    In the 'search programs and files' box located right above Start after you click on it, type %temp% and hit enter on your keyboard
    When the Temp folder opens, select Ctrl + A at the same time on your keyboard. Everything in this folder will now highlight.
    Select the 'delete' button on your keyboard. The Temp folder contains temporary internet files. No actual files or folders on your computer will be affected by deleting the Temp files. Should a Temp file still be used than you will automatically get the pop up to 'skip' that item.
    Close the Temp folder once it is emptied
    Right click the Recycling Bin on your desktop and select Empty Recycling Bin
    Step 3: Unlock System Administrator Account:
    Click on your Start menu and under the 'search programs and files' box type CMD
    CMD will populate as a search option above, just right click on it and 'run as administrator'
    Once CMD (Command Prompt) opens, type net user administrator /active:yes and hit enter
    Next, close CMD and restart your computer
    When your computer comes on log into the new Account that should show. It will be called Administrator and will not have a password on it.
    If your computer automatically logs into your account after restart than go to your start menu click the arrow beside 'shutdown' and choose 'switch user'. Now log into the Administrator Account we just unlocked
    Step 4: Install Device:
    Under the Administrator Account please click here to download the latest drivers for your printer.
    Once the website opens select the Download button on the top left
    Once the download is complete please follow the onscreen instructions to install your printer
    Once the installation is complete, please test the functions of your HP Officejet to ensure that everything is functioning properly now. If everything installs fine, log out of the Administrator Account and back into your normal User Account. All the Software and Drivers for your product should show installed now on your Account. Once you're logged into your User Account please test your HP Officejet again to verify that your print and scan functions are still working.
    If everything works fine, you will want to Hide the Administrator Account.
    Go to your Start menu and under the 'search programs and files' box type CMD
    CMD will populate as a search option above, just right click on it and 'run as administrator'
    Once CMD (Command Prompt) opens, type net user administrator /active:no and hit enter
    Next, close CMD and restart your computer
    Please let me know if these steps resolve your issue. Good luck!
    X-23
    I work on behalf of HP
    Please click "Accept as Solution" if you feel my post solved your issue, it will help others find the solution.
    Click the "Kudos, Thumbs Up" on the right to say "Thanks" for helping!

  • Need Help for MERGE statement

    I have a MERGE statement, I am executing it from shell script, I want to print that how many rows has been updated and Inserted.
    Can any one give me some idea.
    Thanks in Advance

    I want to print that how many rows has been updated and Inserted. If you really want/need to print that information, then don't use MERGE but INSERT and UPDATE statements.
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:35615502072484
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:122741200346595110

  • The new MERGE statement in Oracle 9i

    Has anyone used the new Merge statement to process large amounts of data? Currently we use PL/SQL to update/insert into our tables when we are loading large amounts of data (close to one million rows) because we can set commit points and avoid rollback problems. I am wondering if we use Merge instead how this will affect rollback? Are we still going to have to code for this problem?
    Thanks in advance!

    Thanks for the suggestions. Our problem is that the base table contains 50 million rows and seven indexes, and each month we try to insert/update one million rows. Some of the data in the base table is historical so if we implemented your solution we would lose any records not being updated.
    What I am really trying to determine is if the MERGE statement has any redo log ramifications. Will we run in rollback space problems if we implement it instead of running PL/SQL in the following format:
    FOR cur_rec in c1 LOOP
    UPDATE table a
    SET col a = cur_rec.col a, ...
    WHERE ...
    IF SQL%NOTFOUND THEN
    INSERT (col a , col b, col c...)
    VALUES (cur_rec.col a, cur_rec.col b...);
    END IF;
    We commit every 10,000 records (as determined by SQL%ROWCOUNT). This can be time comsuming and Oracle claims that the new MERGE command will avoid costly overhead and reduce data scans. However, I am concerned that we may hit rollback problems if we implement a straight SQL statement such as MERGE. Any thoughts?

  • Doubt Regarding Merge Statement in Oracle

    Hi,
    I have an SP which takes 3 parameters Lets say
    (in_empid, in_empname,in_age)
    here in_empid corresponds to the empid ie primary key for update/insert
    Now which of the approach will be better. Will there be problem in using Merge statements for updates/insert
    1. Approach 1
    Add one more flag in parameters in_action . Now if in_action = 'U' then write an update statement.If in_action='I' then write insert stmnt
    2. Approach 2
    write a merge stmnt as follows
    merge into employee e using
    ( select in_empid, in_empname,in_age from dual ) b
    on  ( b.in_empid = e.empid)
    WHEN MATCHED THEN
      UPDATE SET e.ENAME = in_empname,
                           e.age = in_age
    WHEN NOT MATCHED THEN
      INSERT
      VALUES (in_empid,in_empname,in_age) something like that
    Which would be preferred? I mean is there any restriction that merge can be used only to merge 2 tables?what are the drawbacks of using Merge?
    Regds,
    S

    Hi cd,
    Thanks for the reply.
    Actaully I was keeping the front-end code also in mind.
    If we click an update button, then they will have to manage a flag till the end to say that transaction was update. whereas when its an insert of new record, they have to maintain a falg till end to imply that the transaction was insert.
    I want to avoid this so that they need not maintain additional flag.
    Hence I was thinking of using MERGE statement.
    Will there be any problem in using merge for such scenarios?
    Regds,
    S

  • Pre-insert trigger is not firing after post built-in

    Hi,
    I have a 10g form in which Post built-in is used in When-button-pressed Trigger. After the post command I am checking some condition,by using the same record which I have posted.But it is not working.
    I have also put the message in the pre-insert trigger but the message is not displaying.
    But the same form iis working fine in form 6i, as I have migrated the forms from form 6i to 10g.

    Yes, In that block there are other items also. I have made the required property no for all the items.
    what exactly we have is
    (if x=y then)on some condition check
    POST;
    After that, form have a select statement in which it is selecting the same row which is being posted above.
    if the select statement gives count of row zero
    raise form_trigger_failure is fired.
    and in the pre-insert trigger form is assigning a value to a block item.

Maybe you are looking for

  • User defined Object transfer in java web service

    Hi, I want to return an object(serialized) from the server to client during a method call. I tried to return the object as like String object given below. @WebMethod public ValueVO getValues() { ValueVO vo = new ValueVO("arg1", "arg2"); return vo; Bu

  • Deployment getting aborted

    hi facing this  problem  after deploying the application un 24, 2008 11:14:40 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR: [006]Deployment aborted Settings SDM host : DCEP01SBX SDM p

  • DVD Player New Problem

    Suddenly DVD Player ver. 4 will not play DVDs with OX 10.3.9. This was never a problem before. "...no volumes that Mac OS X can read." Why would DVD Player unexpectedly cease working? Thank you.

  • Welches imovie für osx 10.7.5

    Hi, do someone know what imovie is usefull for osx 10.7.5 and where I can get it from? Thanks for any help!

  • Things captured in Configuration Audit

    Hi All, I know its a silly question. But want to know what actions will be captured in Configuration Audit for Hyperion 11.1.2.1. As per the update from security PDF: Shared Services allows the auditing of provisioning and lifecycle management activi