CREATE OR REPLACE TRIGGER EProd_Tariff_Add
AFTER INSERT OR UPDATE OF Date_measurement ON Elec_Prod
DECLARE
Found_Tariff NUMBER(3)
BEGIN
-- look up matching tariff
SELECT ID_Tariff FROM E_tariffs
INTO Found_Tariff
WHERE :NEW.Date_Measurement>=E_tariffs.Date_start
FETCH FIRST 1 ROWS
-- apply update
UPDATE Elec_Prod Set ID_Tariff = Found_Tariff
END
1条答案
按热度按时间dbf7pr2w1#
根据Oracle PL/SQL语言参考,您需要的内容如下:
字符串