Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

oracle create program if no exists

DECLARE
    existing_program NUMBER;
BEGIN
    SELECT count(*) INTO existing_program
    FROM ALL_SCHEDULER_PROGRAMS WHERE PROGRAM_NAME = 'prog_name' AND OWNER='owner';
    IF existing_program = 1 THEN
        dbms_scheduler.DROP_PROGRAM(PROGRAM_NAME => 'prog_name');
    END IF;
END;
/
BEGIN DBMS_SCHEDULER.create_program(program_name => 'owner.prog_name', ...); END;
 
PREVIOUS NEXT
Tagged: #oracle #create #program #exists
ADD COMMENT
Topic
Name
1+5 =