I am attempting to write out in my SQL commands for Oracle Apex 5, and I cannot see why I'm getting an error. Also, a popup window appears once I submit asking to 'Enter Bind Variables'
for ':NEW'
? Isn't it already declared?
drop table tmpcapacityguide cascade constraints;
drop table tmpcaravanpark cascade constraints;
create table tmpcaravanpark as select * from Caravan_park;
create table tmpcapacityguide
(mincap number(3),
maxcap number(3));
insert into tmpcapacityguide values(30, 150);
CREATE OR REPLACE TRIGGER "PARK_CAPACITY_CHECK"
before insert or update of capacity
on Caravan_park
for each row
when (:new.capacity < 30) DECLARE
mincapacity integer;
maxcapacity integer;
begin
select mincap, maxcap
into mincapacity, maxcapacity
from tmpcapacityguide
where capacity = :new.capacity;
if (new.capacity < mincapacity)
then raise_application_error(-20601, 'Capacity must be between 30 and 150');
end if;
end;