Re: Oracle Problem 1: Please Help

From: Dave <davidr212000_at_yahoo.com>
Date: 6 Apr 2004 20:24:48 -0700
Message-ID: <5e092a4e.0404061924.3c123b7f_at_posting.google.com>


Hans Forbrich <forbrich_at_yahoo.net> wrote in message news:<enBcc.7559$Sh4.5308_at_edtnps84>...
> singhjih wrote:
>

> >
> > The table looks like the following:
> >
> >
> > Code:
> > --------------------
> >
> > INSTRUCTOR_ID(PK) NUMBER(8,0) NOT NULL
> > SALUTATION VARCHAR2(5) NULL
> > FIRST_NAME VARCHAR2(25) NULL
> > LAST_NAME VARCHAR2(25) NULL
> > STREET_ADDRESS VARCHAR2(50) NULL
> > ZIP(FK) VARCHAR2(5) NOT NULL
> > PHONE VARCHAR2(15)
> > CREATED_BY VARCHAR(3)
> > CREATED_DATE DATE NOT NULL
> > --------------------
> >
> >
> > I'm not fully capable to write PL/SQL I just started last week however
> > I am a very compitent student. If I need to write a trigger could you
> > lead me in the right direction.
> >
> >
>
> Oracle has a lot of good documentation on their site at
> http://docs.oracle.com. You should get familiar with the one called 'SQL
> Reference' for language and syntax, and the one called PLSQL Reference (I
> think) for general PLSQL.
>
> CREATE TRIGGER and PLSQL Anonymous block are some keywords.
>
> /Hans

Hans gives good advice. Check to doc, its quite complete. The key to the trigger is that you can reference the old and new values with syntax :new.<col_name> and :old.<col_name> . You can write PL/SQL code in the trigger that references the old and new value and thus create complex constraints.

Suggestion. Instead of trying to solve your problem straight out. Try to create a very simple trigger to get familiar with the concept and to see it work. Then tackle your problem.

Dave Received on Wed Apr 07 2004 - 05:24:48 CEST

Original text of this message