Я получаю неверный идентификатор ORA-00904 для нескольких переменных в этой хранимой процедуре, когда пытаюсь скомпилировать его в oracle, но не могу понять, почему; Все события рабочего хранилища объявляются в блоке DECLARE кода, и все переменные из схемы также определяются правильно. Кто-нибудь имел эту ошибку и / или знает, как ее исправить?
Это DDL для схемы, с которой я работаю
CREATE TABLE history
("history_id" number(4) primary key,
"history_dt" date not null,
"history_time" timestamp not null,
"booking_cost" varchar2(50) not null,
"booking_status" varchar2(50) not null
);
CREATE TABLE attendees
("attendee_id" number(8) primary key,
"attendee_name" varchar2(50) not null,
"attendee_class" number(4) not null,
"attendee_school" varchar2(50) not null,
"attendee_status" varchar2(50) not null
);
CREATE TABLE event
("event_id" number(10) primary key,
"event_name" varchar2(100) not null,
"event_location" varchar2(100) not null,
"event_size" number(4) not null,
"start_dt" date not null,
"end_dt" date not null,
"class_restriction" number(4) not null,
"school_restriction" varchar2(100) not null
);
CREATE TABLE reservation
("reservation_id" number(3) primary key,
"event" number(10) references event("event_id"),
"attendee" number(8) references attendees("attendee_id"),
"booking" number(4) references history("history_id"),
"reservation_status" varchar2(50) not null
);
Это получаемые сообщения об ошибках
Ошибка компиляции, строка 19 (15:38:10) PL / SQL: ORA-00904: «END_DT»: неверный идентификатор. Компиляция не выполнена, строка 18 (15 : 38: 10)
PL / SQL: SQL Оператор ignoredCompilation не выполнен, строка 26 (15:38:10) PLS-00302: компонент 'EVENT_ID' должен быть объявлен. Ошибка компиляции, строка 26 (15 : 38: 10) PL / SQL: ORA-00904: «БРОНИРОВАНИЕ». «EVENT_ID»: неверный идентификатор. Компиляция не выполнена, строка 26 (15:38:10)
PL / SQL: SQL Оператор ignoredCompilation не выполнен, строка 36 (15:38:10) PL / SQL: ORA-00904: «EVENT_ID»: неверный идентификаторCompilation не удалось, строка 35 (15:38:10)
PL / SQL: оператор ignoredCompilation не удалось, строка 51 (15:38:10) PL / SQL: ORA-00947: недостаточно значений. Компиляция не выполнена, строка 51 (15:38:10)
create or replace procedure Event_Planning
(arg_event_id in number, arg_student_id in number)
IS
ws_event_name varchar(100);
ws_capacity number;
ws_event_school varchar2(4);
ws_event_class number;
past_event exception;
capacity exception;
school exception;
class exception;
BEGIN
--Test for active event
select max(event_name) into ws_event_name from event
where event_id = arg_event_id and end_dt > SYSDATE;
if ws_event_name is null
then raise past_event;
end if;
--Test for capacity
select max(event_capacity) into ws_capacity from event JOIN reservation ON event.event_id = reservation.event_id
where event_id = arg_event
and event_capacity > reservation_size;
if ws_capacity is null
then raise capacity;
end if;
--Test for restricted school
select max(school_restriction) into ws_event_school from event
where event_id = arg_event_id;
if ws_event_school = arg_school
then raise school;
end if;
--Test for restricted class
select max(class_restriction) into ws_event_class from event
where event.id = arg_event;
if ws_event_class = arg_class
then raise class;
end if;
--Update reservation table
insert into reservation values
(Seq.nextval, arg_event, arg_student);
update reservation
set reservation_size = reservation_size + 1;
--Exceptions
Exception
when past_event
then raise_application_error(-20001, 'Event has passed');
when capacity
then raise_application_error(-20002, 'Event at capacity');
when school
then raise_application_error(-20003, 'Invalid school');
when class
then raise_application_error(-20004, 'Invalid class');
END;