Back to OIM Explorer

dbo.QER_ZITShopMakeDecisionEX

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. HOFireEvent -> personwantsorg.@EventName at line 13; References QBM_PJobCreate*; References QBM_PJobCreate_HOFireEvent*

Source: sandbox-db sys.sql_modules

Source size: 2.361 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

  • HOFireEvent -> personwantsorg.@EventName at line 13
  • References QBM_PJobCreate*
  • References QBM_PJobCreate_HOFireEvent*

Typed Edges

  • references source dbo.QBM_FCVIntToString source text reference
  • references source dbo.QBM_FCVStringToBit source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QER_FGIGenProcIDForPWO source text reference
  • references source dbo.QBM_PJobCreate source text reference
  • references source dbo.QBM_PJobCreate_HOFireEvent source text reference
  • references source dbo.QBM_PJobCreate_HOFireEvent_B source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL85 lines
1CREATE PROCEDURE QER_ZITShopMakeDecisionEX(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @UID_Personwantsorg varchar(38)7  DECLARE @GenProcID varchar(38)8  DECLARE @CfgUseGenProcID BIT = dbo.QBM_FCVStringToBit(dbo.QBM_FGIConfigparmValue('Common\ProcessState\UseGenProcIDFromPWO'))9  DECLARE @cond nvarchar(max)10  DECLARE @EventName nvarchar(max)11  DECLARE @BasisObjectKey varchar(138)12  DECLARE @SubLevelNumberString varchar(32)13  DECLARE @ElementBuffer QBM_YCursorBuffer14  DECLARE @ElementCount int15  DECLARE @ElementIndex int16  BEGIN TRY17    INSERT INTO @ElementBuffer(UID1,18    UID2,19    LongIdent1,20    ObjectKey1,21    Ident2)22    SELECT23      pwo.uid_personwantsorg,24      dbo.QER_FGIGenProcIDForPWO(pwo.GenProcID,25      p.GenProcID,26      @CfgUseGenProcID) AS GenProcID,27      isnull(ds.WhereClause,28      N ''),29      pwo.XObjectKey,30      dbo.QBM_FCVIntToString(ds.SubLevelNumber)31    FROM QBMDBQueueCurrent p32      WITH(readpast)33    JOIN personwantsorg pwo34      ON p.uid_parameter = pwo.uid_personwantsorg AND p.SlotNumber = @SlotNumber35    JOIN PWOHelperPWO ph36      ON pwo.uid_personwantsorg = ph.uid_personwantsorg AND pwo.decisionlevel = ph.levelnumber37    JOIN QERWorkingStep ds38      ON ph.UID_QERWorkingStep = ds.UID_QERWorkingStep39    WHERE40      ph.UID_PWODecisionRule = 'QER-PWODecisionRule-EX' AND OrderState IN('OrderProduct',41    'OrderProlongate',42    'OrderUnsubscribe') AND NOT EXISTS(43    SELECT TOP 1 144    FROM PWOHelperPWO ahe45    WHERE46      ahe.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg AND ahe.LevelNumber = ph.LevelNumber AND ahe.UID_PWODecisionRule = 'QER-PWODecisionRule-EX' AND47    ahe.Decision > ' ')48    SELECT @ElementCount = @@ROWCOUNT49    SELECT @ElementIndex = 150    WHILE @ElementIndex <= @ElementCount51    BEGIN52      SELECT53        TOP 1 @uid_personwantsorg = bu.UID1,54        @GenProcID = bu.UID2,55        @EventName = bu.LongIdent1,56        @BasisObjectKey = bu.ObjectKey1,57        @SubLevelNumberString = bu.Ident258      FROM @ElementBuffer bu59      WHERE60        bu.ElementIndex = @ElementIndex61      SELECT @cond = N 'uid_personwantsorg = ''' + rtrim(@uid_personwantsorg) + N ''''62      EXEC QBM_PJobCreate_HOFireEvent_B 'personwantsorg',63        @cond,64        @EventName,65        @GenProcID,66        @AdditionalObjectKeysAffected = DEFAULT,67        @checkForExisting = 0,68        @BasisObjectKey = @BasisObjectKey,69        @p2 = '_ParamName1',70        @v2 = 'SubLevelNumber',71        @p3 = '_ParamValue1',72        @v3 = @SubLevelNumberString73      SELECT @ElementIndex += 174    END75  END TRY76  BEGIN CATCH77    EXEC QBM_PSessionErrorAdd DEFAULT78    RAISERROR('',79    18,80    1)81      WITH NOWAIT82  END CATCH83  endLabel:84  RETURN85END
Open raw exported source
SQL ยท Raw16 lines
1    create   procedure QER_ZITShopMakeDecisionEX (@SlotNumber int) as begin  declare @UID_Personwantsorg varchar(38) declare @GenProcID varchar(382) declare @CfgUseGenProcID bit = dbo.QBM_FCVStringToBit(dbo.QBM_FGIConfigparmValue('Common\ProcessState\UseGenProcIDFromPWO')) declare @cond nvarchar(max3) declare @EventName nvarchar(max) declare @BasisObjectKey varchar(138) declare @SubLevelNumberString varchar(32) declare @ElementBuffer QBM_YCursorBuffer4 declare @ElementCount int declare @ElementIndex int BEGIN TRY insert into @ElementBuffer ( UID1 , UID2  , LongIdent1  , ObjectKey1  , Ident2 ) select 5pwo.uid_personwantsorg , dbo.QER_FGIGenProcIDForPWO(pwo.GenProcID, p.GenProcID, @CfgUseGenProcID) as GenProcID , isnull(ds.WhereClause, N'') , pwo.XObjectKey6 , dbo.QBM_FCVIntToString(ds.SubLevelNumber) from QBMDBQueueCurrent p with (readpast) join personwantsorg pwo on p.uid_parameter = pwo.uid_personwantsorg7 and p.SlotNumber = @SlotNumber join PWOHelperPWO ph on pwo.uid_personwantsorg = ph.uid_personwantsorg and pwo.decisionlevel = ph.levelnumber join QERWorkingStep8 ds on ph.UID_QERWorkingStep = ds.UID_QERWorkingStep  where ph.UID_PWODecisionRule = 'QER-PWODecisionRule-EX'   and OrderState in ('OrderProduct', 'OrderProlongate'9, 'OrderUnsubscribe')  and not exists (select top 1 1 from PWOHelperPWO ahe where ahe.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg and ahe.LevelNumber =10 ph.LevelNumber and ahe.UID_PWODecisionRule = 'QER-PWODecisionRule-EX' and ahe.Decision > ' ' ) select @ElementCount = @@ROWCOUNT select @ElementIndex 11= 1 while @ElementIndex <= @ElementCount begin select top 1 @uid_personwantsorg = bu.UID1 , @GenProcID = bu.UID2  , @EventName = bu.LongIdent1  , @BasisObjectKey12 = bu.ObjectKey1  , @SubLevelNumberString = bu.Ident2 from @ElementBuffer bu where bu.ElementIndex = @ElementIndex select @cond = N'uid_personwantsorg = '''13 + rtrim(@uid_personwantsorg) + N''''  exec QBM_PJobCreate_HOFireEvent_B 'personwantsorg', @cond, @EventName , @GenProcID , @AdditionalObjectKeysAffected14 = DEFAULT , @checkForExisting = 0 , @BasisObjectKey = @BasisObjectKey , @p2 = '_ParamName1', @v2 = 'SubLevelNumber' , @p3 = '_ParamValue1' , @v3 = @SubLevelNumberString15 select @ElementIndex += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: return end 16