Procedural code automatically executed in response to a database event.

learn more… | top users | synonyms (1)

1
vote
3answers
79 views

Trigger or Stored Procedure?

Let's say I have two tables, foo and bar: CREATE TABLE foo( foo_id serial NOT NULL, count integer NULL, PRIMARY KEY(foo_id) ); CREATE TABLE bar( bar_id serial NOT ...
1
vote
2answers
21 views

MySQL After Update Trigger apparently not running

I have the following After Update trigger on a MySQL table: CREATE DEFINER = 'root'@'localhost' TRIGGER phpbb_rathermenacing.phpbb_bbdkp_memberlist_AUPD AFTER UPDATE ON ...
0
votes
2answers
83 views

Mysql trigger not working, syntax issues

I have this trigger CREATE TRIGGER checkcollision AFTER UPDATE ON players BEGIN SELECT RAISE(ABORT, 'collision') FROM walls WHERE NEW.x=x AND NEW.y=y; END; mysql 5.1.72-0ubuntu0.10.04.1 ...
0
votes
2answers
108 views

How to autoincrement Prod_id based on Product_Name using trigger in mysql

Product_Details table : (Fields) Prod_id(Primary key), Product_Name, Prefix and Slno(Auto incremented) i need to increment Prod_Id based on the product name field and prefix field (Input will be ...
1
vote
1answer
12 views

Java Spring application Database triggers auditing - how to provide the right user that made the change

We are developing a new web application. one of the most basic requirement is to audit all entities changes into a separate table. We would like to use DB triggers for that purpose. We use MySQL as ...
1
vote
1answer
20 views

Generic Trigger on MYSQL to replicate data on other table

I'm currently doing a history table that basically logs every single modification in a history table, and adding the Action executed. CREATE TABLE `competencies` ( `id` int(11) NOT NULL ...
1
vote
1answer
47 views

Mutating Error , How to solve it

CREATE OR REPLACE TRIGGER LOAN_RP AFTER INSERT OR UPDATE ON FUND_DISBURSE REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW DECLARE V_FA FUND_DISBURSE.FUND_AMT%TYPE; V_RC NUMBER (10); ...
0
votes
1answer
34 views

MySQL add few column exception for TRIGGER UPDATE FOR EACH ROW

How to effectively add column id, name exception for trigger: CREATE TRIGGER updated BEFORE UPDATE ON table1 FOR EACH ROW SET NEW.date=NOW() so that date=NOW() will be affected on updating any ...
0
votes
1answer
42 views

Update query in a trigger

I have a configuration table: Table: refdatecol - id int(11) startdatecol varchar(100) enddatecol varchar(100) datecolTable varchar(100) This table holds the user configured column names ...
0
votes
1answer
28 views

Trigger on a Schema

Is it possible to create a Trigger on a Schema? I have to audit the changes on my tables. But I have a lot of tables and I don't one to create a trigger on them one by one. --Database level trigger. ...
0
votes
1answer
31 views

MySQL Syntax Error When Creating a Trigger

I am trying to create a trigger but I am getting a syntax error and I am not really sure why I am. CREATE TRIGGER Section_Insert AFTER INSERT ON Section -> FOR EACH ROW BEGIN -> INSERT ...
0
votes
1answer
162 views

How to perform a while loop on the query result

I created a trigger AFTER an UPDATE of a column in a MySQL database. When the trigger detects a certain value, it should perform some actions. This is what I have at the moment and is working fine. ...
0
votes
1answer
25 views

Trying to get this MySQL Trigger working

create trigger check_td before for each row begin declare v_code_ID varchar(25); declare c_Worker1 cursor for select code_ID from Worker1; declare c_Worker2 cursor for select code_ID from Worker2; ...
0
votes
1answer
659 views

PLS-00049 bad bind variable when compiling a trigger

I'm trying to implement a dedupe trigger to a table. CREATE OR REPLACE TRIGGER USER.TBL_ACTION_DEDUP BEFORE INSERT ON USER.ERRORTABLE REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN IF ...
0
votes
1answer
91 views

Mysql - Select To XML

I'm Building Audit Trail with Trigger, and want to convert the inserted / updated / deleted value into XML and store it into another table. my trigger look like this: DELIMITER $$ CREATE ...
-1
votes
1answer
451 views

how to log insert,delete,update queries in mysql

I want to log every insert,delete,update (successfully written) queries using mysql ? I tried following ways 1) used triggers ( but i can't get the SQL query ); 2) show processlists ( only showing ...
2
votes
0answers
87 views

Postgresql trigger - get all changed rows after transaction

I have invoice_item table and invoice table. I need to check total price of Order after each transaction. Since I still want to be able to change things, I need trigger after each transaction. CREATE ...
2
votes
0answers
76 views

logon trigger to send an email

I want to create a simple login trigger. basically if user = test , then send an email to me. CREATE TRIGGER ServerLogon ON ALL SERVER WITH EXECUTE AS 'test' FOR LOGON AS BEGIN IF ...
2
votes
0answers
36 views

Setting up triggers based on exposed columns in a view's source table

I have a table where I want to do a AFTER UPDATE trigger if one of the columns modified was in a specific view CREATE VIEW [dbo].[iv_EmployeesView] AS SELECT EMPLOYEE_GUID AS EmployeeGuid, ...
2
votes
0answers
101 views

SQL Server and updating windows firewall rules

Any ideas how should I proceed if I would like to update the firewall rules (essentially add ip-s to existing firewall rule). The step of exporting ip-s to text file and then using command line to ...
1
vote
0answers
70 views

How to avoid locking problems while disabling/enabling triggers in a PostgreSQL function?

Whenever I try to disable a trigger from within a function, I get following error: ERROR: cannot ALTER TABLE "datace" because it is being used by active queries in this session It seems logical ...
1
vote
0answers
101 views

Storing changes to stored procedure and triggers in PostgreSQL

I want a mechanism where I can store/track changes in stored procedure and triggers. I want to track these logs in some table. What is the best possible way ?
1
vote
0answers
209 views

DDL trigger AFTER ALTER ON SCHEMA behavior

Can anyone please tell me what's going on here: CREATE TRIGGER afr_alt_trig AFTER ALTER ON SCHEMA cols ora_name_list_t; BEGIN IF (ora_dict_obj_type = 'TABLE') THEN select column_name bulk ...
1
vote
0answers
582 views

Why Oracle Database trigger can became DISABLED

We have an application, using ddl database trigger on oracle database. Trigger depends on package and several tables, package depends on user defined function. It works on different customer sites ...
1
vote
0answers
105 views

TSQL Trigger Incorrect Syntax

Im a SQL noob but here goes - I have a trigger in SQL which is giving me an incorrect syntax error E.G: INSERT INTO aTable ( tTypeId, opId, inserted.Id ) SELECT 3, 0, inserted.Id ...
0
votes
0answers
5 views

Implementing a functionality for processing heavy insertion

I use PostgreSQL 9.1 The scenario is: I receive heavy insertion into Table1 (about 100 rows a sec). For each new entry, I have to check it with the previous and next ones (check if those items are ...
0
votes
0answers
28 views

Replication overview

My boss wants me to elaborate a comprehensive report about synchronisation/replication. I know that replication can be done with the DBMS (we are using SQL Server 2012), but he wants something manual ...
0
votes
0answers
11 views

DB2 Trigger for EVENT and ARCHIVE TABLE

I have a requirement on DB2. There is a two Table EVENT and ARCHIVE. Both table has ROW_ID and STATUS field. Case 1: When Update STATUS Zero to One at EVENT table that row will insert at ARCHIVE ...
0
votes
0answers
16 views

SQL Server 2000 - Revert trigger template to original default

In SQL Server Enterprise Manager, in the table list for a database, you can right click on a table, choose 'All Tasks' and then 'Manage Triggers ...' which will open up the following window I had to ...
0
votes
0answers
24 views

How do triggers work on partitioned tables?

I have partitioned a table on the basis of a column. This column can either have 0 or 1. So, only two partitions (p0, p1) have been created internally. On this table there are 3 triggers which execute ...
0
votes
0answers
40 views

Copying a table with its structure, indexes, and associated triggers?

I have studied this post on Stack Overflow: Fastest way to copy a table in MySQL. But no answer is copying everything like the table's structure, data, indexes as well as associated triggers. Is it ...
0
votes
0answers
13 views

Access Sql Server Linked Server during Logon Trigger

I am trying to log users logons to my Sql Server (A) in another Sql Server (B, different location physically), but when I try to log in I get the error Login failed ... due to trigger execution and ...
0
votes
0answers
29 views

Oracle Archiving deleted rows via trigger and trigger logging if error

I created table in new schema/user CREATE TABLE archive.table1 ( id NUMBER(10), name VARCHAR(45), created_at DATE, updated_at DATE, deleted_at DATE ); I granted access to that table for ...
0
votes
0answers
29 views

Oracle after insert trigger vs update performance in plsql block

I want to know whether an after insert trigger is better than an insertion statement followed by update statement in plsql block.
0
votes
0answers
40 views

Load XML is not working in mysql version 5.5

I have a requirement where i need to load xml file into a mysql table using trigger. I have written the following trigger to achieve this. CREATE TRIGGER asdb.payment_test AFTER INSERT ON asdb.abc1 ...
0
votes
0answers
91 views

Problem with a trigger (Oracle 11gR2)

I converted the trigger into a "Compound" trigger; this is my first attempt using a compound trigger. Here is my new code: --select * from user_errors; CREATE OR REPLACE TRIGGER ai_fin_transaction ...
0
votes
0answers
30 views

What is the story about Oracle CREATE TRIGGER … CALL syntax?

I was able to use the CREATE TRIGGER ... CALL SOMEPROCEDURE; syntax but I'm a little bewildered about it. I expected to see some implicit arguments like TABLE%ROWTYPE new but that doesn't seem to be ...
0
votes
0answers
53 views

How to update Status using IF Condition in Mysql trigger

I'm trying to write an update trigger that will Design_Update_Status to Customized when a date is entered in Custom_Design_Update_Date field and if nothing is entered that field it should update ...
0
votes
0answers
41 views

How to analyze incoming DML in SQL Server 2005?

I have database and specifically one table that is used for batch data transfer from another organization. With each run the table is truncated and rows are re-inserted. I want to handle that process ...
0
votes
0answers
20 views

Any possible solution for triggers associated with a table which is renamed to new name as trigger code still points to old table name

If there are any triggers associated with a table which is renamed to new name as trigger code still points to old table name As mysql document it says statement fails with the error Trigger in ...
0
votes
0answers
79 views

Issue with a where clause by using Oracle

I'm currently facing a problem while I'm adding a trigger to the database that I use at home. I'm using : Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production The problem ...
0
votes
0answers
47 views

MYSQL, how to build this Trigger

I have two tables in mysql Table: objects 1: ID (Auto Increment) INT eg: 1 2: Object (like "Flower) TEXT eg: Flower 3: Rank (like 90, calculated) FLOAT eg: 90 ...
0
votes
0answers
85 views

Minimizing possible trigger impact

I'm trying to make sure a trigger doesn't cause trouble. (Quixotic, I know!) Is there more I can do to the trigger below to make it bullet-proof? Details: We have a huge table we don't control ...
0
votes
0answers
268 views

Does Netezza have functionality that is equivalent to a trigger?

Does Netezza have a feature that is similar to a trigger in SQL Server or Oracle? Right now we are using Netezza as a data warehousing database, but we would like to perform some audits and ...
0
votes
0answers
436 views

Update row to another table using mysql trigger

I have the following 2 tables (places & offer_company) in a MySQL database named COUPON1.81. CREATE TABLE IF NOT EXISTS `places` ( `id` int(60) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT ...
0
votes
0answers
270 views

error in creating trigger in phpmyadmin

I have 4 tables: event: event_id(p.k) | uid | circle_id(f.k) activity: uid | performed_activity_id(f.k->event_id) | activity_type_id follow: follower_id | circle_id(f.k) noiticication: ...
0
votes
0answers
1k views

MS Access trigger

I got a trigger to update a table in SQL. My actual need is in MS Access but I could not make it. So please help me to write the same trigger in MS Access. Query is as follows: Create trigger ...
0
votes
0answers
70 views

memc_delete called from a MySQL trigger loop fails randomly

I'm calling memc_delete from a MySQL trigger's code. The call is inside a loop. Logging the results, I see that memc_delete sometimes returns 1 (ok, memcached entry deleted) and sometimes returns 0 ...