Back to OIM Explorer

dbo.QBM_PJobCreate_SQLDel_L

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. References QBM_PJobCreate*

Source: sandbox-db sys.sql_modules

Source size: 2.341 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
  • Object-layer bridge detected through QBM_PJobCreate helper usage.

Relations

  • References QBM_PJobCreate*

Typed Edges

  • references source dbo.QBM_FCVElementToObjectKey1 source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PDCB6A2129D7D15765BA077A_ source text reference
  • references source dbo.QBM_PJobCreate source text reference
  • references source dbo.QBM_PJobCreate_SQLDel source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL98 lines
1CREATE PROCEDURE QBM_PJobCreate_SQLDel_L(2  @TableToDelete varchar(30),3  @XObjectKeysToDelete QBM_YParameterList READONLY,4  @GenProcID varchar(38),5  @AdditionalObjectKeysAffected QBM_YParameterList READONLY,6  @isToFreezeOnError BIT = 0,7  @Retries int = 0,8  @priority int = 5,9  @Jobchainname nvarchar(256) = NULL,10  @StartAt datetime = NULL,11  @BasisObjectKey varchar(138) = N '',12  @XUser nvarchar(64) = NULL,13  @WhereClauseAdditional nvarchar(max) = '',14  @checkForExisting BIT = 0,15  @QueueName nvarchar(256) = NULL16)17AS18BEGIN19  DECLARE @Portion int20  DECLARE @PortionMax int21  DECLARE @ElementsMax int22  DECLARE @ElementsLen int23  DECLARE @AllObjectKeysIn QBM_YObjectKeyAndPortion24  SET XACT_ABORT OFF25  BEGIN TRY26    IF ISNULL(@BasisObjectKey,27    '') = ''28    BEGIN29      SELECT30        TOP 1 @BasisObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogTable',31        'UID_DialogTable',32        t.UID_DialogTable)33      FROM DialogTable t34      WHERE35        t.TableName = @TableToDelete36    END37    IF NOT EXISTS(38      SELECT TOP 1 139      FROM DialogTable40      WHERE41        TableName = @TableToDelete AND IsDeactivatedByPreProcessor = 0)42    BEGIN43      GOTO endLabel44    END45    SELECT TOP 1 @ElementsLen = len(Parameter1)46    FROM @XObjectKeysToDelete47    IF isnull(@ElementsLen,48    0) = 049    BEGIN50      GOTO endLabel51    END52    SELECT @ElementsMax = 20000 / @ElementsLen53    IF @ElementsMax > 45054    BEGIN55      SELECT @ElementsMax = 45056    END57    INSERT INTO @AllObjectKeysIn(ObjectKey,58    Portion)59    SELECT60      o.Parameter1,61      ((ROW_NUMBER() over(62    ORDER BY o.Parameter1)) / @ElementsMax) + 163    FROM @XObjectKeysToDelete o64    SELECT65      @PortionMax = max(i.Portion),66      @Portion = 167    FROM @AllObjectKeysIn i68    WHILE @Portion <= @PortionMax69    BEGIN70      EXEC QBM_PDCB6A2129D7D15765BA077A_ @Portion = @Portion,71        @AllObjectKeysIn = @AllObjectKeysIn,72        @TableToDelete = @TableToDelete,73        @GenProcID = @GenProcID,74        @AdditionalObjectKeysAffected = @AdditionalObjectKeysAffected,75        @isToFreezeOnError = @isToFreezeOnError,76        @Retries = @Retries,77        @priority = @priority,78        @Jobchainname = @Jobchainname,79        @StartAt = @StartAt,80        @BasisObjectKey = @BasisObjectKey,81        @XUser = @XUser,82        @WhereClauseAdditional = @WhereClauseAdditional,83        @checkForExisting = @checkForExisting,84        @QueueName = @QueueName85      SELECT @Portion += 186    END87  END TRY88  BEGIN CATCH89    EXEC QBM_PSessionErrorAdd DEFAULT90    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()91    RAISERROR(@Rethrow,92    18,93    1)94      WITH NOWAIT95  END CATCH96  endLabel:97  RETURN98END
Open raw exported source
SQL ยท Raw16 lines
1  create   procedure QBM_PJobCreate_SQLDel_L (@TableToDelete varchar (30) , @XObjectKeysToDelete QBM_YParameterList readOnly , @GenProcID varchar2(38) , @AdditionalObjectKeysAffected QBM_YParameterList readOnly    , @isToFreezeOnError bit = 0 , @Retries int = 0 , @priority int = 5 , @Jobchainname3 nvarchar(256) = null , @StartAt datetime = null , @BasisObjectKey varchar(138) = N'' , @XUser nvarchar(64) = null , @WhereClauseAdditional nvarchar(max4) = '' , @checkForExisting bit = 0  , @QueueName nvarchar(256) = null ) as begin declare @Portion int declare @PortionMax int declare @ElementsMax int 5declare @ElementsLen int declare @AllObjectKeysIn QBM_YObjectKeyAndPortion SET XACT_ABORT OFF BEGIN TRY if ISNULL(@BasisObjectKey, '') = '' begin select6 top 1 @BasisObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogTable', 'UID_DialogTable', t.UID_DialogTable) from DialogTable t where t.TableName = @TableToDelete7 end  if not exists (select top 1 1 from DialogTable where TableName = @TableToDelete and IsDeactivatedByPreProcessor = 0 ) begin  goto endLabel end select8 top 1 @ElementsLen = len(Parameter1) from @XObjectKeysToDelete if isnull(@ElementsLen, 0) = 0 begin goto endLabel end select @ElementsMax = 20000 / @ElementsLen9 if @ElementsMax > 450 begin select @ElementsMax = 450 end insert into @AllObjectKeysIn (ObjectKey, Portion) select o.Parameter1 , ((ROW_NUMBER() over(10 order by o.Parameter1) ) / @ElementsMax) + 1 from @XObjectKeysToDelete o select @PortionMax = max(i.Portion) , @Portion = 1 from @AllObjectKeysIn i while11 @Portion <= @PortionMax begin exec QBM_PDCB6A2129D7D15765BA077A_ @Portion = @Portion , @AllObjectKeysIn = @AllObjectKeysIn  , @TableToDelete = @TableToDelete12 , @GenProcID = @GenProcID , @AdditionalObjectKeysAffected = @AdditionalObjectKeysAffected , @isToFreezeOnError = @isToFreezeOnError , @Retries = @Retries13 , @priority = @priority , @Jobchainname = @Jobchainname , @StartAt = @StartAt , @BasisObjectKey = @BasisObjectKey , @XUser = @XUser , @WhereClauseAdditional14 = @WhereClauseAdditional , @checkForExisting = @checkForExisting , @QueueName = @QueueName select @Portion += 1 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd15 default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: return end 16