How to Convert Sql to Oracle: The Bellow Query
USE
[S3G_Dev_Ver_1.0]GO
/****** Object: Trigger [dbo].[Customer_Table_Audit_Trigger] Script Date: 07/23/2015 09:12:27 ******/
SET
ANSI_NULLS ONGO
SET
QUOTED_IDENTIFIER ONGO
ALTER
TRIGGER [dbo].[Customer_Table_Audit_Trigger] ON [dbo].[S3G_ORG_CustomerMaster] For update,DELETEAS
BEGIN
if
exists(select 'x' from S3G_SYSAD_GlobalParameterSetup where Is_Audit=1)begin
Declare @Ins nvarchar(max) Declare @Upd nvarchar(max) Declare @Company_ID INT Declare @Program_ID INT Declare @Location_Code Varchar(30) Declare @User_ID INT Declare @Table_Name Varchar(200) Declare @LookUp_Text Varchar(300)
--select * from inserted --select * from deleted
set @Ins=(select * from inserted for xml auto, ROOT('Root')) set @Upd = (Select * from Deleted for XML Auto, ROOT('Root')) if(@Ins is not null) begin Select @Company_ID=1,@User_ID=(select isnull(Modified_by,0) from Inserted)
select @Table_Name= obj.name from sys.triggers trig inner join sysobjects obj on trig.parent_id=obj.id where trig.object_id=@@procid
select @Program_ID= Program_ID from S3G_AT_Lookup_Hdr where SRC_Table_name=@Table_Name Exec S3G_Ins_Audit_Trail @XML_Inserted=@Ins,@XML_Deleted=@Upd,@Table_Name=@Table_Name,@Company_ID=@Company_ID,@Program_ID=@Program_ID,@Location_Code=@Location_Code,@User_ID=@User_ID end end
END
Thanks
Replies
Know the answer? Post it — somebody with the same question will find it here.