Я новичок в SQL. Я застрял на этой проблеме. Я смог завершить некоторые из них, но не могу правильно ввести информацию, чтобы получить время окончания.
Вопрос: Используйте анонимную программу PL / SQL, чтобы распечатать электронную почту организатора мероприятия «Город вечеринки», а также время начала и окончания мероприятия. Используйте неявный курсор и обработайте исключение.
Вот мой прогресс:
declare
o_email varchar(70);
s_tart_time timestamp;
begin
select oemail, start_time
into o_email, s_tart_time
from organizer o, event e
where e.oid = o.oid and
ename = 'Party City';
dbms_output.put_line ('email is: ' || o_email);
dbms_output.put_line ('start time is: ' || s_tart_time);
Exception
when no_data_found then
Dbms_output.put_line('No Data Found');
END;
Таблица:
create table event
(eid int, --- event id
oid int, --- organizer id
ename varchar(50), --- event name
lid int, --- location id
start_time timestamp, -- start time of event
duration interval day to second, --- duration of event,
status int, --- 1 scheduled, 2 canceled, 3 finished
primary key(eid),
foreign key (lid) references location,
foreign key (oid) references organizer);
insert into event values (1, 1,'Party City', 1, timestamp '2018-9-6 10:00:00.00',interval '2' hour, 3);
Спасибо !!