Home » SQL & PL/SQL » SQL & PL/SQL » drop and add table
drop and add table [message #3726] Tue, 15 October 2002 05:55 Go to next message
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 Go to previous message
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;
/
Previous Topic: Case Statement Conversion
Next Topic: Default Record Check
Goto Forum:
  


Current Time: Tue May 07 11:22:27 CDT 2024