Skip to content
Advertisement

identifier ‘NEW.CITY_POPULATION’ must be declared

I am trying to declare a oracle trigger that will update the city name when the city population reaches 0 but I am getting this error.

Advertisement

Answer

  1. If you’re going to reference the :new pseudo-record in a trigger body, it needs to be prefixed with a colon.
  2. A trigger on cities generally cannot query the cities table. In this case, it appears that you want to modify the data in the row the trigger is firing for so you’d just want to update the :new pseudo-record.
  3. Since you want to modify the row that caused the trigger to fire, you’ll want it to be a before update trigger.

When we make those changes, you’ll end up with something like this

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement