Triggers in a database
Hi,
How to find what are all the user defined triggers present in a database?
Thanks
Aravindh
By querying data dictionary
As schema owner:
select * from USER_triggers;
As dba:
select * from all_triggers
where owner not in ('SYSTEM', 'SYS')Message was edited by:
smoradi
Message was edited by:
smoradi
Similar Messages
-
Database Triggers in "Offline Database Sources" - where are they?
Hello,
Can I import database triggers into Offline Database Sources in JDev 10.1.3.3 ? If so, how? If not, why not?
Thanks in advance,
ChrisChris,
"Can I import database triggers into Offline Database Sources in JDev 10.1.3.3 ?" No
"If not, why not?" Because there is no support in JDev for doing so ;)
JDeveloper 11g does have support for this. What I do in 10g is to create a SQL file and store my trigger code in there.
Best,
John -
Unknown Triggers in my Database
Hi
I have some unknown triggers in my database such as BIN$PXncYQp3k9jgQKjAggBHuA==$0,which is created like my other tiggers in database.
When i try to delete them i get the ORA-27235: Message 27235 not found; product=RDBMS; facility=ORA error.
I will be Thankfull if anyone could help meHi,
you can get rid of them by issuing the :
PURGE RECYCLEBIN;
For more info ... you can take a look at Oracle e-book
Oracle® Database Administrator's Guide
10g Release 2 (10.2)
Part Number B14231-02
and especially the paragraph titled:
Purging Objects in the Recycle Bin
Greetings...
Sim -
Generating compound triggers on Oracle Database 11gR2
Hello SDDM users.
Does anybody have an idea how to coerce SQL Developer Data Modeler to produce Compound triggers on tables when generating DDL?
I saw there was a similar question from 2011 on this forum. Has the enhancement request been honoured yet?
Thanks for any info
regards
WouterHi Mike,
Thanks for your response.
I do, however, strongly disagree with you.
Database triggers are very helpful in enforcing a system / enterprise wide consistency of the data in the datamodel.
Triggers make it possible to create data intergrity checks that are enforced for every client touching the data.
If you use procedures to do that, you will need to place them at every possible entrance to your data.
You can bet I will be using triggers for years to come.
(And I will explain it to new-to-my-company developers within minutes,.... and they will like it too :-) )
thanks again for your effort to response.
regards Wouter -
How to track personal details changes in the report without using triggers on the database tables
Hi There,
I'm having a requirement to track the oracle HRMS Personal details changes in the report not using the triggers.
ex: if some changes the address of the person, then that changed values should be populated in the report.
Please find below query:
If any of the following columns data is updated, the new value should be populated in the report.
SELECT PAPF.PERSON_ID PAPF_PERSON_ID
, PAPF.EMPLOYEE_NUMBER EMPLOYEE_NUMBER
, PAPF.FIRST_NAME FIRST_NAME
, PAPF.LAST_NAME LAST_NAME
, TO_CHAR(PAPF.DATE_OF_BIRTH ,'DD-MON-YYYY') DATE_OF_BIRTH
, ADDR.ADDRESS_LINE1 ADDRESS_1
, ADDR.ADDRESS_LINE2 ADDRESS_2
, ADDR.ADDRESS_LINE3 ADDRESS_3
, ADDR.TOWN_OR_CITY TOWN
, ADDR.REGION_1 COUNTY
, ADDR.POSTAL_CODE POST_CODE
, ADDR.COUNTRY COUNTRY
, PAY.PAYROLL_NAME PAYROLL_NAME
, PLN_TYP.NAME PLAN_TYP
, PLN.NAME PRODUCT_NAME
, BOF.NAME COVERAGE
FROM PER_ALL_PEOPLE_F PAPF
, PER_ALL_ASSIGNMENTS_F PAF
, PER_ADDRESSES ADDR
, PAY_PAYROLLS_F PAY
, BEN_PRTT_ENRT_RSLT_F PEN
, BEN_PL_TYP_F PLN_TYP
, BEN_PL_F PLN
, BEN_OIPL_F BOIPF
, BEN_OPT_F BOF
WHERE 1 = 1
AND PAPF.PERSON_ID = PAF.PERSON_ID
AND TRUNC(SYSDATE) BETWEEN PAPF.EFFECTIVE_START_DATE AND PAPF.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN PAF.EFFECTIVE_START_DATE AND PAF.EFFECTIVE_END_DATE
AND PAPF.PERSON_ID = ADDR.PERSON_ID
AND ADDR.PRIMARY_FLAG = 'Y'
AND ADDR.DATE_TO IS NULL
AND PAF.PAYROLL_ID = PAY.PAYROLL_ID(+)
AND PEN.PERSON_ID = PAPF.PERSON_ID
AND PEN.BUSINESS_GROUP_ID = PAPF.BUSINESS_GROUP_ID
AND TRUNC(SYSDATE) BETWEEN TRUNC(PEN.EFFECTIVE_START_DATE) AND TRUNC(PEN.EFFECTIVE_END_DATE)
AND PEN.PRTT_ENRT_RSLT_STAT_CD IS NULL
AND PEN.SSPNDD_FLAG = 'N'
AND ( PEN.ENRT_CVG_THRU_DT >= TRUNC(SYSDATE)
OR PEN.ENRT_OVRIDN_FLAG = 'Y')
AND EXISTS(SELECT PIL.PER_IN_LER_ID
FROM BEN_PER_IN_LER PIL
WHERE PIL.PER_IN_LER_ID = PEN.PER_IN_LER_ID
AND PIL.BUSINESS_GROUP_ID = PEN.BUSINESS_GROUP_ID
AND PIL.PER_IN_LER_STAT_CD NOT IN ('VOIDD','BCKDT'))
AND PEN.PL_TYP_ID = PLN_TYP.PL_TYP_ID
AND TRUNC(SYSDATE) BETWEEN PLN_TYP.EFFECTIVE_START_DATE AND PLN_TYP.EFFECTIVE_END_DATE
AND PLN_TYP.PL_TYP_ID = PLN.PL_TYP_ID
AND TRUNC(SYSDATE) BETWEEN PLN.EFFECTIVE_START_DATE AND PLN.EFFECTIVE_END_DATE
AND PLN.PL_ID = PEN.PL_ID
AND PEN.OIPL_ID = BOIPF.OIPL_ID(+)
AND TRUNC(SYSDATE) BETWEEN NVL(BOIPF.EFFECTIVE_START_DATE,HR_GENERAL.START_OF_TIME) AND NVL(BOIPF.EFFECTIVE_END_DATE,HR_GENERAL.END_OF_TIME)
AND BOIPF.OPT_ID = BOF.OPT_ID(+)
AND TRUNC(SYSDATE) BETWEEN NVL(BOF.EFFECTIVE_START_DATE,HR_GENERAL.START_OF_TIME) AND NVL(BOF.EFFECTIVE_END_DATE,HR_GENERAL.END_OF_TIME)
AND (:P_SYSDATE) BETWEEN TRUNC(PEN.ENRT_CVG_STRT_DT) AND TRUNC(PEN.ENRT_CVG_THRU_DT)
AND (CASE WHEN :P_PAYROLL_ID IS NULL THEN 'Y' ELSE NVL((SELECT 'Y' FROM DUAL WHERE PAY.PAYROLL_ID = :P_PAYROLL_ID), 'N') END) = 'Y'
AND PAPF.LAST_UPDATE_DATE = (:P_SYSDATE) ;
--AND PAPF.LAST_UPDATE_DATE BETWEEN to_date(:P_SYSDATE) and (to_date(:p_sysdate) + INTERVAL '31' Day);
--AND (:P_SYSDATE) = PAPF.LAST_UPDATE_DATE ;
Thankscheck this -
Re: Best Event-Based notifications for Sox Complience? -
How to see all the system triggers in the database?
and how to make the logon trigger to call a procedure?
Not sure what you mean by system triggers. If it is database_event triggers, then:
SELECT * FROM DBA_TRIGGERS WHERE TRIM(TRIGGERING_EVENT) IN ('SHUTDOWN','STARTUP','LOGON','LOGOFF','SUSPEND','DB_ROLE_CHANGE')
and how to make the logon trigger to call a procedure? same as averywhere else.
SY. -
Triggers missing from offline database source in JDev 10.1.3.4/5
Hi,
I cannot copy triggers to offline database source in JDev 10.1.3.4/5.
In a project under Offline Database Source->[Schema Name] -Right Click- Import Database Objects -> Connection-> Filter Types (Triggers are not listed)
Is this a setup issue in JDev or the database or are triggers not supported in this version of JDev?
thanks,
BrendenHi,
the BPEL extension is developed and owned by the BPEL group. Please try the BPEL forum at BPEL Note that if they can't provide immediate help for your probem, you may consider customer support for help
Frank -
Is there any way to find the name of the table from withing the trigger code?
ThanksI guess you mean this.
ALL_TRIGGERS
ALL_TRIGGERS describes owned by the current user and triggers on tables owned by the current user. If the user has the CREATE ANY TRIGGER privilege, then this view describes all triggers in the database.
Related Views
DBA_TRIGGERS describes all triggers in the database.
USER_TRIGGERS describes all triggers owned by the current user. This view does not display the OWNER column.
Column Datatype NULL Description
OWNER
VARCHAR2(30)
NOT NULL
Owner of the trigger
TRIGGER_NAME
VARCHAR2(30)
NOT NULL
Name of the trigger
TRIGGER_TYPE
VARCHAR2(16)
When the trigger fires: BEFORE STATEMENT, BEFORE EACH ROW, BEFORE EVENT, AFTER STATEMENT, AFTER EACH ROW, and AFTER EVENT
TRIGGERING_EVENT
VARCHAR2(216)
The DML, DDL, or database event that fires the trigger. For a listing of triggering events, see the CREATE TRIGGER statement in Oracle9i SQL Reference.
TABLE_OWNER
VARCHAR2(30)
NOT NULL
Owner of the table on which the trigger is defined
BASE_OBJECT_TYPE
VARCHAR2(16)
The base object on which the trigger is defined: TABLE, VIEW, SCHEMA, or DATABASE
TABLE_NAME
VARCHAR2(30)
If the base object type of the trigger is SCHEMA or DATABASE, then this column is NULL; if the base object type of the trigger is TABLE or VIEW, this columns indicates the table/view name on which the trigger is defined
COLUMN_NAME
VARCHAR2(30)
Name of the nested table column (if nested table trigger), else null
REFERENCING_NAMES
VARCHAR2(87)
Names used for referencing OLD and NEW column values from within the trigger
WHEN_CLAUSE
VARCHAR2(4000)
Must evaluate to TRUE for TRIGGER_BODY to execute
STATUS
VARCHAR2(8)
Whether the trigger is enabled (ENABLED|DISABLED)
DESCRIPTION
VARCHAR2(4000)
Trigger description; useful for re-creating a trigger creation statement
ACTION_TYPE
VARCHAR2(11)
The action type of the trigger body (CALL or PL/SQL)
TRIGGER_BODY
LONG
Statement(s) executed by the trigger when it fires
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch2154.htm#1304423
Joel P�rez -
Database Diff - One column and triggers won't fall off report
I'm trying to use the database diff tool (which I LOVE, by the way), and I'm getting just a few odd results. I'm comparing two databases and can never seem to get to where the diff report is empty, even though everything is the same. No matter what I do, it lists one column in a table as different and lists ALL 13 triggers in the database as different. I have tried dropping the table and all triggers in question and having the diff scripts recreate them, but when I try a diff again, they keep showing up as different somehow.
Also, the diff script is generating this as code to modify the column:
alter table "USERS" modify ( "UPID" NVARCHAR2 );
Which I don't think is valid syntax - I get "Missing left parentheses." I think it's because it doesn't like specifying the NVARCHAR2 type without a size. If I change that statement to NVARCHAR2(20), then the statement runs. However, as I said before, it still shows up in the diff report later on as if something is different, even though both databases are exactly the same.
I'm using SQL Developer 2.1.1.64 on Windows XP Pro. Database is 10g.Does the ext directory have the php_oci8.dll? In the original steps the PHP dir is renamed. In the given php.in the extension_dir looks like it has been updated correctly. Since PHP distributes php_oci8.dll by default I reckon there would be a very good chance that the problem was somewhere else. Since this is an old thread I don't think we'll get much value from speculation.
-- cj -
Starting new database LUW inside ABAP during IDoc posting
Hi all,
During posting of an inbound IDoc, I am trying to update my Z-table in user-exit. I want to do it regardless of the result of IDoc posting. The problem is: if IDoc posted successfully - table is updated because COMMIT WORK is called at the end of the posting, however, if IDoc not posted - ROLLBACK WORK is called and table is not updated. So, my aim now is to commit the update of Z-table in any case, but it is the only thing that should be committed - no other prior update FMu2019s should be committed.
I'm aware about the following thread
http://forums.sdn.sap.com/thread.jspa?threadID=1884700
Author of this thread says that he solved a problem by means of RFC and STARTING NEW TASK. But ABAP help says
that starting asynchronous RFC triggers immediately a database commit in the calling program (which is unacceptable because all prior update FMu2019s will be committed ). I've checked and it is really the case.
From my point of view SET UPDATE TASK LOCAL with COMMIT WORK should work in such kind of tasks, but in case of IDoc processing the whole process runs in a local update (see SET UPDATE TASK LOCAL in FM 'IDOC_INPUT'), so writing once again SET UPDATE TASK LOCAL has no effect.
I tested SUBMIT statement as well. It had no effect and then I found out from ABAP help that SUBMIT ... AND RETURN starts new SAP LUW, but NOT a DB LUW. That is if I update my Z-table in the program called by SUBMIT - all ROLLBACK statements still affect my Z-table update.
Is there any simple solution? Please suggest.
Thanks in advance!Hello,
Try SUBMIT VIA JOB.....
Sample Code
call function 'JOB_OPEN'
exporting
jobname = name
importing
jobcount = number
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if sy-subrc = 0.
submit z_idoc_create_process_order and return
via job name number number
with p_aufnr = it_header1-aufnr
with p_werks = it_header1-werks
with p_autyp = c_autyp
with p_auart = it_header1-auart
with p_dispo = it_header1-dispo
with p_opt = c_opt
with p_mestyp = c_mestyp.
if sy-subrc = 0.
call function 'JOB_CLOSE'
exporting
jobcount = number
jobname = name
strtimmed = 'X'
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
others = 8.
if sy-subrc 0.
endif. -
Is it possible to create triggers in sybase from jdbc (java application)?
We are in the need to create a triggers in the database (sybase) from JDBC (java application)?
Please send me pointers or articles related to this.
Thanks in advance,
KriA trigger is NEVER explicitly called, from any environment.
It is implicitly called when you invoke the operation that it's a trigger for.
Whether you're using Java or anything else to invoke that operation makes no difference whatsoever. -
Msg 22051 Database Mail Attachment file is invalid
Hello,
I'm testing a trigger to output a text file and then attach it to an email in Database Mail. So far, I've gotten the correct text file to export to a TEMP folder, but when I try to attach it to database mail, I get the message below. I think it is a permissions
problem with the TEMP directory, but I've tried adding some permissions, but nothing seems to work. The profile name is TFRONT_DBMAIL and the account name is Albert using Basic Authentication for the SMTP server. I think you have to add the SQL Server User
Account or the Database Mail account to the permissions, but I can't seem to find the exact one to use. I have set up other triggers that use database mail that only send messages with no attachments and they work fine.
Any help appreciated!
Albert
Msg 22051, Level 16, State 1, Line 0
Attachment file "C:\TEMP\NTCDManifestInv135255.txt" is invalid.
Albert SHello, I moved the temp file here:
DECLARE
@PathVARCHAR(200)='C:\Users\MSSQLSERVER\Temp\'
SQL Server service account (MSSQLSERVER) has full access to that folder. Still getting this
message:
Msg 22051, Level 16, State 1, Line 0
Attachment file "C:\Users\MSSQLSERVER\Temp\NTCDManifestInv135255.txt" is invalid.
The file is created and it is in the Temp directory. It just won't attach. Thank you
for any help! Below is the full statement.
Albert
DECLARE @CustomerID varchar(10) = 'NTCD'
DECLARE @EmailBody varchar(1000)
DECLARE @CustomerName varchar(50)
DECLARE @InvoiceNo VARCHAR(6) = '135255'
DECLARE @ManifestName VARCHAR(11) = 'ManifestInv'
DECLARE @Extension VARCHAR(4) = '.txt'
DECLARE @FullName VARCHAR(100)
DECLARE @BCP VARCHAR(8000)
DECLARE @Path VARCHAR(200) = 'C:\Users\MSSQLSERVER\Temp\'
SET @FullName = char(34) + @Path + @CustomerID + @ManifestName + CAST(@InvoiceNo as VARCHAR) + @Extension + char(34)
SET @BCP = 'bcp "SELECT char(34)+ComposerAuthor+char(34), char(34)+Title+char(34), char(34)+(ISNULL([Place],char(32))+char(32)+char(58)+char(32) + [Publisher]+char(44)+char(32) + [Copyright])+char(34) AS PlacePubDate, char(36)+CAST([ExtPrice] AS varchar), char(34)+ScoreFormat+char(34) FROM tfront.dbo.tblCustInvItems INNER JOIN tfront.dbo.tblInventory on tfront.dbo.tblCustInvItems.InventoryID = tfront.dbo.tblInventory.ID WHERE InvoiceNo = ' + @InvoiceNo + '" queryout '+ @FullName + ' -T -c -t\t -S'
EXEC master..xp_cmdshell @BCP
SET @EmailBody = 'The Account ' + @CustomerID + ' was billed today.' + Char(13) + 'A text manifest was sent.'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'TFRONT_DBMail',
@recipients = '[email protected]',
@body = @EmailBody,
@subject = 'TFront Database Auto Email',
@file_attachments= @FullName;
Albert S -
Only AFTER triggers generated afther migrating the SQLServer db to Oradb
When we migrate the SQLServer triggers in Oracle Model using the omwb only AFTER row level triggers are genereted.
Can we also generate BEFORE row level and STATEMENT level triggers from SQLServer database triggers in Oracle Model triggers?
thanks in advance,
Daud AkmalDaud,
Trigger support is not comprehensive and is one of the features we may need to review. Can you be clearer in what you want as the feature enhancement to the TSQL to PL/SQL parser?
Regards,
Turloch
Oracle Migration Workbench Team -
Need Sample for Essbase Triggers
I would like to set up some Essbase triggers on a database (when a value for a particular member is not #Missing, I'd like an email sent to me). I have looked through alot of documentation and in all honesty, it leaves alot to be desired.
I'm setting this up in EAS and was just looking for some examples of what to fill in on each screen. I am getting error messages "bad trigger definition" which doesn't really help me to determine what the error exactly is.
Also, if I choose to spool to a log file, I can't determine where this log file will be exactly.You must be referring to Glenn's unique sense of punning. Imagine working side by side...
FWIW, I believe I tested each and every one of those examples -- they're real and they work.
Regards,
Cameron Lackpour
P.S. I'm more of a Hopalong Cassidy fan myself.
Edited by: CL on Aug 3, 2010 4:10 PM
Glenn pointed out that there was a much funnier comment, by me, in a Powerpoint comment. Oh yes, that feature is that cool. I have about four versions of that presentation -- I picked the first one without my snarky remarks. He even has to explain the jokes to me... -
Hi All,
I want to list the names os all the triggers stored in database whicg contain a particular word. I tried to use INSTR and Like '%search%' but as the trigger body column is a long type column I can not use these functions on this column. Can any body please help me how to do this.
Thanks in advance
Warm Regards
Vivek BajajThe USER_SOURCE solution will only work in version 9. If you are on 8 something, and need to do this as more than a one-shot deal, you can create a procedure similar to this to find trigger with your text.
PROCEDURE find_text_in_trigger (p_str_to_find IN VARCHAR2) IS
DECLARE
CURSOR trig_cur IS
SELECT trigger_name, trigger_boy
FROM user_triggers;
l_trigger VARCHAR2(30);
l_body VARCHAR2(32767);
BEGIN
OPEN trig_cur;
LOOP
FETCH trig_cur INTO l_trigger, l_body;
EXIT WHEN trig_cur%NOT_FOUND;
IF INSTR(l_body, p_str_to_find) > 0 THEN
DBMS_OUTPUT.Put_Line ('String exisits in trigger '||l_trigger);
END IF;
END LOOP;
END;This will, of course, bomb if you have triggers bigger than 32K, but if you do you probably have bigger problems anyway.
TTFN
John
Maybe you are looking for
-
Hello Everyone, is there a function that retreives your current filename? I would like to be able to know the name of the cfm file i'm visiting, without the rest of the folder structure. Thanks for any info!
-
New update crashes Illustrator CC
The new update I installed this morning from CC crashes Illustrator repeatedly on start up - even with Verdana enabled as per the solution posted, can anyone help further? Thanks very much.
-
How do I take the restriction off in app purchases
Does anyone have an answer for me?
-
I'm working on a PC that isn't connected to the Internet so it may be an old version of MAX. I have a NI-2627 switch that I need to change the topology of from 32x2 to 64x1. When I open MAX and right-click on the card, the only options I get are: Sav
-
Oracle BAM Server don't start. Below is the log file. Any suggestion? Thank you!