
CREATE PROCEDURE dbo.P_DELETE_EMPTY_ITEXT_Q3B  
AS 
   BEGIN

      DECLARE
         @rec$I_NR float(53)

      DECLARE
          I_Texte CURSOR LOCAL FORWARD_ONLY FOR 
            SELECT DT545.DI010261 AS I_NR
            FROM dbo.DT545
            WHERE DT545.DI010261 IN 
               (
                  SELECT DT545.DI010261
                  /*DI025501 i_text*/
                  FROM dbo.DT545
                  WHERE DT545.DI010262 = 'DE' AND DT545.DI010275 IS NULL
               )

      OPEN I_Texte

      WHILE 1 = 1
      
         BEGIN

            FETCH I_Texte
                INTO @rec$I_NR

            IF @@FETCH_STATUS = -1
               BREAK

            DELETE dbo.DT545
            WHERE DT545.DI010261 = @rec$I_NR

         END

      CLOSE I_Texte

      DEALLOCATE I_Texte

      IF @@TRANCOUNT > 0
         COMMIT WORK 

   END
GO
