Why the following error (Can’t update table ‘table_b’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger) appears after i try to delete with inner join? Can i solve it? Answer I don’t see the point for a trigger here. The functionality you want can be achieved by just adding the on delete cascade
Tag: triggers
MySQL Default Record from Table
I use MySQL 5.6 and I have 3 tables. Two of them are a list of data, and the third table is used for a relationship between them. In the third table I would like to identify a default record for each id1, so I added a column named predt to let me know which record is the default one.
How to insert from old table to new table using trigger in pl/sql
There is a column which calls as text (column’s name) inside a table. I want to create different columns from this column. How to insert to another table these columns using trigger. I tried few …
Order of cascaded deletes in postgres
I encountered a problem which makes me suspect Postgres deletes rows from dependent tables (ON DELETE CASCADE) only after it already deleted the original row. I have these tables: I created a trigger (before delete) on the function_inclusion table: Let’s say I have 2 functions and a function_inclusion: When I delete the super_function: I get this error: So it seems
PostgreSQL: Inserting tuples in multiple tables using a view and a trigger
I am trying to build an order system that is able to insert a compound order that consists of multiple items and amounts. My database layout is as follows: I have an order table, containing an autoincrement id, item_id, amount and order_group_id columns. I also have an order_group table containing an autoincrement id and a person_id column. The idea is
I have a trigger on my SQL Server table which takes user updates and log them, in case we need to revert, but it has a problem
The problem is, sometimes in a day that no one is changing anything, a random user just enter the page and the trigger saves a change. The problem is, not only it logs a change that never has occurred …
TRIGGER that checks if that delete removes all the table values
Basicly I just don’t wanna allow that DELETE FROM X delete ALL rows. For example: DELETE FROM X WHERE ID = 3 OR ID = 4; –> Allowed because don’t try to remove all table. DELETE FROM X; –> Not …
How to compare and update an inserted value to existing value using a trigger?
I am learning triggers for the first time in SQL, and I am unsure of how to write/phrase a certain trigger. I am attempting to make a trigger that would check to see if a value within an attempted …
Ordering with PostgreSQL trigger when updating and inserting
I’m looking to sort the rows based on a variable. I’m pulling my hair out trying to wrap my head around this kind of trigger. I’ve only ever written triggers that gets some values from other tables. …
oracle trigger and json_value
Hi I want to store some values from :new.payload via an trigger. this works in sql-developer but not in a trigger… select json_value(‘{“timestamp”:”2019-05-09T14:00:00Z”,”value”:0,”unit”:”W/m²”}’, …