oracle create program if no exists

Solutions on MaxInterview for oracle create program if no exists by the best coders in the world

showing results for - "oracle create program if no exists"
Maria José
26 Oct 2019
1DECLARE
2    existing_program NUMBER;
3BEGIN
4    SELECT count(*) INTO existing_program
5    FROM ALL_SCHEDULER_PROGRAMS WHERE PROGRAM_NAME = 'prog_name' AND OWNER='owner';
6    IF existing_program = 1 THEN
7        dbms_scheduler.DROP_PROGRAM(PROGRAM_NAME => 'prog_name');
8    END IF;
9END;
10/
11BEGIN DBMS_SCHEDULER.create_program(program_name => 'owner.prog_name', ...); END;