PL/SQL trigger fires once a day

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jagdip Singh Ajimal

    PL/SQL trigger fires once a day

    I am creating a table of appointments. As this table is going to get
    very large very quickly, I want to move the old appointments into a
    backup table, backupAppointme nts. How do I do this using a trigger? I
    have got this so far:

    create or replace trigger cleanAppointmen ts
    after insert on appointments
    when apoointments.da te < SYSDATE
    Begin
    -- move the records
    End;

    Any help would be greatly appriciated.
  • Jim Kennedy

    #2
    Re: PL/SQL trigger fires once a day


    "Jagdip Singh Ajimal" <jsa1981@hotmai l.com> wrote in message
    news:c84eb1b0.0 402080348.403d0 328@posting.goo gle.com...[color=blue]
    > I am creating a table of appointments. As this table is going to get
    > very large very quickly, I want to move the old appointments into a
    > backup table, backupAppointme nts. How do I do this using a trigger? I
    > have got this so far:
    >
    > create or replace trigger cleanAppointmen ts
    > after insert on appointments
    > when apoointments.da te < SYSDATE
    > Begin
    > -- move the records
    > End;
    >
    > Any help would be greatly appriciated.[/color]

    It wouldn't be a trigger. It would be a job. Use the dbms_job package to
    schedule this as a repeating stored procedure to run as often as you would
    like. (eg 1/day) See the documentation on supplied pl/sql packages.(this
    has been in Oracle since version 7)
    Jim


    Comment

    Working...