
CREATE PROCEDURE dbo.P_DELETE_EMPTY_ITEXT_Q1B  
AS 
   
   BEGIN

      DECLARE
         @rec$I_NR float(53)

      DECLARE
          I_Texte CURSOR LOCAL FORWARD_ONLY FOR 
            SELECT DT037.DI025487 AS I_NR
            FROM dbo.DT037
            WHERE DT037.DI025487 IN 
               (
                  SELECT DT037.DI025487
                  /*DI025501 i_text*/
                  FROM dbo.DT037
                  WHERE DT037.DI025488 = 'DE' AND DT037.DI025501 IS NULL
               )

      OPEN I_Texte

      WHILE 1 = 1
      
         BEGIN

            FETCH I_Texte
                INTO @rec$I_NR

            IF @@FETCH_STATUS = -1
               BREAK

            DELETE dbo.DT037
            WHERE DT037.DI025487 = @rec$I_NR

         END

      CLOSE I_Texte

      DEALLOCATE I_Texte

      IF @@TRANCOUNT > 0
         COMMIT WORK 

   END
GO
