Back to OIM Explorer

dbo.QER_ZPWODecisionRuleMakeProc

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.338 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.

Relations

  • No extracted relations.

Typed Edges

  • references source dbo.QER_FCVRuleGUIDToFunctionName source text reference
  • references source dbo.QBM_PDBQueueCurrentResetNGen source text reference
  • references source dbo.QBM_PFunctionDrop source text reference
  • references source dbo.QBM_PProcedureDrop source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PSQLCreate source text reference
  • references source dbo.QER_P30907EB9FB8232867B_func source text reference
  • references source dbo.QER_P30907EB9FB8232867B_proc source text reference

Complete Source

SQL117 lines
1CREATE PROCEDURE QER_ZPWODecisionRuleMakeProc(2  @SlotNumberDummy int,3  @UID_PWODecisionRule varchar(38),4  @Dummy varchar(38),5  @GenProcID varchar(38)6)7AS8BEGIN9  DECLARE @UsageArea char(1)10  DECLARE @FunctionName varchar(30)11  DECLARE @Komplett nvarchar(max)12  DECLARE @DebugSwitch int = 013  DECLARE @DebugLevel char(1) = 'W'14  DECLARE @Statements QBM_YCursorbuffer15  DECLARE @ResetMessage nvarchar(4000)16  SET XACT_ABORT OFF17  BEGIN TRY18    SELECT @FunctionName = dbo.QER_FCVRuleGUIDToFunctionName(@UID_PWODecisionRule)19    IF @DebugSwitch > 020    BEGIN21      print 'Codename ' + @FunctionName22    END23    SELECT TOP 1 @UsageArea = r.UsageArea24    FROM PWODecisionRule r25    WHERE26      r.UID_PWODecisionRule = @UID_PWODecisionRule27    IF @UsageArea IS NULL28    BEGIN29      IF @DebugSwitch > 030      BEGIN31        print 'dann gibt es diese Regel nicht (mehr), gedropt haben wir, können wir Schluß machen'32      END33      GOTO DropOnly34    END35    INSERT INTO @Statements(ContentFull,36    UID1)37    SELECT38      d.SQLQuery,39      d.UID_PWODecisionRuleRulerDetect40    FROM PWODecisionRuleRulerDetect d41    WHERE42      d.UID_PWODecisionRule = @UID_PWODecisionRule43    BEGIN TRY44      IF EXISTS(45        SELECT TOP 1 146        FROM @Statements s47        WHERE48      LEFT(ltrim(s.ContentFull), 4) = 'exec')49      BEGIN50        IF @DebugSwitch > 051        BEGIN52          print 'wir bauen das als Prozedur zusammen'53        END54        EXEC QER_P30907EB9FB8232867B_proc @Statements,55          @UsageArea,56          @FunctionName,57          @UID_PWODecisionRule,58          @Komplett OUTPUT59        IF @DebugSwitch > 060        BEGIN61          SELECT @Komplett62        END63        EXEC QBM_PProcedureDrop @FunctionName64        EXEC QBM_PSQLCreate @FunctionName,65        'P',66          @komplett,67          @UnComment = 0,68          @unformat = 069      END70      ELSE71      BEGIN72        IF @DebugSwitch > 073        BEGIN74          print 'das wird wine function'75        END76        EXEC QER_P30907EB9FB8232867B_func @Statements,77          @UsageArea,78          @FunctionName,79          @UID_PWODecisionRule,80          @Komplett OUTPUT81        IF @DebugSwitch > 082        BEGIN83          SELECT @Komplett84        END85        EXEC QBM_PFunctionDrop @FunctionName86        EXEC QBM_PSQLCreate @FunctionName,87        'F',88          @komplett,89          @UnComment = 0,90          @unformat = 091      END92    END TRY93    BEGIN CATCH94      EXEC QBM_PSessionErrorAdd DEFAULT95      SELECT @ResetMessage = ERROR_MESSAGE()96      IF @@TRANCOUNT > 097      BEGIN98        ROLLBACK99      END100      EXEC QBM_PDBQueueCurrentResetNGen @SlotNumberDummy,101        @ResetMessage,102        @@PROCID103    END CATCH104  END TRY105  BEGIN CATCH106    EXEC QBM_PSessionErrorAdd DEFAULT107    RAISERROR('',108    18,109    1)110      WITH NOWAIT111  END CATCH112  endLabel:113  RETURN DropOnly:114  EXEC QBM_PFunctionDrop @FunctionName115  EXEC QBM_PProcedureDrop @FunctionName116  RETURN117END
Open raw exported source
SQL · Raw16 lines
1      create   procedure QER_ZPWODecisionRuleMakeProc ( @SlotNumberDummy int , @UID_PWODecisionRule varchar(38) , @Dummy varchar(38) , @GenProcID2 varchar(38) ) as begin  declare @UsageArea char(1) declare @FunctionName varchar(30) declare @Komplett nvarchar(max) declare @DebugSwitch int = 0 declare3 @DebugLevel char(1) = 'W'  declare @Statements QBM_YCursorbuffer declare @ResetMessage nvarchar(4000) SET XACT_ABORT OFF BEGIN TRY select @FunctionName4 = dbo.QER_FCVRuleGUIDToFunctionName(@UID_PWODecisionRule) if @DebugSwitch > 0 begin print 'Codename ' + @FunctionName end select top 1 @UsageArea = r.UsageArea5 from PWODecisionRule r where r.UID_PWODecisionRule = @UID_PWODecisionRule if @UsageArea is null begin if @DebugSwitch > 0 begin print 'dann gibt es diese Regel nicht (mehr), gedropt haben wir, können wir Schluß machen'6 end goto DropOnly end insert into @Statements(ContentFull, UID1) select d.SQLQuery, d.UID_PWODecisionRuleRulerDetect from PWODecisionRuleRulerDetect d7 where d.UID_PWODecisionRule = @UID_PWODecisionRule BEGIN TRY  if exists (select top 1 1 from @Statements s where left(ltrim(s.ContentFull),4) = 'exec'8 ) begin  if @DebugSwitch > 0 begin print 'wir bauen das als Prozedur zusammen' end exec QER_P30907EB9FB8232867B_proc  @Statements  , @UsageArea  , @FunctionName9  , @UID_PWODecisionRule  , @Komplett output  if @DebugSwitch > 0 begin select @Komplett end exec QBM_PProcedureDrop @FunctionName exec QBM_PSQLCreate 10@FunctionName, 'P', @komplett, @UnComment = 0, @unformat = 0 end else begin  if @DebugSwitch > 0 begin print 'das wird wine function' end exec QER_P30907EB9FB8232867B_func11   @Statements  , @UsageArea  , @FunctionName  , @UID_PWODecisionRule  , @Komplett output  if @DebugSwitch > 0 begin select @Komplett end  exec QBM_PFunctionDrop12 @FunctionName exec QBM_PSQLCreate @FunctionName, 'F', @komplett, @UnComment = 0, @unformat = 0 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default13 select @ResetMessage = ERROR_MESSAGE() if @@TRANCOUNT > 0 begin rollback end  exec QBM_PDBQueueCurrentResetNGen @SlotNumberDummy , @ResetMessage , @@PROCID14 END CATCH END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: return DropOnly:  exec QBM_PFunctionDrop15 @FunctionName exec QBM_PProcedureDrop @FunctionName return end 16