How to create a trigger on a view

Hello all,
I am trying to create a trigger on a view that is used to update a few columns in the base table. Since I am new to trigger, an example will be appreciated.
Thanks in advance.

Are you sure that you need a trigger for this? Lots of folks that are new to triggers tend to overuse them before they understand the maintenance problems that having a bunch of triggers creates.
That said, the Oracle documentation has an example of [creating an INSTEAD OF trigger on a view|http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_7004.htm#i2064426]
Justin

Similar Messages

  • How to create transaction for a maintenance view, Thank you.

    How to create transaction for a maintenance view,
    Thank you.
    deniz...

    Hi Deniz,
    Go to se93.
    Then create the new T.code.
    Under that select parameter Transaction.
    Then give the sm30 in the t.code in default values tab.
    check the checkbox skip initial screen.
    in classification tab.
    click checkbox inherit gui attributes..
    Now below..
    In the default values..
    select
    viewname and give ur table name.
    UPDATE= Xsave
    view - table name ( Should be upper case
    update X ( should be upper case).
    http://www.sap-basis-abap.com/sapbs011.htm
    Hope this helps you.
    Regards,
    Viveks

  • How to create transaction code for maintenance view

    hai friends,
    i hope every thing goes good.
    i have doubt, how to create transaction code for maintenance view. I created view for tranperant table and now i want to create transaction code for the view.
    i tried and i donot know the screen number and program name and where can i give the view name.
    if any one know please post in details.
    thanks in advance.

    Hi Elam,
    You need to create a "Parameter Transaction".
    What this means is that you will have a transaction (let's call it "ZMAINT") which calls "SM30" and passes in your table name.
    Go to transaction SE93 and enter your new transaction code. Enter in the Tcode description and choose "Transaction with Parameters" (it shouldbe the last radio button).
    Enter in the default transaction "SM30" and tick the "Skip Initial Screen" check box. Hit Enter.
    Now scroll to the bottom of the screen and you will see a Table Control where you will need to enter in the values to the SM30 selection screen.
    Because you hit ENTER, the program will have loaded in the Selection Screen parameters into it's memory. Hit the drop down for "Name of Screen Field" and select "VIEWNAME" and then enter in your Z Table in the "Value" column.
    Now go to the next line and hit the drop down and select "UPDATE" in the "Name of Screen Field". Enter in a "X" in the value column.
    Now save the transaction and there you have it.
    Hope this helps.
    Cheers,
    Pat.
    PS. Kindly assign Reward Points to the posts you find helpful.

  • How to create dynamic connection in business view manager.

    Hi Sir,
    Can u explain how to create dynamic connection in business view manager.
    Thanks
    Vishali Raghava Raju

    HI Vaishali,
       Can you please elaborate your requirement ?
    -Regards
    B

  • HOW TO CREATE A CUSTOMER NO (sales view)THAT STOERS IN KNVV TABLE

    HI ,
      how to create a customer no(sales view) that stores in tabel knvv, i able to create in kna1 table but not storing in knvv table, please provide with tcode

    Hi,
    I believe while creating customer you must be maintaining sales area if you are not maintaing then only customer's genaral data will be created and only KNA1 table will be populating.
    Rgds
    San

  • How to create interface where you can view metadata of several databases

    How to create interface where we can view metadata of several databases:
    Oracle Apex should display metadata of this particular DB (later on we can include multiple DB’s)
              a. Report should first display DB name
              b. When clicked on DB name, should display 3 schemas
              c. When clicked on 1 schema, should display tables – when clicked on each table,
              should display various column names and its corresponding metadata.
              (similarly for other schema’s also)
              d. In short, it should be like a drill down report.
    Help required for craeting like above.
    Appreciate your help.

    I did something similar a while back. I had an application reading from multiple schema's for reporting purposes..IN that case atleast we just would build the selects using a function reurning SQL select, so that we could have an application item with the selected schema they wanted to use to build into the select returned...
    For forms, that would be an interesting idea, don't know how you can dynamically change the table owner name, since it is a drop down control in development..
    Thank you,
    Tony Miller
    Webster, TX
    I cried because I did not have an office with a door until I met a man who had no cubicle.
    -Dilbert
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Create a trigger on a view

    I try to create a database trigger on a view and when the sql return a error (ORA-00439: feature not enabled: Instead-of triggers)
    How can i create the trigger?
    Pd. I don4t have problems to create then trigger on a table.

    Are you sure that you need a trigger for this? Lots of folks that are new to triggers tend to overuse them before they understand the maintenance problems that having a bunch of triggers creates.
    That said, the Oracle documentation has an example of [creating an INSTEAD OF trigger on a view|http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_7004.htm#i2064426]
    Justin

  • How to Create/Modify/Delete a query view from the web template in BI 7.0

    All:
    In BW 3.5, the <b>Query Selection View</b>  web item was introduced for users to create a query view to save the navigational state of a query. This web item was also available to modify and delete an existing query view.
    The Query Selection View web item <u>does not</u> exist in BI 7.0. I see the drop down web item can be used to display the query views associated to a query.
    Can anyone share how to create,modify,save or delete a <b>query view</b> on the web in BI 7.0
    Thanks,
    Kumar

    Sanjay, we experienced the same issue. Below are a few pieces of information that may be of help: 1-The Save As button on the 0ANALYZER template saves the query to the portal. From Bex Web or Bex Analyzer, you have no access to these saved views. We created a ZANALYZER copy of the 0ANALYZER template and removed the Save As button. 2- If you right mouse click on any item in the query results grid of Bex Web, you get a small menu. Clicking on the menu item Save View will save the view to BI. You do not have the ability to delete the saved views from Bex Web. However, you can delete them from Bex Analyzer. This was not an option for us since most of our users are using Bex Web. 3- On the same menu, clicking on Bookmark, saves the navigation and also opens the Internet Explorer Favorites maintence window. The navigation is saved as an entry into the users Internet Explorer favorites where they can organize and delete their entries. However, deleting the favorite does not delete the entry for the bookmark in BI. The bookmarks are stored in table RSWR_DATA. Program RSWR_BOOKMARK_REORG can be used to manage the saved bookmarks. We are loading RSWR_DATA into a chracteristic so that we can query the information in order to help us manage it. I hope this helps you and others that appear to be struggling with the issue of saved views in Bex Web.

  • How to create unique index on a View

    Hi All,
    11.2.0.1
    How do I create an index on a view or any workaround that my view wont get duplicates?
    SQL> create unique index indx01 on db_backup_details_vw(id);
    create unique index indx01 on db_backup_details_vw(id)
    ERROR at line 1:
    ORA-01702: a view is not appropriate here
    Thanks a lot,
    Kinz

    I'm thinking of using a distinct clause here.
    if i get 5 duplicate rows in my selection set because of the join condition, can't i discard the remaining 4 using a distinct clause.
    Observe this
    SQL> select * from a;
    T1 T2
    1 4
    2 4
    3 4
    SQL> select * from b;
    T1 T2
    1 4
    2 5
    in both a,b t1 is the primary key. so we'll write a join on t2 (non PK).
    SQL> select b.t1,b.t2 from a,b where a.t2=b.t2;
    T1 T2
    1 4
    1 4 -- duplicates
    1 4
    Now create view with distinct clause
    create view ab as select distinct b.t1,b.t2 from a,b where a.t2=b.t2;
    SQL> select * from ab;
    T1 T2
    ---------- ---------- -- no duplicates
    1 4
    CSM

  • How to create a trigger for particular value insertion?

    If I have a Table T, which has columns as A,B,C,D. I want to create a trigger to give an error message if someone inserts or updates T with values in A as '001' AND value in B as '99'
    Please reply soon....
    Thanks

    user8560155 wrote:
    I need a trigger only not a constraint...
    Why? Is there any valid reason for that?
    I tried the above trigger but it was not successful :(
    Can I use 'If statements' as well???The below will work..
    create table t
      a varchar2(10),
      b varchar2(10),
      c varchar2(10),
      d varchar2(10)
    create or replace trigger trig1
    after insert or update on t
    for each row
    --"trigger will be fired only when below condition is satisfied"
    when ( new.a = '001' or new.b = '99' )
    begin
    raise_application_error(-20000, 'Invalid value in A or B');
    end;
    insert into t(a) values('001');
    SQL Error: ORA-20000: Invalid value in A or B
    ORA-06512: at "SCOTT.TRIG1", line 2
    ORA-04088: error during execution of trigger 'SCOTT.TRIG1'
    insert into t(a) values('002');
    1 rows inserted.

  • HOW TO CREATE A TRIGGER TO UPDATE A DATE FIELD WHEN RECORD IS MODIFIED

    Hi,
    I have a field (column)
    SalesLeadLastModifiedDate
    in the table
    SalesPipeline
    A record's field (SalesLEadLastModifiedDate) should be updated with current date and time every time any column in a record is modified. I'm new to SQL and can't figure out how to write this trigger. Could someone help me and also
    refer literature that would give me independence? Online MSDN language without matching examples is not helping.
    Tnx.,
    IJ

    Break it down into pieces.  Write a small script that updates some small (but more than 1) number of rows.  After updating the rows, write another update statement that will set your modified date column to the current date and time.  Once
    you have that working, you can easily convert that into a trigger.  Pseudo-code would be:
    begin tran;
    select * from dbo.SalesPipeline where SalesPipelineID in (45, 76);
    update dbo.SalesPipeline set <some column> = <something> where SalesPipelineID in (45, 76);
    update dbo.SalesPipeline set <your date colum> = ?? where SalesPipelineID in (45, 76);
    select * from dbo.SalesPipeline where SalesPipelineID in (45, 76);
    rollback tran;
    Notice the transaction control statements.  This will allow you to run the script, evaluate the result, and then revert all changes (leaving your database unchanged).  In turn, this will allow you to run the same script over and over and over again
    and achieve (for the most part) the same results with each execution.  You can search the forums for examples of trigger code - just beware that many "solutions" are not necessarily well-written.

  • How to Create a trigger code for turning on light bulbs in flash and animate images professional cs6

    hi,
        i designed a very interactive music website in illustrator and photoshop and i am trying to animate the main page design in flash professional and eventually publish it as HTML5. There are couple of questions i need to ask before starting
    1) should i import my design in differnet layers from illustrator into flash professional in order to make it easier to isolate and animate specific parts of the web page?
    2) i want to have a roll over effect that allows certain features in the page to turn on and off when the mouse hovers over them. can you explain how to do that? any tutorial videos i could follow
    3) what format should i use when importing my illustrator design into flash professional
    4) how should i animate the content pop out from the safe box into the main screen in flash professional (i have never used this program before, so i will be going off video tutorials and whatever suggestions/help you would have)
    **The idea is to have a content frame fly out of the safe into the screen (the size will increase rapidly and it will fade into the screen as well while rotating 360 degrees for one revolution). The content is a basic rectangular frame i designed in illustrator. The body of this frame will be transparent allowing me to embed the main page features into it eg music, videos, bio etc. All this will be done in the later process, the main issue is figuring out how to animate the content frame into the screen and also creating a click feature that allows the content to fly back into the safe and then the safe closing in.
    Secondly, the trigger code rollover effect that allows certain features light to turn on when the mouse hovers over it and turn over when its not.****

    I think you'll get most flexibility by turning on the feature that lets you keep your Illustrator layers as Flash layers. You'll also want to check the box that lets you make an Illustrator object into a MovieClip for anything that you want to interact with or address through code.
    Add an event listener for MOUSE_OVER that triggers whatever functions you need to create to turn on the features. This means that your object that you will mouse over will need to be a MC, as well as any other objects that will be addressed (for example, calling play()) will need to be a MC. You'll want to have a matching MOUSE_OUT handler that stops MC's, hides them, or whatever.
    You should probably organize your Illustrator file so that the objects you need to address are on their own layers. This includes nested objects. Name things informatively. Remember, if the first import doesn't give you exactly what you want, you don't have to save the change--you can edit your settings or the Illustrator file and try again.
    Look into motion tweens. I highly recommend the books "How to Cheat at Flash" and "Animation with Scripting." I don't really think the way they tell you to script will advance your career if you want to be a software architect, but if you just want to animate the occasional widget, it's fine.

  • How to create one filter for N views in the same report

    Hello everybody,
    I need to have the same filter for diferent views that I have in the same report. Anyone knows how to do it?
    Thanks in advance
    Mario Mesquita

    Hi,
    In India site, you can create a SMTP connector which point to the local ISP.
    Thanks.
    Niko Cheng
    TechNet Community Support

  • How to create a trigger using 9211 modules with cDAQ-9174?

    I am trying to create posttriggered acquisition with an analog trigger using 9211 modules that are reading 4 thermocouples.  I would like the data aquisition to start once a temperature of 90 degrees C is reached. I am not sure what I should put for the source of my trigger in my VI.  Are these modules capable of using triggers, and if so, how do I go about creating one?  Attached is the VI, thanks.
    Attachments:
    Thermocouple.vi ‏151 KB

    The 9211 doesn't have any analog triggering capabilities.  You'll have to implement the trigger in SW (like this example).
    Best Regards,
    John Passiak

  • How to create function group in Maintainence view

    Hi,
    For creating a maintainence view of a particular table (only1) what is the need of a function group. How can i create a function group like what type of includes, etc are present in the function group,etc.
    Thanks,
    Arnab

    in the table maintenance view
    just enter the function group name any(Z* )
    and give the screen name (single or over view Scree)
    It will automatically creates the function group which ever you specified.
    now the function group contains
    the screen, TOp include ...
    Thanks
    Sekhar.

Maybe you are looking for