Most voted "trigger" questions
A database server is a code of procedure executed automatically in response to certain events in a given table or view in a database.
Learn more…211 questions
Sort by count of
-
0
votes1
answer135
viewsWhat’s wrong with Rigger?
I have this table: create table alecrim( id_alecrim int not null auto_increment, sem_epi int not null, p1 smallint, p2 smallint, p3 smallint, p4 smallint, p5 smallint, p6 smallint, p7 smallint, p8…
-
0
votes3
answers2912
viewsCreate Trigger with update setando field through a function
I’m looking to use a trigger to update the field of a table whenever there is an Insert in this same table. The problem I’m having at Trigger is that the update doesn’t work, it follows Trigger:…
-
0
votes2
answers75
viewsWhy are you making this mistake and how do I reverse it?
I have this table: create table lagoa_azul( id_lagoa_azul int not null auto_increment, sem_epi int not null, p1 smallint, p2 smallint, p3 smallint, p4 smallint, p5 smallint, p6 smallint, p7…
-
0
votes2
answers358
viewsTrigger to Retrieve Last Record Inserted in PL-SQL Table
I have a Rigger that after being inserted a new user in the table tFunctioning I must fill another table tPlanoSaude with the data of the employee. employee table table Health Plan Code of the…
-
0
votes1
answer31
viewsHow to ban a DDL action on oracle
I want to do a Rigger that prohibits any DML operation on a given table. In case these are the parameters: between 20:00 to 06:00, and Sunday all day. CREATE OR REPLACE TRIGGER TG_HORARIO BEFORE…
-
0
votes1
answer87
viewsHow to update to a column of another table automatically when doing an update using Trigger?
CREATE TABLE TB_Empregado( nome varchar(50), rg int primary key, cpf varchar (11), salario money ) --- CREATE TABLE TB_Dependente( rg_responsavel int constraint fk_TB_Dependente_Empregado references…
-
0
votes0
answers232
viewsERROR 1442 - Trigger AFTER INSERT - Mysql
My database has the following structure: CREATE TABLE BAIRRO ( BAI_COD INT(4) AUTO_INCREMENT NOT NULL, BAI_NOME VARCHAR(200)NOT NULL, CONSTRAINT PK_BAIRRO PRIMARY KEY(BAI_COD) ); CREATE TABLE…
-
0
votes1
answer23
viewsTriggers for date verification
I’m having a question! I have a schedule of contracts and wanted to update the field of data_exclusao for the current date each time the field data_inicio is possible through triggers? I’m a…
-
0
votes1
answer364
viewsAdd value to a variable in the mysql table
I have a Rigger, whenever a value is added to the table in mysql I take the old value(OLD) and add to another table, but I would like to improve this by adding the values to the same table but…
-
0
votes1
answer52
viewsOracle character count trigger
Hello, I need to know how to create a trigger in the Oracle database for you to monitor a insert or update in an NCM field of a product so that it is not less than 8 characters, follows example…
-
0
votes1
answer96
viewsMysql Trigger syntax error
I tried to create the Trigger below in phpMyAdmin, but returns the following error: Messages from Mysql : 1064 - You have a syntax error in your SQL next to '' on line 4 Someone’s been through it or…
-
0
votes0
answers34
viewsCursor with Postgresql
I have here a table of proceedings that activates a Trigger when a new procedure is recorded. In my case, when someone generates a process for a request that has been returned the system must…
-
0
votes1
answer919
viewsInsert record automatically when doing a PL/SQL insert
I’m starting to mess with databases PL/SQL and I’m having a hard time creating a Trigger when inserting a row in the table, the Trigger place a value in my column whose name is token. I made a code…
-
0
votes1
answer41
viewsCreate mysql user in Trigger
I need that after being registered a new person in the table Trigger be fired and create a new user in the database with the data name and password of the registered record. I tried with several…
-
0
votes0
answers32
viewsCreate trigger to delete old Mysql data
Good morning. have a table "data" in this table are saved various information like 'user_id' and 'time'; I would like to create a trigger for when entering a new data delete the older than 90 days.…
-
0
votes1
answer289
viewsTrigger with sum between dates
Good evening, I need a help I’m not getting, I have two tables in my db. 1 - Portfolio table composed of: CREATE TABLE `carteira` ( `id` int(11) NOT NULL, `datat` datetime DEFAULT NULL, `vl_cliente`…
-
0
votes0
answers120
viewsTrigger creates duplicate records
Mysql "update" Trigger creates 8 records each update. The first record is the old one, the next seven are copies of the change. As I leave only the old and the edited? I tried to put UNIQUE key on…
-
0
votes1
answer41
viewsError creating Trigger with more than one table
I’m having trouble creating a Trigger that modifies more than one table. DROP TRIGGER IF EXISTS vendedor_pago; DELIMITER $$ CREATE TRIGGER vendedor_pago AFTER UPDATE ON parcelas FOR EACH ROW BEGIN…
-
0
votes3
answers405
viewsTrigger that inserts automatic value in a record
Good afternoon, guys. How are you? I’m trying to create a Rigger that when performing a partner registration it automatically marks that the partner is a client. In the database, this field is…
-
0
votes1
answer361
viewsTrigger to fill table with data from another table
I want to fill a table with the data being placed in another. CREATE TRIGGER `trg_jogo`AFTER INSERT ON `tabela1` AS INSERT INTO `tabela2` SELECT * FROM `tabela1`; I cannot do the process to copy the…
-
0
votes1
answer72
viewsTrigger and another field
In postgres I have two tables, Test1(id_test1,name) and test2(id_test2, test1_id_test1, phone) In the PHP form I have the field name and phone. When I write name in Test1, a Trigger replicates the…
-
0
votes1
answer339
viewsTrigger Problem After Update with Mysql Internal Update
I am creating a Trigger in mysql, Trigger is created but when I update the flag to test mysql returns me this error ERROR 1442 (HY000): Can't update table 'aux_Batelada' in stored function/trigger…
-
0
votes0
answers25
viewsWhat happens when an after Insert or after update Rigger fails?
I have a question about triggers. If there is an after Insert or after update Rigger and this Rigger has an SQL routine that cannot be executed or it fails what happens to the updated record /…
-
0
votes0
answers15
viewsTrigger Count Insert and delete
I have a problem in a Rigger that I have here, I want this Rigger after counting and inserting in table x, it deletes the value he searched in table y, can make him count and insert but I’m not able…
-
0
votes1
answer2766
viewsError while running a Trigger
I’m having the following error while running my Rigger, how could I resolve? ERROR Error when I give Insert in the purchasing table INSERT into compra_product (CPR_CODIGO, PRO_CODIGO,CPP_QTDE,…
-
0
votes1
answer279
viewsHow to create a TRIGGER for an INSERT event without causing a lock in the Sqlserver table
Hello, I am doing the integration between 2 solutions, where I need to detect the change of a table, and, based on the information that is sent I must manipulate another table. I don’t have access…
-
0
votes0
answers17
viewsPython problem in postgres on MAC
Guys, I’m testing Trigger functions with python on Postgres and I’m having problems when I go to test on my Mac. Follow the function: create function sendchange() returns trigger as $$ import…
-
0
votes1
answer538
viewsHow can I make a trial to update the balance in postgres?
Mine has been giving an error that I can not understand talking q is wrong in $, but when I used another example internet trial almost in the same way as mine worked, then the mistake is being on…
-
0
votes0
answers308
viewsSQL - Trigger to send email when updated
Good morning, I need help next time: I have a Trigger to email when an update is performed, but I have a problem! Whenever the table has update is an entire grid that is loaded and sends emails to…
-
0
votes0
answers131
viewsCreate Mysql Trigger with input condition
Hello, I’m doing a credit card system and I created a column with the types of card using ENUM('bronze', 'silver', 'gold'), now I want to create a Rigger so that when the user enters with the type,…
-
0
votes1
answer45
viewsProblem with update in Trigger
I can not update the table due to Trigger the goal of it is to store the information of the changed record, so I wanted to know if the problem is in Foreign key(FK), if in that case I would have to…
-
0
votes2
answers325
viewsHow to insert data into another database with Linked Server
Good afternoon! How do I create a trigger that uses a Linked Server to insert the INSERTED data in another table that is in another database, this in another server? Trying to Exemplify: CREATE…
-
0
votes0
answers40
viewsIncrease the number of vehicles with Trigger
I have the table pessoa who has the spine qtd_veiculos, every time I give one insert with a new vehicle, which has the CPF foreign_key same as some person at the table pessoa, this column should be…
-
0
votes1
answer138
viewsTrigger which arrow default value for a field
follows the statement: If the employee department code is not Insert or if it does not exist in the table , assign to it the value standard 20; And I made the following code: create or replace…
-
0
votes1
answer22
viewsCreation of Trigger to help add a field according to an operation
Good colleagues. I have the following problem, I need when a loan insertion action is triggered to the table emp_emprestimo automatically update to the table called genero_frequencia_emprestimos…
-
0
votes0
answers22
viewsSyntax error, Mysql trigger executed by php
Could someone please tell me where I’m going wrong with my Rigger’s creation Trigger $sql = "DELIMITER $$ CREATE TRIGGER produtos_movto_insert AFTER INSERT ON produtos_movto FOR EACH ROW BEGIN IF…
-
0
votes0
answers36
viewsI need some help in Trigger
So folks I’m needing a little help on some Mysql activities related to Trigger, basically it’s three Trigger. First Trigger should work after an update or Insert(something I’ll still put) the…
-
0
votes2
answers322
viewsInsert a Count(*) value into a variable in Postgresql
I am migrating from Mysql to Postgresql and trying to create the following Trigger: CREATE OR REPLACE FUNCTION verificaReservaQuarto() RETURNS trigger AS $$ begin declare ocupado int; declare…
-
0
votes1
answer58
viewsConditional Postgresql
I’m new to the database and I could use a little help creating Rigger. I’m making a system where the user can open calls, I created a Rigger and need it to fire only when the type of call is…
-
0
votes0
answers78
viewsI need to create a Mysql Trigger to create a table with the name containing the id of the last row inserted in another table
I would like every time a row was inserted into the chats table, a new table was created. The Table must have the name of the value inserted in the chat_id column of the chats table. Ex: If the last…
-
0
votes0
answers52
viewsTrigger that calculates the resale value of the product has no expected effect in table
I created a Mysql Rigger that calculates the price of a garment with the calculation of 50% profit on the purchase value of the product. Only nothing appears in the place where I wanted the…
-
0
votes1
answer30
viewsCan I not use a Trigger correctly in MYSQL?
delimiter // CREATE TRIGGER inventory_update_purchases AFTER INSERT ON purchases FOR EACH ROW BEGIN UPDATE products SET products.inventory = products.inventory + NEW.inventory_bought WHERE…
-
0
votes0
answers264
viewsDeclare variables in a Trigger in mysql
I am creating a Trigger in mysql with use of variables and this returning me an error and as I am starting to use mysql now I could not solve the problem, follows the error: Executing: DROP TRIGGER…
-
0
votes1
answer52
viewsTrigger Insert in the same table
Hello, I have a table where I keep records of movements, it is inserted a record where it is possible to inform a payment installment, for example, a purchase made in 12 times whose current…
-
0
votes0
answers17
viewsPostgresql - Automatic date return from another data field
good afternoon! I’m trying to create a Rigger that returns the automatic date from another date field. Type insert in one field this date and in the other return 730 days ahead. In this case, I have…
-
0
votes0
answers30
viewsAdd, update, or delete data from a column by adding, updating, or even deleting data from another column:
Hello! I am starting in Java programming and also in Oracle SQL and I have a problem: I need a particular record of a column of a table to be updated, added or removed from a column of another…
-
0
votes0
answers28
viewsTrigger with mutant error even using Pragma Autonomous_transaction;
I’m a beginner and I’m having trouble solving a simple problem: I created Trigger below: AFTER INSERT OR UPDATE ON CARRO FOR EACH ROW DECLARE Pragma Autonomous_Transaction; V_REFERENCIA INT; BEGIN…
-
-1
votes1
answer557
viewsDelete on an UPDATE Trigger
How can I delete a record that is being entered in a specific condition in a Rigger? example: USE `scompraslenovo`; DELIMITER $$ CREATE TRIGGER `precad_fornecedor_BUPD` BEFORE UPDATE ON…
-
-1
votes1
answer84
viewsTrigger cursor in book allocation
Well, I have a table called LOCACAO_LIVRO in it I have BOOK and CLIENT information when an allocation update occurs then the id_client will be informed, id_book, the data_de_output and from this…
-
-1
votes1
answer1596
viewsMYSQL - Error Code: 1451. Cannot delete or update a Parent Row: a Foreign key Constraint fails
I have to make a Rigger, where when being excluded an employee will also be excluded his dependent. But I can not delete. the code was like this: delimiter $ create trigger TRG_excluiDependente_AD…