Databases Reference
In-Depth Information
Once again, use the Object Type select list and choose Triggers. You see a trigger named BI_TICKETS (BI stands
for “before insert”). Clicking the Code tab above the trigger details shows the code for the trigger that is using the
TICKETS_SEQ sequence to fill the TICKET_ID if it's null. You should see code similar to the following:
create or replace trigger "BI_TICKETS"
before insert on "TICKETS"
for each row
begin
if :NEW."TICKET_ID" is null then
select "TICKETS_SEQ".nextval into :NEW."TICKET_ID" from sys.dual;
end if;
end;
Now that you have the TICKETS table defined, let's go back and create the TICKET_DETAILS table. This time you'll
create a foreign key to the TICKETS table, as a CASCADE DELETE . This means that if you delete a ticket, the ticket details
will automatically be deleted as well.
10.
Start the Create Table Wizard using the Create button.
11.
Enter the table name and column definitions based on the ERD and Figure 4-6 , and
click Next .
Figure 4-6. Defining the TICKET_DETAILS table
 
Search WWH ::




Custom Search