判断是否存在,如果不存在,再创建:
declare viewExist number;
begin
select count(1) into viewExist from user_views where VIEW_NAME='REPORT_APPOINTMENTSBYLOCATORS';
if viewExist=0 then
execute immediate
'CREATE VIEW REPORT_APPOINTMENTSBYLOCATORS
AS
SELECT appointmentID, startDateTime, endDateTime, grid, locator,
meetingAddress, contactNumber, company, contact, reasonForAppointment,
DtFirstCall, DtSecondCall,CustomerAnswerFirstCall, CustomerAnswerSecondCall,
IsMeetOnSite, DtLastModified, AppointmentStatus, IsLocatorArriveOnsite,
DtCompletedAt,DtLocatorArriveOnsite, RescheduledOn, RescheduledAt, IsRescheduled, city
FROM Appointment';
end if;
end;