Questions tagged as 'trigger'

1
answer

Get the sql that triggers a trigger before update

I have a very simple trigger before update, I would like to get the sql that triggers that trigger. CREATE OR REPLACE TRIGGER atualiza_subelemento BEFORE UPDATE ON tb_material FOR EACH ROW BEGIN IF :OLD.CD_SUBELEMENTO IS NOT NULL THEN DBMS_OUT...
asked by 07.11.2018 / 14:51
1
answer

Error executing a Trigger

I'm having the following error when executing my trigger, how could I resolve it? ERROR The error when I insert insert into the product-purchase table to calculate total INSERT into purchase_product (CPR_CODIGO, PRO_CODIGO, CPP_QTDE, CP...
asked by 10.09.2018 / 21:49
2
answers

Trigger automatically locks the table (LOCK TABLE)?

About TRIGGER in any table: Does TRIGGER lock (LOCK) the table until the end of its execution? If not, when should I block it? How do I block this?
asked by 27.08.2018 / 15:29
1
answer

SQL Server - Trigger does not execute after a given field

I have the trigger below: CREATE TRIGGER AtualizaDataAlteracaoSegmentos ON dbo.Segmentos AFTER INSERT,UPDATE AS BEGIN Begin tran update Segmentos set DataAlteracao = GETDATE() where Id = (select ID from inserted);...
asked by 17.07.2018 / 19:16
1
answer

Trigger with sum between dates

Good Night, I need help that I can not get, 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' decimal(10,2) DEFAULT NULL )...
asked by 12.05.2018 / 01:01
1
answer

Insert record automatically when doing Insert PL / SQL

I'm starting to mess with the PL / SQL database and I'm having a hard time creating a trigger that when inserting a row in the table, put a value in my column whose name is token . I made a code with what I know from DB , but when I ru...
asked by 02.04.2018 / 23:00
2
answers

Error in trigger - MySql

I created the following trigger, but it has a syntax error that I can not find. The error is as follows    ERROR 1064 (42000): You have an error in your SQL syntax; check the   manual that corresponds to your MariaDB server version for the...
asked by 13.11.2017 / 20:18
1
answer

Concatenate an SQL value

I have a trigger that updates a particular raw table, but it replaces the existing quantity and I need it to concatenate the new value with the existing value, could someone help me how to do this? create trigger trg_atualizaEstmatprim after u...
asked by 01.07.2017 / 23:22
1
answer

Help with Trigger that adds / subtracts

I need help to create a Trigger in SQL Server that takes a value INTEIRO , and two STRING(FK) , inserted in a tabela X , and check if the second value is 1 or 2 , if for 1 it must add this value INTEIRO...
asked by 01.07.2017 / 05:25
1
answer

create trigger mysql

I have two tables: the table requests and the table logs. Users can interact with the requests table, via a php script that runs a query update and updates the status column. I need to create a trigger that, when running this query update, save...
asked by 22.05.2017 / 16:47