magesh manavalan

magesh manavalan

  • NA
  • 331
  • 507.2k

Conversion Sql to Oracle

Jul 22 2015 11:55 PM
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 ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER TRIGGER [dbo].[Customer_Table_Audit_Trigger]

ON [dbo].[S3G_ORG_CustomerMaster]

For update,DELETE

AS

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