2012-12-24 49 views
0

下面是我創建的dbms_scheduler,根據我創建的作業,它必須從empp表中刪除員工「simon」,當時我提到,程序已成功執行,但行沒有被刪除,請幫我解決。調度作業沒有發生在dbms_scheduler

begin 
dbms_scheduler.create_job 
(job_name => 'test_full_job_def', 
job_type => 'PLSQL_BLOCK', 
job_action=> 
    'begin 
    delete from empp where NAME="simon"; 
    commit; 
    end;', 
    repeat_interval => 'FREQ=DAILY; BYHOUR=13; BYMINUTE=30', 
    enabled=>true, 
    auto_drop=>false, 
    comments=>'Delete simon matches from the empp table'); 
end; 

在此先感謝

+0

表名,EMPP,這是正確的拼寫? –

+3

你的引用「西蒙」看起來像雙引號「 - 你可以檢查他們實際上是單引號逃脫ie'和'彼此相鄰 –

+0

彼得勳爵是正確的。你有雙引號在這裏」西蒙「,你必須使用'simon' –

回答

0

請嘗試使用此代碼

begin 
dbms_scheduler.create_job 
(job_name => 'test_full_job_def', 
job_type => 'PLSQL_BLOCK', 
job_action=> execute immediate('delete from empp where NAME='simon''), 
    repeat_interval => 'FREQ=DAILY; BYHOUR=13; BYMINUTE=30', 
    enabled=>true, 
    auto_drop=>false, 
    comments=>'Delete simon matches from the empp table'); 
end;