Questions tagged [triggers]
Triggers are rules that perform actions or invoke functions in response to events such as matching conditions or database changes. Use with an applicable database, platform, product, or service tag where possible. Always use with corresponding language tag.
19,579
questions
-2
votes
1
answer
38
views
End statement of a SQL trigger says "missing ';' " despite it being there [closed]
I'm trying to make an audit trigger in SQL, here's my code:
CREATE TRIGGER audit
AFTER INSERT
ON patient
FOR EACH ROW
BEGIN
INSERT INTO log_access(Modified_date, Tablename, AuditAction, User_ID)
...
0
votes
0
answers
3
views
Cannot follow the same aggregate relationship twice: Cases
Hello I have difficulty create a list/array in SELECT function Apex Trigger.
ArrayList<Contact> contactsToUpdate = [SELECT Id,
(SELECT Id FROM Cases WHERE IsClosed = false) openCases,
(SELECT Id ...
0
votes
0
answers
40
views
Function returns different value when called inside a trigger function
I have a function in plpgsql which return the an integer value based on a selection criteria,
select using function returns the right value but return zero when called inside a trigger function
CREATE ...
0
votes
1
answer
15
views
problem in Build trigger phpmyadmin near DECLARE
i have Trigger code in phpmyadmin
BEGIN
DECLARE videTimeSum,channel INT;
DECLARE done INT DEFAULT FALSE;
DECLARE cur1 CURSOR FOR Select sum(videotime) - COALESCE(sum( TIMESTAMPDIFF(Minute,...
-1
votes
0
answers
41
views
Translate a (1,N) <-> (0,N) relation in PostgreSQL with Constraints
I'm designing a Database which requires a Many-To-Many relationship between two entities, but this kind of relationship can't be empty for one entity at any time. I'm trying to do this in PostgreSQL, ...
-2
votes
0
answers
27
views
My trigger not reflecting updated data from voucher table [closed]
i have tow table, voucher and record. every voucher have records. when voucher is update, all records deleted and then insert. i write a insert and delete trigger on record. but in insert trigger, ...
1
vote
1
answer
32
views
Is there a way to pop up an error like 'Enter gender as M/F/T' in my trigger for multiple row insertions without affecting the correct rows?
I am creating a table of patient database where one of the columns is Gender. When the user enters the gender as Male/Female or other, I need the system to pop up the error like 'Enter gender as M/F/T'...
0
votes
1
answer
38
views
Error updating row with trigger not-null constraint
I'm using a trigger to update a tabble named tb_sign_employees with the following structure:
sign_id INT NOT NULL,
employee_id INT NOT NULL,
sign_term_in ...
0
votes
1
answer
25
views
MySQL update table column by after update trigger
I want to update _history column after other table's columns update in MySQL.
I create the below trigger:
CREATE DEFINER = `root` @`localhost` TRIGGER `update_history` AFTER
UPDATE
ON
`_users` ...
0
votes
2
answers
87
views
Google Contacts (People API) query not working in script called from trigger script
UPDATE
I've determined that this is an authentication problem. For some reason I can perform People API queries when I'm running the function from the editor, but from the trigger I get this message ...
0
votes
1
answer
15
views
LeadTrigger error: 'Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION'. How to resolve it?
I am getting the following error:
LeadTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The ...
0
votes
0
answers
7
views
How to process sound volume change as a trigger
I am trying to get my app to respond when I change the system volume and audio balance in the settings.
Is there a specific signal or trigger that I can wait for? And how can I implement it in python?
-1
votes
0
answers
44
views
"deleted" physical table preventing DELETE TRIGGER from using "deleted" pseudo table [closed]
In my client's SQL Server db, there is a physical table named "dbo.deleted". I am working on an INSERT,UPDATE,DELETE trigger that will write to and delete from a reference table ("...
-1
votes
0
answers
17
views
Mysql trigger to update the updated row error [duplicate]
When I am trying to update my table with a trigger in it this error is showing up.
0 33 22:53:31 update warriors set practise_hours = 100 where id = 9
Error Code: 4048. Invalid target for ...
0
votes
1
answer
55
views
Why are created files not owned by the final owner after transferring Google Sheets ownership using Google Apps Script?
I've developed a google spreadsheet with associated apps script, which creates files in google drive. Manifest (appsscript.json has of course been updated accordingly).
When running script, created ...
0
votes
1
answer
31
views
Error while updating a row in my SQL which has a set trigger [duplicate]
In the error console it displays :
Error Code: 1442. Can't update table 'warriors' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
This ...
1
vote
1
answer
32
views
"unsafe use of virtual table" when creating triggers for sqlite full text search (fts)
I am attempting to make use of SQLite's full text search (FTS) extension in an external content table by following the official documentation. I am running sqlite version 3.42.0 from the Arch linux ...
0
votes
1
answer
30
views
How to raise application error through trigger in Oracle SQL [closed]
Consider
table ABCD123
Having fields
is_alpha char(1) check(is_alpha in ('Y','N')),
is_alphanum char(1) check(is_alpha in ('Y','N')),
alpha varchar2(10),
no number ;
CREATE OR REPLACE TRIGGER ...
0
votes
1
answer
31
views
How to ensure total participation on one side of a many-to-many relation using SQL in Oracle?
I'm trying to enforce a restriction of a many-to-many relation with total participation on one of the sides using SQL in an Oracle database but can't figure out how.
For example, I have a set of ...
0
votes
1
answer
53
views
Azure Cosmos DB Pre-Trigger
For external reasons we can't save datetimes on the Azure Cosmos DB, so I'm trying to order the collections on the database using another approach.
So, I've created a trigger to update a field from ...
-1
votes
1
answer
18
views
How to automatically TRIGGER python to do some script when my Google sheet is updated?
I saw hell a lot of videos where we can trigger python every 10min or a specific day BUT
I cant find how to trigger python to do something when my sheet is updated, pls provide a SIMPLE solution
(*I ...
0
votes
1
answer
18
views
Can you set a triggers state within an ADF pipeline?
This is a dilemma that can be solved manually but I don't really thing that that is a good solution, I want to sleep.
I have a pipeline that is fired off by a trigger every hour, to migrate data, it ...
1
vote
0
answers
38
views
Trigger does not support scheduler job in Oracle 19c
Trigger does not support scheduler job in Oracle 19c.
I created "After Create or Alter" trigger on database to monitor and backup Oracle Database objects'(table, stored procedures, etc.) ...
0
votes
1
answer
34
views
Oracle trigger for updating table based on sum of triggering table
I have the following table data structure:
PARENT
ID TOTAL_AMOUNT
101 10
102 15
CHILDREN
ID PARENT_ID AMOUNT
201 101 6
202 101 4
203 102 10
204 102 ...
0
votes
0
answers
13
views
How can my mysql before update trigger iterate through a table's column names and get OLD/NEW.column_name values? [duplicate]
I'm trying to create a before update trigger in MySQL to automatically log any change done to employees table in the sys_logs table.
Now, since I wouldn't know in which column(s) the change is done, I ...
-1
votes
1
answer
21
views
NEW search vector
BEGIN
NEW.search_vector = ((setweight(
to_tsvector(
'pg_catalog.simple',
regexp_replace(
...
1
vote
1
answer
25
views
MySQL How to inside a Trigger, Select Multiple rows and then insert them
I am creating a "log" system and for this, trigger would be the best way to go I think. The thing is I have a header table (table1) and a line item table (table2). I created 2 new tables (...
1
vote
1
answer
32
views
PostgreSQL - Before insert Trigger function is not working and giving syntax error
I am trying to create a trigger function in my PostgreSQL as follow:
CREATE FUNCTION public.buyer_participants_pid()
RETURNS trigger
LANGUAGE 'plpgsql'
COST null
VOLATILE NOT LEAKPROOF
...
1
vote
1
answer
41
views
How to add a trigger to delete duplicates in table
Hi I have a table like this below:
[dbo].[table1](
[predictions] [int] NULL,
[timestamp] [datetime] NULL,
[train1] [int] NULL,
[train2] [int] NULL)
I'm inserting data into this table ...
0
votes
1
answer
16
views
How to create a trigger, to trigger daily but not on Sundays
How to create a trigger, to trigger daily but not on Sundays.
Hello, everyone I want to create a trigger to trigger daily everyday in the week but except on Sunday. This the code I tried it works but ...
2
votes
2
answers
71
views
UPDATE ... FROM ... inside trigger function not working as expected?
I am writing a PostgreSQL trigger function that will allow me to do an ETL transformation on a data.
I have a table with fields (id, price, EFF_FROM, EFF_TO), and if I only insert (id, price, EFF_FROM)...
0
votes
0
answers
24
views
error baseVisitor[type] is not a function
Describe the bug
Welcome,
When I try to run this code in node.js I get an error
Code:
let OriginalTitle = Manga.prototype.title;
class Manga {
name = getName()
name_ar
...
1
vote
0
answers
33
views
I need to create a trigger I'm having trouble mariadb
I need to create a trigger but I'm having trouble
CREATE TABLE `fotos`
(
`id` int(11) NOT NULL,
`foto_patch` varchar(255) NOT NULL,
`laudo_id` int(11) NOT NULL,
`check_list_foto_id` int(11) ...
-3
votes
0
answers
11
views
How do I create a MySQL trigger to automatically timestamp updates to sales figures? [duplicate]
I am supposed to add a new column sales and a new column updated, where a timestamp is automatically deposited when the sales figures are updated, but I can't get the syntax right. I tried the ...
0
votes
0
answers
11
views
Field Integrity Exception
Field Integrity Exception in the Trigger
class="{!(empty(v.simpleRecord.SR_Id__c) && (v.simpleRecord.Service_Site__c != null && v.simpleRecord.Site_Contact__c != ...
0
votes
0
answers
14
views
Zabbix. Don't show custom item when creating custom graph
On the host (which is being monitored) there is a file in which 2 values either Up or Down arrive.
The Powershell script reads the value from the file and passes it to the zabbix agent, the agent ...
0
votes
0
answers
8
views
Battery Runtime Remaining Expression in Zabbix
I'm using this expression in a trigger in Zabbix to shutdown a server when the battery runtime remaining is less than 15 minutes:
last(/xxxx UPS 3000 SNMP/battery.runtime_remaining[...
0
votes
1
answer
53
views
PostgreSQL Triggering INSERT INTO other table
I am trying to learn triggers in PGSQL 13. It seems easy but still I don't get the right result. I have two tables hist.T1 and public.T2 in two different schemas.
T1 contains three columns stream_id, ...
0
votes
0
answers
90
views
MySQL trigger inserting 0 after a view change used in the trigger
I wonder if anyone has any idea what is the reason for trigger to insert a 0 into a column after view that is used inside of it had a change. Situation is like this:
Table A has AFTER INSERT trigger =&...
0
votes
2
answers
50
views
Based on ComboBox selection, change another ComboBox to TextBox using DataTrigger inside DataGrid CellTemplate
I have one DataGrid where I am using CellTemplate to define various Data columns.
Like below
<DataGridTemplateColumn Header="Movie Source" Width="*">
<...
0
votes
0
answers
23
views
How can i use hCaptcha verification to protect a table in supabase?
In supabase:
I have a table named "ratings", this table have three columns named; "rating", "review" and "name", the "ratings" table is basically ...
0
votes
1
answer
13
views
How to get created/updated datetime field in response of list bases Airtable API
I need to run some function whenever a new base is created in airtable. I found out that airtable api support webhooks but it needs baseid for creating webhook, so i can't use it for getting ...
0
votes
1
answer
28
views
How to set a trigger in Apps Script to start from a specific time and end in a specific time
I have encountered this issue where I need to delete appointment times starting from 11:00AM to 09:00PM. Basically, the trigger should start at 11:00AM by deleting the times from the Google sheet. I ...
0
votes
1
answer
25
views
MySql and SQL before update trigger set update of different table/cloumn Can't update table in stored function/trigger
I have a connection table, which is connecting with a n:m relationship 2 tables ( A and C). The connection table (B), is holding some information as well.
A ----- B ------ C
In table A, I have a ...
1
vote
1
answer
45
views
Tracking button press and release while in the trigger
I track a button click that other objects fly through with OnPointerDown, OnPointerUp, OnTriggerStay, and OnTriggerExit. The idea is to destroy the object when passing through the button. Below is the ...
0
votes
1
answer
69
views
A temp table column not recognized in a SQL Server trigger
I want to insert a bulk of data into a temp table and process it then insert it into another table then drop the temp table.
I'm using this code
USE [fmctest]
GO
SET ANSI_NULLS ON
GO
SET ...
0
votes
1
answer
64
views
Trigger unexpectedly failing (Trailhead - Get Started with Apex Triggers)
I am attempting the challenge at https://trailhead.salesforce.com/content/learn/modules/apex_triggers/apex_triggers_intro?trail_id=force_com_dev_beginner
It says:
Create an Apex trigger
Create an Apex ...
0
votes
0
answers
65
views
something like an onkeydown event trigger but in Google Apps Script
I know you can trigger a Google Apps Script with onEdit or onChange. For instance in Google Sheets onEdit will trigger when the user hits enter or leaves a cell.
What I want is a way to do something ...
0
votes
0
answers
42
views
Lock row in postgres trigger
In a postgres AFTER INSERT trigger the called function (f) both reads and writes another row in the same table (tab).
my_trg AFTER INSERT ON tab FOR EACH ROW WHEN (some_condition) EXECUTE PROCEDURE f()...
0
votes
0
answers
29
views
how to pass and update databases with python?
I have a connection with python that brings records from a SQL Server database to one of MySQL databases. I had programmed it so that the script runs every hour and if there were any changes the ...