This statement can be used with any interactive tool, such as SQL*Plus or Enterprise Manager.
When using an interactive tool, a single slash (/) on the last line is necessary to activate the 0) DECLARE sal_diff number; BEGIN sal_diff := :- :old.sal; dbms_output.put('Old salary: '
CREATE TABLE folders ( id NUMBER NOT NULL, name VARCHAR2(100) NOT NULL, bytes NUMBER DEFAULT 0 NOT NULL, parent Id NUMBER, CONSTRAINT pk_folders PRIMARY KEY (id), CONSTRAINT fk_folders_parent FOREIGN KEY(parent Id) REFERENCES folders(id) ); CREATE TABLE files ( id NUMBER NOT NULL, name VARCHAR2(100) NOT NULL, bytes NUMBER DEFAULT 0 NOT NULL, folder Id NUMBER NOT NULL, CONSTRAINT fk_folders FOREIGN KEY (folder Id) REFERENCES folders(id) ); There are also row triggers on the files table to update the bytes column of the folder when a row in files is inserted, deleted, or updated.
It does not "see" the new record because the record has not been committed so the update comes back with 0 rows updated.
It might be better include the logic in the trigger itself.
(If I got this wrong and your question is indeed about Oracle database, please edit your question to remove the My SQL tag and put the Oracle tag back in.)The idea of trigger is not to do an additional update of the table but to adjust the values so that we do additional things with one UPDATE. Do you really need to increment C2 column of all rows when C1 of one row becomes 0?
I am trying to implement a type 2 slowly changing dimension in a PG data warehouse using a trigger function.