I'm trying to make this happen:
declare
Contador number;
begin
ATUALIZAR_VAL_MAT_PENDENTES(Contador);
if Contador = 0 then
dbms_scheduler.disable('JOB_ATUALIZAR_VAL_MAT_PEND');
end if;
end;
When the counter returns zero, it will disable this very JOB. But, I'm getting:
"ORA-27478: o job "SPEDO.JOB_ATUALIZAR_VAL_MAT_PEND" está em execução"
This last bit means "it's executing".
So, I'm thinking this is because the job is running and it can't shut down itself.
I think that another approach could be to alter the end date, but I can't seem to find the syntax to do this.
Can anyone help? Is this achievable?