PROMPT Pokrenuta skripta sustav_not_published.sql

DECLARE
  naredba_l VARCHAR2 (2000);
  pomocna_l NUMBER;
BEGIN
  SELECT COUNT(1) INTO pomocna_l
    FROM all_tab_columns
   WHERE UPPER (table_name) = 'USER_ORDS_MODULES';
  BEGIN
    IF pomocna_l = 0 THEN
      DBMS_OUTPUT.PUT_LINE ('Sustav nema ORDS.');
      RETURN;
    ELSE
      naredba_l :=
        'BEGIN
          FOR c IN (SELECT name, status FROM user_ords_modules) LOOP
            DBMS_OUTPUT.PUT_LINE (''Sustav na OFF: '' || c.name || '' status: '' || c.status);
            ords.publish_module (c.name, ''NOT_PUBLISHED'');
          END LOOP;
         END;';

      EXECUTE IMMEDIATE naredba_l;
    END IF;
  END;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE ('Error: ' || SQLERRM);
    COMMIT;
END;
/
