FAQ Database Discussion Community


ORA-00927: missing equal sign

sql,oracle,triggers
Im creating my first sql trigger, CREATE OR REPLACE TRIGGER totalsalary AFTER INSERT ON Employee FOR EACH ROW WHEN ( NEW.Dno IS NOT NULL ) BEGIN UPDATE Department SET totalSalary totalSalary + NEW.salary WHERE Dno = NEW.Dno; END ; but i got this error message and i dont know how...

Sql trigger not working correctly, deleting to logtable

sql,sql-server,logging,triggers
this trigger is designed to log password changes to a logtable, when you change the password, the old password goes to the table, and it will do that for 5 passwords, when it exceeds the number of 5, it will remove the oldest password to make room for newer ones...

Modify Ids on delete Oracle trigger

oracle,triggers
ID VALUE 0 2 1 3 2 0 When the first record with id 0 is deleted the second one should become 0 and the third one should be 1 . Resulting in: ID VALUE 0 3 1 0 When the record with id 1 is deleted the third one...

Different triggers same job?

sql,triggers,ddl
I have two triggers and I would like to know if the result of the work performed is the same. CREATE TRIGGER trg_test_upd ON test AFTER UPDATE AS RAISERROR('Error', 16, 1); ROLLBACK; GO CREATE TRIGGER trg_test_upd ON test INSTEAD OF UPDATE AS RAISERROR('Error', 16, 1); GO Second question, why would...

Creating a trigger in SQL that reads data from one table, and inserts new data to another

mysql,sql,triggers
I'm having some trouble in my intro to databases class understanding what I can and can't do in SQL regarding triggers. One question in particular is confusing. I am given this schema (which can be viewed here): CREATE TABLE Sensor( sid int NOT NULL AUTO_INCREMENT, Name varchar(100), PRIMARY KEY(sid) );...

PLSQL trigger - update records based on select query

plsql,triggers
I have three tables: HouseMode: mode_id (INT, PK) switch (CHAR 1BYTE) ModeDevices: modedevice_id (INT, PK) house_mode (INT, FK) houseroomdevice (INT, FK) HouseRoomDevices: houseroomdevice_id (INT, PK) switch (CHAR 1BYTE) I would like to have a trigger which updates switches from HouseRoomDevices table after updating switch in HouseMode table. My trigger: CREATE...

Fire trigger from DocumentDB stored procedure

stored-procedures,triggers,azure-documentdb
We have a stored procedure that is modeled after the bulkImport sproc in the DocumentDB sample code. This sproc takes an array of documents, does some stuff, and eventually calls createDocument, which the documentation says is asynchronous. Now we have written a pre-trigger for Create that checks some fields and...

Multiple overlapping actors trigger event in Unreal Engine 4 editor

events,triggers,overlap,eventtrigger,unreal-engine4
Is it possible to trigger an event only when there are multiple actors in the trigger volume? For example a background music starts playing only if there are two specifically tagged actors placed at a trigger volume?

Trigger with a function Oracle

sql,database,oracle,plsql,triggers
I need to make a trigger to insert 'A' in case of a approved student and 'R' for a not approved student. I need to use a function that returns 'A' or 'R'. Here is my function: create or replace function check_grade (grade in number, frequency in number) return varchar2...

jQuery: select default value and trigger change for multiple Selects

javascript,jquery,select,triggers
I am new to jQuery and found a couple of different approaches for this online but nothing worked for me so I hope someone can help me. I have a number of Selects. Each of them has one option with a class "defaultSel" to indicate that this should be selected...

SQL After insert trigger insert multiple rows into another table

mysql,sql-server,triggers
So i have the following table: Table: competence Columns: id int(11) AI PK name varchar(400) organization_id int(11) competence_type_id int(11) competence_category_id int(11) And the following user table: Table: user Columns: id int(11) AI PK username varchar(100) password varchar(100) is_active int(11) user_type_id int(11) token varchar(445) organization_id int(11) title_id int(11) image_path varchar(100) division_id...

Why does SQLite give Cannot create instead of trigger on table

triggers,sqlite3,android-sqlite
With this table create table FOLDER ( _ID integer primary key autoincrement, NAME text not null, PARENT integer not null, DELETED integer, constraint VALUEOF_folder_deleted check (DELETED == 1 or DELETED isnull) on conflict abort, unique (NAME, PARENT) on conflict abort ); I wanted to replace an insert where the NAME...

Oracle Trigger fails after several times it is triggerd

