我要按照时间调用一个触发器比如12点,而这个触发器调用一个存储过程来实现对数据库中表的操作?

解决方案 »

  1.   

    应该是用Job来调用Procedure吧(定时执行Job)
    Trigger好像还没有这个功能吧 呵呵
      

  2.   

    搞错了,应该是触发器调用存储过程,能否给一个具体的例子,我已经有了存储过程,怎么样调用这个存储过程 declare 
    charge1 binary_integer; 
    begin 
    dbms_Job.submit(charge1 ,'grade_com;',to_date('06-09-2004 00:00:00',   'dd-mm-yyyy hh24:mi:ss'),'sysdate+1'); 
    end; 
    那么,我应该在哪里运行我的这一段程序呢,把它写成一个触发器?我要的是按照系统时间,而不是每次我都手动执行啊?
      

  3.   

    你上面写的不叫触发器,叫Job;
    DBMS_JOB.SUBMIT ( 
       job       OUT BINARY_INTEGER,
       what      IN  VARCHAR2,
       next_date IN  DATE DEFAULT sysdate,
       interval  IN  VARCHAR2 DEFAULT 'null',
       no_parse  IN  BOOLEAN DEFAULT FALSE,
       instance  IN  BINARY_INTEGER DEFAULT any_instance,
       force     IN  BOOLEAN DEFAULT FALSE);
    =========================================================================
    Parameter Description 
    =========================================================================
    job
     Number of the job being run.
     
    what
     PL/SQL procedure to run.
     
    next_date
     Next date when the job will be run.
     
    interval
     Date function that calculates the next time to run the job. The default is NULL. This must evaluate to a either a future point in time or NULL.
     
    no_parse
     A flag. The default is FALSE. If this is set to FALSE, then Oracle parses the procedure associated with the job. If this is set to TRUE, then Oracle parses the procedure associated with the job the first time that the job is run. For example, if you want to submit a job before you have created the tables associated with the job, then set this to TRUE.
     
    instance
     When a job is submitted, specifies which instance can run the job.
     
    force
     If this is TRUE, then any positive integer is acceptable as the job instance. If this is FALSE (the default), then the specified instance must be running; otherwise the routine raises an exception.
     
    你要是再不懂我也没办法了