Questions tagged as 'trigger'

0
answers

Problem with Mysql grouping within a trigger

I have the following trigger code, where it makes a select in the main tables (DADF311, DADF313 ..) to insert the ready result into the secondary table (DADF514): DELIMITER $$ CREATE TRIGGER ta_dadf311 AFTER INSERT ON dadf311 FOR EACH ROW BEG...
asked by 12.09.2018 / 14:35
0
answers

How to update data from another table using a trigger

I'm trying to register a product in a cart, every time it is registered it means that it was bought, so whenever this happens I want to decrease the quantity in the stock, I tried with the trigger below, but it did not work: p> DELIMITER $$ CRE...
asked by 10.06.2018 / 00:36
2
answers

Create a Sequence, through a trigger. Oracle

I'm trying to create a sequence in a trigger . When trying to create by Execute Immediate , I'm having the following return:    ORA: 4092 - Can not commit in a trigger. For all I've ever researched, using Execute...
asked by 16.04.2018 / 21:07
1
answer

How to delete records automatically with postgreSQL?

Recently get a project that is about a blog, the user will hold the posts of various news, however I am using the server Heroku with the free account that entitles there are only 512 Megas of space, above that limit it starts charging. At t...
asked by 27.02.2018 / 13:59
1
answer

Insert with random characters - PostgreSQL

I have a function that does an insert when a given action occurs, I am trying to insert random letters together but I am not finding anything related to this, Is it possible to do this in Postgresql?     
asked by 02.02.2018 / 17:35
1
answer

FireBird and MySQL

I'm developing a web system, I need to fetch data from a table, the data is in Firebird but I need to replicate it to a mysql database with every insert made in Firebird. Case: There is an existing system using Firebird, which I can not use, so...
asked by 04.01.2018 / 00:10
1
answer

How to cancel an INSERT trigger event?

Hello, I created a trigger that every time the user makes a sale is debited the amount of items, but if I do not take care the amount can be negative because the user can sell more than he has in the database. So I need a trigger that does not I...
asked by 01.01.2018 / 17:58
1
answer

Triggers - I need help solving the question below

I have the following situation: Thetablesdescribedabovearerespectivelyger_usuario,ger_mensagemandger_destinos.Thefieldproprietario(ger_mensagem)isaFOREIGNKEYreferringtotheger_usuariotable.Thefieldid_destino(ger_mensagem)isaFOREIGNKEYreferr...
asked by 02.12.2017 / 04:16
1
answer

Update an attribute according to two other tables

Company Table CREATE TABLE empresa ( cnpj char(18) PRIMARY KEY, nome varchar(60) NOT NULL UNIQUE, receita float NOT NULL, pais_sede varchar(26) NOT NULL ); Target table CREATE TABLE destino( cidade...
asked by 30.11.2017 / 01:33
1
answer

Wrong trigger update in Oracle

I have the following problem in the trigger, When there is an INSERT in the table TB_DJE_PREPUBLICACAO, it has to be checked if the column DT_DISPONIBILIZACAO is null if it is and if the column DT_PREPUBLICACAO is with the current date, the D...
asked by 14.09.2017 / 20:19