drop and add table [message #3726] |
Tue, 15 October 2002 05:55 |
Alexander
Messages: 109 Registered: May 2000
|
Senior Member |
|
|
I have the following Transact-sql script and need to convert it to Pl-sql...
Could anyone change the syntax... Thanks.
***************************** code ******************
Create Procedure sp_AddPatientAccessLog_ins
as
if exists (select * from sysobjects where id = object_id(N'[[dbo]].[[PatientAccessLog]]')
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [[dbo]].[[PatientAccessLog]]
Create Table PatientAccessLog
(
PatientAccessLogSequenceNumber int NOT NULL,
UserDate datetime NULL,
UserName varchar(20) NULL
)
|
|
|
Re: drop and add table [message #3735 is a reply to message #3726] |
Tue, 15 October 2002 09:40 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
create or replace procedure sp_AddPatientAccessLog_ins
as
begin
begin
execute immediate 'drop table patientaccesslog';
exception
when others then
null; -- if it doesn't exist, just ignore the error
end;
execute immediate 'create table ...';
end;
/
|
|
|