About Trigger
Hi All,
I had doubt on triggers if possible if you have face before this please let me know.
I had table which had 200 columns and the end user is going to change the values of this table.
I need to find out which column has updated, the previous columns value as well as new value.
How to do this with triggers
Regards
Zaheer
Hi !
Well , to see what column was changed and to do this with triggers .. at the end someone must check column by column in any case.
Oracle can do this for you with specifing column list in trigger
create or replace trigger tr1
before update of ename on emp
for each row
begin
null; --- Do whatever
end;and this trigger will fire only if column ename is changed ... but then again you should have 200 triggers in this scenario.
And i agree there is a performance degradation with building a trigger on table , but degradation basically depends on "quality" of code in that trigger.
So doing some checks for 200 columns , will this be bad or very very bad or maybe not so bad ... this depends on how the thing is coded and on the data itself and so on .. you should done some observations and test few solutions not just one ..
T
Similar Messages
-
Whats is the use of SM64 Tcode?? and about Trigger Event???
Hi
Whats is the use of SM64 Tcode?? and about Trigger Event???
Can anyone tell me??
Thanks & Regards
SenthilHi,
When scheduling a background job, you can specify it to start "after event".
If you do so, you'll have to create an event in SM62.
If a job is scheduled after event event and you trigger the event with SM64, the job will start.
Events can be raised by external systems in SAP by sending a command to a SAP application server. You can also raise event in any program using function mosule BP_EVENT_RAISE.
hope this helps....
Olivier. -
How can I get/Catch the information about Trigger firing?
How can I get/Catch the information about Trigger firing?
I am running one application (backend is Oracle) and have written one trigger, which will insert one row in two tables depending on user event (After Update Trigger).
I want know last fired Trigger Information.
Thanks -
Question about trigger to check the number of open cursors
Hello.
I wonder if it is possible to create a trigger that fires when the number of open cursors in a database becomes larger than a certain number. What kind of trigger and how would it be?
If it were possible the trigger would write traces with the timestamp of the event.
I would also like some pl/sql tester that would increase the number of open cursors so that I could check the trigger.
Thanks in advance.Satish Kandi wrote:
OPEN_CURSORS is a value per session and not for the entire database. So if your cron job is looking for a global cumulative value of open cursors to occur in a single session, it won't find any such sessions.
Is it the case?Yes, I am afraid it is.
I am sorry but I don't unsertand what you are telling me: doesn't "select count(*) from v$open_cursor" count the number of open cursor for all sid columns in the view?
The cron launches a scripts that connects to the database via sqlplus whereas there is a java application (several threads without connection pooling) that connects to the database via jdbc and that causes the problem once in 5 months (to say something).
Thanks again.
Edited by: fsanchezherrero on Jul 3, 2009 12:28 PM
Edited by: fsanchezherrero on Jul 3, 2009 12:36 PM -
Hi,
I want to know if trigger will be executed even if the transaction in which the table is participating is failed.
e.g. if there are three tables participating in the particular transaction ,table update sequence is 1-->2-->3.The trigger is deployed on the second table if the transaction fails because some error while updating third table, will the trigger on the 2nd table be executed.
Regards,
Sachin R.K.So does that mean that
If i have a table (say table1)
And i have an AFTER UPDATE trigger on table 1 that writes to a file(say TriggerOutput.txt) some info.
And Now I try to update table1 which is within the transaction ,if the transaction is rolled back,u mean i file TriggerOutput.txt will be empty.
Is that correct.
Regards,
Sachin K. -
Question about trigger and procedure
Hi,
I have a trigger on a table tbl1 (after AFTER INSERT OR UPDATE ... for each row).
This trigger start a procedure which make some test. At the end of the procedure, I had to update a flag on tbl1, but without using the trigger !!!
Is it possible ?not a mutating table error but ORA-00060: deadlock detected while waiting for resource.
For your question :
Is the flag on the same row as you are updating then you can update it in the trigger ?
Yes, this is a field to update for row state for my application.
The problem is that the update at the end of my procedure start the trigger that start the procedure and so on !!!
Perhaps you have another idea to do something like this ?
thankx for your answer.
Rémi PILLOT -
Hi All
I try to use this trigger for inserting RecordID in Shoppingcart Table.
DECLARE
NEXTID NUMBER(3);
BEGIN
SELECT MAX(RECORDID) INTO NEXTID FROM SHOPPINGCART;
:NEW.RECORDID := LTRIM(NEXTID+1);
END;
It is an empty table now. By inserting the other fields and leaves the RecordID for triggering. The Oracle shows this error
ORA-01400; can not insert null into (SCOTT.SHOPPINGCART.RECORDID)
How could I solve this error?
Thanks in advance
Blueman137You'll want to do something along these lines-
SQL> CREATE TABLE trig_demo (
2 col1 NUMBER PRIMARY KEY,
3 col2 VARCHAR2(100)
4 );
Table created.
SQL> CREATE SEQUENCE demoSeq;
Sequence created.
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE TRIGGER demoTrigger
2 BEFORE INSERT ON trig_demo
3 FOR EACH ROW
4 BEGIN
5 SELECT demoSeq.nextval
6 INTO :new.col1
7 FROM dual;
8* END;
SQL> /
Trigger created.
SQL> insert into trig_demo( col2 ) values ('Row 1');
1 row created.
SQL> insert into trig_demo( col2 ) values ('Row 2');
1 row created.
SQL> select * from trig_demo;
COL1 COL2
1 Row 1
2 Row 2Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
hi
everybody
i need,as im new to sap
wat is trigger points, wats their functions, how they r used
plz. explain in detailsDear please see the link given by MSH.
Apart form that, following are the details.
Trigger point as name suggests, to trigger some action, when some thing is not going as per planned activity,
In PP, we use it for creating rework order/operation when during confirmation if you find a product is to be reworked, then we use enter the qty is reworked qty field. System will create rework order or rework operation as per you designed in Trigger point.
Please go through the link...
You need to design the trigger point in CO31, assign it in routing.
How to create in C031...depends your requirement whether you want rework operation or rework order..pl come back what actually you want out of two options so that we can guide.
Edited by: Rajesha Vittal on Jan 13, 2008 1:32 PM -
About trigger **URGENT**
How many trigger we can create on a table?
So, your senior developer asked you a question, presumably(*) to either a) test your knowledge or b) test your searching capabilities and you decide to ask here, without searching first?
You should search the concepts document. I'll even give you the link to the relevant part: http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/triggers.htm
It's up to you to research it.
(*) I'm assuming that the senior developer is not asking because they don't know the answer...! -
Is the righr place to ask question about trigger?
I update the form then suppose auto update the table PaymentRecords , but today it sudden not working , not error on the trigger , what is the possible mistake ??
delimiter $$
CREATE TRIGGER Date_PaymentRecord
AFTER UPDATE ON tableA
FOR EACH ROW BEGIN
IF NEW.Ast= 'on' THEN
UPDATE PaymentRecords SET DueDate = New.ADate
WHERE FeeType = 'Fee 1st Instalment'
and PaymentRecords.UserId=New.UserId;
end if;
END$$
delimiter ;
not error at all , just not workSee sql and plsql forum
PL/SQL -
Hi,
We have triggers in our 8i database which used the v$session to get the machine, the program and the user of the session.
I just want to know if in 9i it's not possible to have the session variable directly whithout use a query ?
Thanksyou can use SYS_CONTEXT('USERENV','SESSIONID'). There are a few different values such as 'TERMINAL' etc that you can get access to from here too.
-
Import of .bacpac fails on view with instead of delete trigger
I'm using Azure Premium SQL.
When I export the database using the portal and blob storage and then immediately try to import it as a test to a new database (also using the portal) I get the error below.
Looking at the restored database, many of the views are not there (including the one listed) although that may be because it failed on this view during the restore.
The trigger seems to be working just fine in the original database. It just won't restore from the bacpac.
BTW, I notice in the original database before backup, the trigger says "DELETE
FROM alndata.AptChangeLog", not "DELETE alndata.AptChangeLog"
Thanks.
Bryan
Error encountered during the service operation.
Could not import package.
Error SQL72014: .Net SqlClient Data Provider: Msg 8197, Level 16, State 4, Procedure AdminChangeLogAptNameDelete, Line 7 The object 'AlnData.AdminChangeLogAptName' does not exist or is invalid for this operation.
Error SQL72045: Script execution error. The executed script:
CREATE TRIGGER [AlnData].[AdminChangeLogAptNameDelete]
ON [AlnData].[AdminChangeLogAptName]
INSTEAD OF DELETE
AS BEGIN
SET NOCOUNT ON;
DELETE alndata.AptChangeLog
WHERE aptchangelog_id IN (SELECT aptchangelog_id FROM deleted);
ENDHello,
Sorry for delay.
I had found a feedback about trigger issue when restore SQL Database from a BACPAC file. Microsoft said the fixed will be available in the next major release of DacFx.
Feedback:
SQL Azure fires a trigger when restoring from bacpac
You can refer to the workarounds in the feedback. For example, if there is small amount of triggers on the database, you can try to remove the triggers and then recreate when restore from bacpac file.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
ApEx 4.1.1: update record in a view with 'instead of update' trigger
I created a form against a view. The view is complex enough which prevents direct updates. To incorporate the update logic I created an 'instead of update' trigger on the view. When I open up the form, do changes, and click 'Apply Changes' button I am getting the following exception
ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
I understand that the standard 'Automatic Row Processing' process is trying to lock the record before updating using a cursor like
select *
from my_view
for update
and fails. Is it possible to bypass this locking while using the standard APEX processes?
I think I can create a custom PL/SQL process which would execute the UPDATE statement (at least, it works in SQL*Plus), but I would like to know if I can use a standard ApEx functionality for this.Hello,
Sorry for delay.
I had found a feedback about trigger issue when restore SQL Database from a BACPAC file. Microsoft said the fixed will be available in the next major release of DacFx.
Feedback:
SQL Azure fires a trigger when restoring from bacpac
You can refer to the workarounds in the feedback. For example, if there is small amount of triggers on the database, you can try to remove the triggers and then recreate when restore from bacpac file.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
I was wondering if you could provide me some information about trigger files and how they can be sent (or retrieved).
I created a daily Informatica process that runs at 8 AM, Monday – Saturday, on the dev server. It uses loans_daily_pub_vw and loan_txn_detail as sources. I’d like to include a process that checks trigger files, in case there are any delays in the loads.
My questions are:
Are trigger files created when the loans-daily and loan-txn-detail process complete?
What is the best practice for sending trigger files?
Can they be ftp’d to another server, or is there an alternate method?
Thanksthis is not an oracle question.
this is an application design issue. if you want to use trigger files (or feel you NEED to because of the limitiation of a legacy system), then you'll need to design and code it.
from oracle, you might want to use UTL_FILE to create files. DBMS_JOB or DBMS_SCHEDULER (v10) to schedule/run stored procedures. You could use external tables to read in files. and you can use DBMS_SCHEDULER on v10, or stored java procedures on v8-9 to issue o/s commands from oracle.
Are trigger files created when the loans-daily and loan-txn-detail process complete?
you decide
What is the best practice for sending trigger files?
there aren't any
Can they be ftp’d to another server, or is there an alternate method?
depends on how your network is setup, and what's installed on your servers -
Standard Work Flow in PP and QM
Hi Gurus,
What are the standard Work Flow in PP & QM ?
Thanks in advance,
ShreeHi
Follow the Path to find it your self.
<i><b>SPRO>Quality Management>Envrionment>Central Functions>Activate Workflow</b></i>
You get a pop-up screen, Click on "<b>Activate SAP Business Workf</b>low"
you get a screen "Task Customizing Overview"
For each module you have a workflows
click on <b>Assign Agents</b> you will find the number of Tasks for each activities or functions
Like Under Production Orders you will have "inform MRP Controller about trigger pt"
etc like wise you have to use these Tasks provided by SAP to your build or combine as per customers requiremnts with proper agent assignments
Regards
Rehman
<b>Reward Your Points If Useful</b>
Maybe you are looking for
-
I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??
-
I use Shared Variable Engine as an OPC Server with LV8. I build an executable (with library deployement), It works on my developpement station (with LV8 installed). I build an installer (with include Variable Engine and LV8 Runtime Engine). If I inst
-
Cs3 stops running when opening a picture file
HI, Ihave CS3 extended running on Vista.Program ran find for months until yesterday, Whenever I try to open a picture file CS3 stops working and shut down. It doesnt matter what type file. I removed program amd reinstalled, still got same probelem. A
-
Version: Photoshop CS (1) Computer: Pentium 2.4 gHz dual core 4 Gigs Ram Nvidia 7950 video card Win XP Home Hi, I started to get this strange error with my Photoshop when making a new document in Photoshop and got the following error: "cannot initiat
-
hello i have a from date and to date field i have to set the to date as (current date) default and the from date to (current date - 7 days) default how do i code for this in webdynpro java.