
CREATE PROCEDURE dbo.P_DELETE_EMPTY_ITEXT_Q2B  
AS 
   BEGIN

      DECLARE
         @rec$I_NR float(53)

      DECLARE
          I_Texte CURSOR LOCAL FORWARD_ONLY FOR 
            SELECT DT435.DI001538 AS I_NR
            FROM dbo.DT435
            WHERE DT435.DI001538 IN 
               (
                  SELECT DT435.DI001538
                  /*DI001549 i_text*/
                  FROM dbo.DT435
                  WHERE DT435.DI001550 = 'DE' AND DT435.DI001549 IS NULL
               )

      OPEN I_Texte

      WHILE 1 = 1
      
         BEGIN

            FETCH I_Texte
                INTO @rec$I_NR

            IF @@FETCH_STATUS = -1
               BREAK

            DELETE dbo.DT435
            WHERE DT435.DI001538 = @rec$I_NR

         END

      CLOSE I_Texte

      DEALLOCATE I_Texte

      IF @@TRANCOUNT > 0
         COMMIT WORK 

   END
GO
