Oracle - Problem creating trigger that updates another table

前端 未结 2 1571
生来不讨喜
生来不讨喜 2021-01-21 01:06

I\'ve read the Oracle docs on creating triggers and am doing things exactly how it shows, however this just isn\'t working. My goal is to update the TPM_PROJECT table with the

2条回答
  •  误落风尘
    2021-01-21 01:14

    As Justin Cave have suggested, you can calculate the minimum start date when you need it. It might help if you create an index on (projectid, startdate);

    If you really have a lot of projects and training plans, another solution could be to create a MATERIALIZED VIEW that has all the data that you need:

    CREATE MATERIALIZED VIEW my_view
    ... add refresh options here ...
    AS
    SELECT t.projectid,  MIN(t.start_date) AS min_start_date
    FROM TPM_TRAININGPLAN t
    GROUP BY t.projectid;
    

    (sorry, don't have Oracle running, the above code is just for the reference)

提交回复
热议问题