Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: trigger help please

Re: trigger help please

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Mon, 30 Sep 2002 15:31:34 GMT
Message-ID: <3D986E41.51F9D202@exesolutions.com>


Michael Kuznetsov wrote:

> Sorry Skippy, i've send you answer what belongs to others. About your
> question. I think you can solve your problem without database trigger.
> Oracle check links between tables automatically if you create foreign
> key constraint.
>
> Michael Kuznetsov
>
> mvk_at_servocomp.ru (Michael Kuznetsov) wrote in message news:<1543a3e7.0209300004.59117476_at_posting.google.com>...
> > Hi Skippy,
> >
> > There is very old but easy way to copy table from one database to
> > another. It's using COPY command from SQL*Plus.
> >
> > It is fragment from SQL*Plus documentation:
> >
> > The following command copies the entire EMP table to a table named
> > WESTEMP.
> > Note that the tables are located in two different databases. If
> > WESTEMP already
> > exists, SQL*Plus replaces the table and its contents. The columns in
> > WESTEMP have the same names as the columns in the source table, EMP.
> >
> > SQL> COPY FROM SCOTT/TIGER_at_HQ TO JOHN/CHROME_at_WEST ->
> > REPLACE WESTEMP ->
> > USING SELECT * FROM EMP
> >
> >
> > Regards,
> > Michael
> > Brainbench MVP for Oracle Programming
> > http://www.brainbench.com
> >
> >
> > "Skippy" <SkippyNOSPAM_at_hotmail.com> wrote in message news:<an86s2$3mo$1_at_slb7.atl.mindspring.net>...
> > > I need to some help creating a trigger. I have a table and I need an insert
> > > trigger when I try to insert something in table 1.. it makes sure that the
> > > value exists in table 2.. more sepcifically.
> > >
> > > Table 2 is a list of courses and pre-requisites for each course.
> > >
> > > Table 1 is a registration table. The user should not be able to sign up for
> > > a course if they have not taken the pre-requistie course
> > >
> > > Table 3 has the list of courses that the student has taken.
> > >
> > > thanks.
> > >
> > > skippy

What you likely have missed is that Skippy is a student ... and proposing an alternative solution will not cut the mustard with the instructor.

Skippy, what you need is a trigger on the registration table as you suggest. But you have demonstrated no effort on your part to write one short of apparently asking someone to do it for you.

Go to http://tahiti.oracle.com and look up "BEFORE INSERT TRIGGER." There you will find instructional material and examples though I would suspect that you have them in your textbook and examples from class.

If, after writing your trigger and attempting to debug any errors you are still having problems ... post your efforts here as well as the full and complete ORA-#### error message and text. Then someone will help you fix it.

Daniel Morgan Received on Mon Sep 30 2002 - 10:31:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US