oracle,triggers
I have two triggers. One trigger for UPDATE and INSERT and one trigger for DELETE. create or replace TRIGGER insup_trigger BEFORE INSERT OR UPDATE ON USER_GROUPS FOR EACH ROW BEGIN UPDATE PROJECTS SET TOUCHED = 1 WHERE ID IN (SELECT PJ_ID FROM PROJECT_ROLES_GROUPS WHERE GRP_ID = :NEW.GRP_ID); END; and the...

SQL Update Trigger for writing entire row to another table

sql-server,tsql,triggers
I posted a question yesterday and this is related. I have a table called People_Master CREATE TABLE [dbo].[People_Master]( [ID] [int] IDENTITY(900001,1) NOT NULL, [Email] [nvarchar](50) NULL, [FirstName] [nvarchar](50) NULL, [uac] [int] NULL, [department] [nvarchar](50) NULL, CONSTRAINT [PK_People_Master] PRIMARY KEY CLUSTERED ( [ID] ASC ) And I have created another table...

Database trigger to update a row on parent table after child table has been updated

sql,sql-server,triggers,database-trigger
First time creating a Database trigger. I have a child table that when its cost column is updated, I need its parent table to also update its cost column to reflect the change. Here is my sorry attempt so far. That's obviously not working. I am having a problem figuring...

How to delete a Trigger?

sql,oracle,triggers
I create some Triggers like the following for example: CREATE OR REPLACE TRIGGER TRIGGER_USER BEFORE INSERT ON HOUSE_USER REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW WHEN (NEW.USER_ID IS NULL) BEGIN SELECT SEQ_USER_ID.NEXTVAL INTO :NEW.USER_ID FROM DUAL; END; / But i cant drop them. When i try to...

delete trigger to delete row in another table in another database sql

sql,sql-server,triggers,delete-row
I have a database schema called Fulcrum that has a table called Orders with PK on OrderNO, OrderDate, TenantID I have a bridge database schema called XFer where I also have a table called Orders with the same field names but no keys on OrderNO, OrderDate, TenantID I need to...

Loop in trigger after insert

mysql,triggers
I accidently deleted my trigger (Needed to reset something in my DB). But i don't know how to make my trigger again.. I have a 2 tables. 1: train_information: 2: axle: Now, when a train gets added and inserted in the DB table: train_information. I want a trigger to also...

SQL Server insert after delete Trigger error

sql,sql-server,triggers
I'm trying to insert a row into a new table when a row is deleted from the original table but I keep getting the below error when i run a delete on a record. I read error message details and it says it has something to do with type of...

Check to see if starttime > end time of same group

postgresql,triggers
I have a database which has a calendar in it. Depending on which group i am trying to insert it should check if the NEW starttime is later then the old starttime of the group. I was thinking of something like this: CREATE OR REPLACE FUNCTION check_rooster_tijd() returns trigger AS...

How to get a table identity inserted by instead of insert trigger?

sql-server,triggers
I have a problem described as follows: I have a table with one instead of insert trigger: create table TMessage (ID int identity(1,1), dscp varchar(50)) GO Alter trigger tr_tmessage on tmessage instead of insert as --Set NoCount On insert into tmessage select dscp from inserted GO Alter proc P1 As...

Using a trigger BEFORE UPDATE to INSERT a row into my second table

mysql,triggers
I have this as table structure for my pension_accounts table and below the structure for my second table pension_statement table to select from table pension_accounts AFTER UPDATE trigger Table structure for table `pension_accounts` CREATE TABLE IF NOT EXISTS `pension_accounts` ( `User_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Title` varchar(500) NOT NULL,...

Instead of Insert, Insert Value from (inserted)

sql-server,triggers
So I have a trigger on instead of insert. It runs a check, if that is okay I want a query to insert values into a table. The values needs to come from inserted though. create trigger thisTrigger on instead of insert if (a check) insert into myTable values (pnr...

Use trigger to calculate difference between rows in SQLite

sql,sqlite,triggers
Given a table structure like this: ID|Measurement|Diff|Date where ID and Date is the composite primary key, and rows are further indexed by the Date column. I want to use a trigger (after an insert or replace into) to calculate the Diff column for the table. The Diff column simply records...

Trigger with definer error

mysql,triggers
I'm trying to create a trigger with a definer and some simple action inside, but doesn't get accepted by mysql and freezes the phpMyadmin without giving an error. Can someone help me to find the mistake delimiter // CREATE TRIGGER log_items after insert on Profiles FOR EACH ROW IF USER()...

INSERT a number in a column based on other columns OLD INSERTs

postgresql,triggers,autofill
In PostgreSQL I have this table... (there is a primary key in the most left side "timestamp02" which is not shown in this image, pls dont bother, its not important for the purpose of this question) in the table above, all columns are entered via querrys, except the "time_index" which...

PL/Sql query execution error

oracle,plsql,triggers,procedure
This is my query. A Trigger which automatically stores in a separate table called ‘ExcellentSale’ the Sales Agent name, car model and manufacturer name, each time the agreed price of a SalesTransaction is more than 20% of the car’s asking price. (Note: You need to create the ‘ExcellentSale’ table before...

Improve query efficiency for repetitive queries

postgresql,stored-procedures,triggers,twitter-typeahead,bloodhound
I am writing a node.js application to enable search over a PostgreSQL database. In order to enable twitter type-ahead in the search box, I have to crunch a set of keywords from database to initialize Bloodhound before page loading. This is something like below: SELECT distinct handlerid from lotintro where...

Trigger to find next available inventory location

oracle,triggers,inventory
I am trying to implement inventory tracking and am running into problems. As this is my first foray into database triggers (& PL/SQL in general) I think I need an adjustment to my thinking/understanding of how to solve this issue. My situation is as follows: Each time a new item...

FIM - SQL Triggers for updating records in Delta table

sql,triggers,dml
I'm writing a DML trigger when change (update or Insert) happens in one table (Master table), I want to write the whole row into another table (Delta table). The Master and Delta tables contains the same column with same datatype, except that Delta table contains an additional column called 'change_type',...

Should I create one common trigger or several small triggers? [closed]

database,oracle,triggers
What is a better programming practise: Writing one common trigger that handles several aspects/rules? Or Writing one trigger for each rule? For example I have a database 'Library' with 4 tables: Journal, Clients, Books, and Books_types. Rules on INSERT into table Journal: field DATE_END should be automaticly generated; field COUNT...

Using triggers to implement referential integrity actions (SQL Server)

sql,sql-server,triggers
I'm trying to implement some triggers for my tables 2 of the tables are ORDERS (has orders) and ORDERS_ITEMS (has items for each order), and I want to delete the ORDER when there are no more ITEMS in that ORDER. I want my trigger to look something like this CREATE...

my trigger inserts way to many records

mysql,sql,triggers
I have the following trigger: begin insert into user_has_competence (user_id,competence_id) select u.id,c.id from competence c join user u on u.organization_id = c.organization_id and c.organization_id = new.organization_id; end The tables involved are the following: Table: competence Columns: id int(11) AI PK name varchar(400) organization_id int(11) competence_type_id int(11) competence_category_id int(11) Table: user...

Insert into Change Log based on Trigger After Update

sql-server,triggers,sql-server-2012,sql-server-triggers
I need to code an AFTER UPDATE trigger. When the pay rate of the employees table is modified. It needs to take that information and create a line in the ChangeLog table. My tables are below: Employees: EmployeeID INT (PK), PayPerHour MONEY ChangeLog: ChangeID INT (PK), EmpID (FK to EmployeeID),...

Animation Trigger (Storyboard + Trigger) in C#

c#,wpf,xaml,animation,triggers
I have an animation using DoubleAnimationUsingKeyFrames, and I need to turn on the first part of the animation by using triggers. How can i do that? <Storyboard x:Key="TargetStoryboard"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="TargetArea" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <SplineDoubleKeyFrame KeyTime="00:00:0.0000000" Value="0.001"/> <SplineDoubleKeyFrame KeyTime="00:00:0.6000000" Value="1"/>...

PL/SQL invalid identifier, table_or_view doesn't exist, column not allowed

oracle,stored-procedures,plsql,triggers
i'm currently writing a school assignment but got stuck. Unfortunately I have no reference material to browse through and oracle's user manuals are anything but friendly. The assignment is as followed: "Create a trigger on table sms_budget_abonnement with help of a stored procedure which shows the bill in a new...

Oracle trigger with select inside that returns multiple results

sql,oracle,select,triggers
I have the trigger CREATE OR REPLACE TRIGGER my_trigger AFTERE DELETE OR INSERT OR UPDATE ON my_table FOR EACH ROW DECLARE V_PROJECT_ID VARCHAR2(10); BEGIN SELECT PJ_ID INTO V_PROJECT_ID FROM PROJECT_ROLES_GROUPS WHERE GRP_ID = :OLD.GRP_ID; UPDATE PROJECTS SET TOCUHED = 1 WHERE ID = V_PROJECT_ID; END; but the select statement inside...

Trigger when a certain appointment is changed

triggers,exchange-server
Is there a way to trigger execution of code when a certain appointment is changed in Exchange? I push into Exchange via EWS some appointments created from information stored in our application, and when any of these appointments is deleted or rescheduled, I want to execute my own actions (like,...

Specifying a triger to update timestamp field

sql,postgresql,triggers,updates,ddl
This is a follow up question on : old example. CREATE TABLE "x"."y"( "z" timestamp NOT NULL, "a" Timestamp NOT NULL DEFAULT z + 18 months, ); I wish to specify a trigger where a is updated as soon as z is updated. Something on the lines of CREATE TRIGGER...

Phpmyadmin Trigger

php,mysql,sql,triggers
I need a trigger in phpmyadmin for 2 tables. So there is table stores and tbl_storefinder_stores. I wanted to insert 4 things (name,adress,longitude,latitude) from the table stores to tbl_storefinder_stores, I get help in the forum by this code INSERT INTO tbl_storefinder_stores(store_name, store_address, lat, lon) SELECT name, address, latitude, longitude FROM...

T-SQL: Trigger that runs right before the end of a modifying transaction

sql,sql-server,sql-server-2008,tsql,triggers
Problem statement I have a view for recursively collecting and aggregating infos from 3 different large to very large tables. This view itself needs quite a time to execute but is needed in many select statements and is executed quite often. The resulting view, however, is very small (a few...

Trigger to run stored procedure SQL Server 2008

sql,sql-server,sql-server-2008,triggers
I have staging table for data, every month company insert data in staging table. I am using a stored procedure to copy data form staging to multiple tables. I want to create a trigger to run these stored procedures. For example my staging table blk_data and my stored procedure is...

Change selectMenu option programmatically in child inAppBrowser

javascript,jquery,events,dom,triggers
I open a window using javascript window.open() The window that opens has the following code: jQuery(document).ready(function(){ jQuery("#lang").change(function(){ var lname = jQuery(this).val().split("-"); window.location = '<?php echo JURI::root();?>index.php?lang='+lname[0]; alert(lname[0]); alert('lang '+lang); }); Now this code is triggered upon 'lang' select menu change. I open the window programmatically using window.open and I managed...

Problems creating TRIGGER in MySQL

mysql,triggers
I am first time using trigger concept in my MYSQL workbench like below query, First I created people table by using below query, CREATE TABLE people (age INT, name varchar(150)); Then I used below query for trigger DELIMITER CREATE TRIGGER agecheck BEFORE INSERT ON raptor1_5.people FOR EACH ROW IF NEW.age...

how to fire a salesforce trigger only if we update a custom field

triggers,salesforce,field,updates
Is there way to create trigger on salesforce custom object that will be fired only if we update one custom field and not every time we update the whole object

Trigger by suffix from same element class

javascript,jquery,triggers,correlation,prefix
I want make every button which have suffix class -dummy (let's call it "dummy") to trigger another button who have same class but without that suffix (call it "real button"). <button class="btn-submit hidden"> triggered by <button class="btn-submit-dummy"> <button class="btn-edit hidden"> triggered by <button class="btn-edit-dummy"> <button class="btn-delete"> triggered by nothing since...

ORACLE trigger before procedure execution

oracle,stored-procedures,plsql,triggers
Is it possible to fire a trigger before a specific procedure starts execution? For example I have a package "A", and a procedure "B" inside package "A". So when I call A.B procedure i want to fire a trigger. I'm using oracle 11gR2.

Postgres triggers

postgresql,triggers
I would like to know which table stores the create statement of a trigger eg CREATE TRIGGER t_update_sal AFTER INSERT OR UPDATE ON employees FOR EACH ROW EXECUTE PROCEDURE t_update_sal_v1(); ...

WPF DataGrid Trigger on cell content

c#,wpf,datagrid,triggers
I have a datagrid than contains value comes from a stored procedure. All values are set Bold as FontWeight. I'd like to make the text normal when the cell content is equal to 0. How can I do that with a trigger? I do that but seems not working <DataGrid.CellStyle>...

trigger with multiple action and loop

php,mysql,sql,oracle,triggers
I have 3 tables in my database. - train_information - axle - bogie When i fill in a form, the information gets filled in the train_information table, and looks like this then: Now, you see the number_of_axles is 4. The tables axle and bogie look like this. Axle: Bogie: As...

Syntax error on MySQL trigger when only updating one column

mysql,sql,triggers
I'm trying to create a MySQL trigger that fires when the column user_email is updated in the table wp_users, but it's failing. I'm getting a syntax error just before the second BEGIN, but it looks fine to me. What am I missing? CREATE TRIGGER `email_update` AFTER UPDATE ON `wp_users` FOR...

How can I trigger on 'IsSelected' from a TabItem's HeaderTemplate?

c#,wpf,triggers,tabcontrol
I've created a custom styled TabControl for my WPF application. This includes the following Style for the TabItems: <Style x:Key="TabItemStyle1" TargetType="{x:Type TabItem}"> <Setter Property="Padding" Value="12,2"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter Property="VerticalContentAlignment" Value="Stretch"/> <Setter Property="Foreground" Value="White" /> <Setter Property="FontSize" Value="14" /> <Setter Property="Template"> <Setter.Value>...

PostgreSQL Delete Trigger

postgresql,triggers
I´m creating a trigger on PGAdminIII where I want to delete the rows that have the foreign key on the other table. However I´m getting a Syntax error and I can´t find where the problem is: CREATE TRIGGER clienteDelete BEFORE DELETE ON cliente FOR EACH ROW BEGIN DELETE FROM contacto...

How to do multiple clicks with .trigger()?

jquery,triggers,onclick,click
Is there a simplier way to do this in jQuery? $('button').click(function() { // do something }).trigger('click').trigger('click').trigger('click'); ...

change content button with trigger

wpf,button,triggers,controltemplates
I want change the content of the button to another image when it is pressed but nothing happens. <Grid> <Button Height="120" Width="75"> <Button.Template> <ControlTemplate TargetType="Button"> <Image Source="no-press.png"/> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter Property="Content"> <Setter.Value> <DataTemplate> <Image Source="press.png"/> </DataTemplate> </Setter.Value> </Setter> </Trigger>...

creating triggers in mysql

mysql,triggers
I've some problem doing a trigger.. I've two tables: table1 and table2 in the table2 I've the foreign key of table1 , also in the table1 I've a date... What I've to do is: subtract the current date with the date in table1 and if is major of 7 then...

PostgeSQL triggers functions (e.g.: RI_Fkey_setnull_upd etc..) [closed]

sql,postgresql,triggers
I am getting acquainted with PostgreSQL. Trying to find information for trigger functions listed below: RI_Fkey_cascade_del RI_Fkey_cascade_upd RI_Fkey_check_ins RI_Fkey_check_upd RI_Fkey_noaction_del RI_Fkey_noaction_upd RI_Fkey_restrict_del RI_Fkey_restrict_upd RI_Fkey_setdefault_del RI_Fkey_setdefault_upd RI_Fkey_setnull_del RI_Fkey_setnull_upd suppress_redundant_updates_trigger trigger_in tsvector_updates_trigger tsvector_updates_trigger_column unique_key_recheck Google shows me only sources of PGSQL. Thanks for any of your kind help!...

Auto Increment column when row is updated

mysql,sql,triggers
I have a MySQL table with the structure seen below. The last column represents the number of downloads of a file. Each time a file is accessed, it's UUID changes. Table Structure: +---------+--------------------+--------------+-------------+ | dKey | file_name | file | downloads | +---------+--------------------+--------------+-------------+ | UUID | file.mp4 | file alias...

mysql trigger on update to populate another table

mysql,triggers
I am new to this TRIGGER thing and it is beating me up pretty good. The intention is to populate a price history table every time a price change occurs on table prices. So far my attempts are taking all prices changes each time one price is updated, or not...

'PLS-00103 Encountered the symbol “+” …' error when trying to concatenate some strings in a trigger

sql,triggers,oracle-sqldeveloper
I have a SQL table where a particular record ID (the primary key) could have several Contact IDs. I want to create a trigger where each time a new row is added, it will check whether the record ID exists, and if it does it will add the new Contact...

Adding modify and delete to insert trigger

sql-server,triggers,insert,delete,dml
Good morning everyone, I've been tasked with pushing records from one table (T1) to another (T2). I have the insert portion complete as follows: CREATE TRIGGER [dbo].[CP_to_TW2] ON [dbo].[TEST_PROJ] FOR INSERT AS BEGIN INSERT INTO dbo.TEST_TW (PROJECT_ID,PROJECT_DESC,PROJECT_MANAGER) SELECT PROJ_ID,PROJ_ID+PROJ_NAME,PROJECT_MANAGER FROM inserted END TEST_PROJ is T1 and TEST_TW is T2. The...

Syntax for SQL Trigger to Insert Data in another DB and also to update any field in another db adfter a field is edited

sql-server,database,triggers
Here is the scenario - I will be specific. I have a "bridged" DB on Sql Called [Fulcrum_Xfer] I use this bridged because the Main Db called [Fulcrum UAT] is using a bigint datatype for some fields and thereby displaying in my Access front end "#Deleted data" in all fields...

ControlTemplate Trigger

xaml,triggers,textbox
<Style TargetType="{x:Type TextBox}"> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="KeyboardNavigation.TabNavigation" Value="None" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="MinWidth" Value="120" /> <Setter Property="MinHeight" Value="25" /> <Setter Property="AllowDrop" Value="true" /> <Setter Property="FontSize" Value="16"/> <Setter Property="FontFamily"...

Cancel DELETE on MySQL REPLICATE

mysql,triggers,replication
I'm looking for a way to prevent DELETE statement on a MySQL replication Master/Slave. In my case, the Master is a live database, with fresh entries (not older than a week), and the Slave is an archive database which must contains all entries. I have several problems with my test:...

Google Apps Script Time Based Trigger Date and Hour

google-apps-script,triggers,clock
I can add a time-driven trigger to run on a specific date and time manually via the resources menu, but I cannot find how to do it programatically. I have the .at(date) method, but to this I would like to add a specific time. Is that possible programatically? Example from...

Oracle Insert, Update, Delete Trigger with Join

oracle,join,triggers
I'm trying to implement Oracle triggers for child views but I need to be able to join the child views to their parents in order to do a role permission check. In SQL Server I'm able to stuff like this: ALTER TRIGGER [dbo].[ASetTrt_I] ON [dbo].[UCV_ASet_TRT] INSTEAD OF Insert AS BEGIN...

PL/SQL Trigger in Oracle errors

oracle,plsql,triggers
i don't know how to start !! i have a work in oracle database,and it is all about triggers and constraints ... the work is to create triggers and constraints on some tables of database of league of hokey ... and since i'm new , and not familiar with triggers...

Stackpanel IsMouseOver Trigger does not change to true

wpf,xaml,triggers
I have a Stackpanel with a Image in it. The Image is partly transperent. So i want the Background to be Red, when the mouse is not over (which works). But wen the mouse is over it should turn into green. But it doesn't work. Can you please help me...

How to add username column into trigger in SQL Server for audit trail

sql-server,triggers
I'm using the following code (courtesy of Pop Rivett's SQL blog) to create triggers on SQL Server tables for an audit trail. It works great with one exception. I'm required to record who exactly made the change. As written the system user field was supposed to do this, but that...

Oracle Trigger with two tables

database,oracle,plsql,triggers
I want to build a trigger to fix some kind of bug inside a Program. There are different rows in t2 and the program merges selected ones together in t1 and gives them one single id. So n-rows in t2 are 1 row in t1. Now i want to restrict...

What's an alternative to triggers when using a Jet tables in an Access Database (mdb file)?

mysql,sql-server,database,ms-access,triggers
I have this project that would require users to check in/out through a finger print reader ZK SF200. The system that I am building needs to fetch new data that is added into this machine's database which unfortunately is a MS Access mdb file. In my limited experience in MS...

what is “DESC LIMIT 1” used for in plpgsql?

postgresql,triggers
what is "DESC LIMIT 1" used for in plpgsql??? in this example ORDER BY t.timestamp02 DESC LIMIT 1 ...

Retrieve updated rows in AFTER UPDATE trigger Postgresql

postgresql,triggers,plpgsql
I'm writing a AFTER UPDATE trigger in postgresql. Actualy I need to get at least one row after update in STATEMENT LEVEL trigger, but there is no OLD or NEW variable there. In FOR EACH ROW trigger I didn't manage to find a sort of batch_last param. But to do...

SQL - trigger as log of update

sql,triggers,sqlite3
My tables are: -stormtrooper -squad -platoon Stormtrooper has 'ID' as primary key and 'squadID' as foreign, squad has 'ID' as primary key and 'platoonID' as foreign and platoon has 'ID' as primary key. Using trigger I want to display everything that connects to stormtrooper which I update. CREATE TRIGGER log...

PostgreSQL trigger to make default value refer to another table

postgresql,triggers,default-value
PostgreSQL default values cannot contain variables or refer to any other columns in the table, or in a different table. However, is it possible to use a trigger to create a "Default value" that will behave in the following manner. First, let me illustrate with two example tables: create table...

Update inserted record on a trigger

sql-server,triggers,insert,sql-update
I'm having troubles while trying to update a record when it is being inserted into a database via external application. I need the record being inserted from the users in the application takes a value MinimumStock from a table AERO_LOCATIONSTOCKMIN on which are the parent location and the asset type...

How to manipulate a table depending on another table with a trigger?

mysql,triggers
I am having a hard time figuring out how I can manipulate a table that depends on another table. ------Product---------- -- productcode (PK) -- name -- price -- stock ------Orderline---------- -- ordercode (FK, From 'Order' table) -- productcode (FK) -- amount What I want is to have a trigger that...

MySQL - Trigger before insert, only insert if col = another existing database name?

mysql,database,triggers,dml
I have a database (database1) and a table imei_db(IMEI VARCHAR(15), db VARCHAR(40)). I also have other databases (ex: database2) and I want a trigger that, whe inserting a row on database1.imei_db, it verifies before the actual insert if there is a database with a name equal to db field value....

MySQL trigger help, capturing a variable from php insert into

php,mysql,triggers
I am writing a MySQL trigger to encrypt a column of sensitive data using RSA plugin. There is an insert statement from the website which is PHP based $sql = "insert into redcap_data (project_id, event_id, record, field_name, value) values ($project_id, " . getEventId() . ", '" . prep($_GET['id']) . "',...

MySQL before update trigger an insert syntax error using PhpMyAdmin

mysql,triggers,phpmyadmin
CREATE TRIGGER question_preserver BEFORE UPDATE ON bank FOR EACH ROW BEGIN IF TRIM(NEW.question) != TRIM(OLD.question) THEN INSERT INTO bank_question_history (id,old_question) VALUES (OLD.id,OLD.question)$$ END IF$$ END$$ I am inserting that query into Mysql using PHPMyAdmin's SQL window, using a delim of $$. I get an error You have an error...

Triggers adding rows

sql,database,oracle,triggers
I'm trying to create triggers that add rows in a tab when another tab is updated. I would like to know if my things are correct. I use Oracle and Java. statmnt.executeQuery("CREATE TABLE operations ( operation_id INTEGER, account_id INTEGER, amount FLOAT DOUBLE PRECISION, DATE NOT NULL"); statmnt.executeQuery("CREATE TABLE accounts (...

Trigger vs. Dependency Property precendence

c#,.net,wpf,triggers,dependency-properties
I've got a question about the precendence of dependency property value. My .xaml looks lik the following: <Window x:Class="WpfTests.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local ="clr-namespace:WpfTests" Title="MainWindow" Height="350" Width="525"> <Window.Style> <Style> <!--<Setter Property="Canvas.Background" Value="Gray"/>--> <Style.Triggers> <Trigger...

PostgreSQL: update record on master table and move record in child partitions

postgresql,triggers,partitioning
How to define an update trigger function for Updating records in the master table which has partitions defined on it. I've a table which has partitions defined on it and code for the insert trigger function which will insert data in the child tables whenever there is an insert in...

Is there any way to call a c/c++ file from a trigger in postgresql?

database,postgresql,plsql,triggers,plpgsql
I want to call a c++/bash-script file through a trigger in postgresql. Is there any way for doing this?

Capping values after a trigger level in a different variable

pandas,triggers
I wish to have the values of 'Original_Level' cap to the level where another column 'NS' hits a trigger (in this case abs(NS) >= 4 ). This new column, 'Desired_Level', created while leaving the 'Original_Level' column unchanged. The below df shows a cap of 13.122 and 50.887 when abs(NS) >=...

Edit DataGrid Cell on mouse over

c#,wpf,datagrid,triggers,datagridcell
I have a DataGrid which has plenty rows and columns, I want to get the cell ready for editing when the user focus the mouse on it (IsMouseOver). So far, all I found is this <Window.Resources> <Style TargetType="{x:Type DataGridCell}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="green"></Setter> </Trigger> </Style.Triggers> </Style> </Window.Resources>...

ReSet all password status to zero using trigger

mysql,triggers
I am optimizing my login system in which I am maintain previous passwords of a user, schema of pwd table for maintaining passwords is as follows: here userId refers to primary key of user table. If status attribute is 1 that means row has marking current password if it is...

when to use = and := in postgreSQL?

postgresql,triggers
Im using plpgsql to write triggers n Im wondering when to use = and when to use := in postgreSQL, what is the difference??? for example: CREATE OR REPLACE FUNCTION on_ai_myTable() RETURNS TRIGGER AS $$ DECLARE t_ix real; n int; BEGIN IF NEW.time_type = 'Start' THEN SELECT t.time_index FROM table_ebscb_spa_log02...

Observe age of entries in the database and trigger event

mysql,database-design,triggers
I'm wondering if there's a way to trigger an event into a database based on the age of the row entry. Based in a datetime field I will need to retrieve the entrys that match an exact age, but I don't want to stress the database. So I need the...

MySQL triggers data copy

mysql,triggers
I have a trigger which looks like this: delimiter // create trigger tracker after insert on Items for each row begin end; // delimiter ; I need to insert id, type, and date_created of the inserted column to another table as INSERT INTO Tracker (table_id, type, date) VALUES ( ???...

Capping values after a trigger level in a different variable _after GroupBy

pandas,triggers,group-by
There was an elegant answer to a question almost like this provided by EdChum. The difference between that question and this is that now the capping needs to be applied to data that had had "GroupBy" performed. Original Data: Symbol DTE Spot Strike Vol AAPL 30.00 100.00 80.00 14.58 AAPL...

Oracle 11g Insert Statement into Multiple Tables

sql,oracle,oracle11g,triggers,sql-insert
I am currently having trouble trying to execute multiple statements at the same time. I keep getting this error when trying to run the following INSERT statements: INSERT INTO report_header ( report_number, company_id, user_id, entry_date) VALUES ( 6797, 15967, 84, TRUNC(SYSDATE)); INSERT INTO report_detail (part_id, condition_id, uom_id, dvc_id, cqh_id, alt_part_id,...

How to handle Event of changing the object variable in JS || JQuery?

javascript,jquery,events,triggers
I have got variable e.g. var obj = { foo: 'fooval', bar: 'barval'} How to write event and trigger to detect any modification of obj and then call info in console like this: console.log('changed obj.key from oldVal to newVal');

Create Trigger which updates a column automatically after update of a table

mysql,database,database-design,triggers,mysql-workbench
I have a table which looks like this: |idAvailability|SumRooms|AvailableRooms|AvailabilityRate| everything is int except AvailabilityRate which is float. I want to create a trigger which when updating the AvailableRooms column, automatically because of the existance of the trigger the column AvailabilityRate update as well. This is what I have done so...

How to fire a Trigger when a variable surpasses/exceed a specific Date

sql,database,oracle,triggers,oracle-sqldeveloper
I have a table with an atributte of type "DATE" and I want to fire a Trigger when the atributte achieve a specific date. For example: Table A: a int primary key; d Date; A(1, '15-05-2015'); When this date arrives I want to fire a specific trigger. Thanks....

How to combine different event triggers

javascript,jquery,events,triggers
I am new to jQuery and hope someone can help me with this. I have a JS function that is triggered by various elements / classes with the difference that for some of them the event is triggered by a click and for others on keyup etc. So far I...

SQL IF ELSE statement in trigger

oracle,if-statement,triggers
I want to trigger every insert on a table. Sometimes the name_event is the repository of the target table available and can this be inserted. Sometimes it's unavailable and than I need to check the code in the folder table create or replace TRIGGER scheme2.Logger BEFORE INSERT OR UPDATE ON...

Bind trigger value to a property

c#,wpf,xaml,triggers
I'm trying to setup a trigger so if two values match a color change happens, this is easy when the thing to match is static and can be placed right into xaml, but not when the thing to be compared is dynamic, such as a property. Basically is there anyway...

After insert trigger to update a table with query results from another table

mysql,triggers
This question is related to a previous one. I have 2 MySQL tables, raw_contacts and distilled_contacts. The table structures are as follows: raw_contacts -------------------------------------------- ID (primary auto-increment, int) PHONE (composite unique with NAME, varchar) NAME (composite unique with PHONE, varchar) FREQUENCY (int) Composite unique key is named PHONENUM distilled_contacts ---------------------------------------------...

why is auto-increment trigger creation in oracle failing?

oracle11g,triggers,auto-increment
Using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production I am trying to create a trigger for auto-incrementation. This solution is discussed all over the web, and is pretty much conceded to be the standard auto-increment solution for Oracle. For example this Stack Overflow article seems to be...