iSelfSchooling.com - Copyright © 1999-2007 iSelfSchooling.com  References  Job Openings  |  Secure Login
    Home  | Search more...  |  FREE Online VIDEO Oracle Training  |  Gift Store  |  Bookstore

   Unlimited access!   

    Oracle  Syntax  | Suggestions Your Contribution  |  FREE Legal Forms

 

Email2aFriend Homepage us! |  Bookmark   -  Copyright & User Agreement

Products/Services

 Vision/Mission

 Community Sharing

 Services

  Products

 Biography

 Contact Us

 FAQ

 Current News

 Website Traffic

 Bookstore

 FREE Training

 SQL

 PL/SQL

 Forms 

 Reports

 Other TOOLS

 Fundamentals

 Performance

 OEM

 Application Server

 Grid Control

 Articles

 Prepare for OCP

Oracle SYNTAX

 Oracle Functions

 Oracle Syntax

 Oracle 10g Syntax

  PL/SQL Syntax

UNIX and more...

 UNIX for DBAs

 LINUX for DBAs

 DB using PHP

  A+ Certification

 Basics of JAVA  

 Tips of  SEO

Finance/Jobs

 Financial Aid

 Skilled

 Oracle

 Jobs

  Magazine

More Training

 Q & Answers

 SQL-PL/SQL

 DBA

 Developer

 Important Notes

 Case Studies

 9i New Features

 10g New Features

 10g Qs/As

 Grid Control

 OracleAS # I

 OracleAS # II

  LDAP and OID

  HTTP Server

 Instructor-Led

  Virtual Hosts

 Community Sharing

More to know...

Acknowledgement**

 FREE Legal Forms

 Who is who

 Market Place

 University Directory

 Advisory Articles

 Links...

 

 

Topics:  Hands-On 10 – Sequence object, Trigger (pre-insert)

Generate a unique customer ID and assign it  to each new customer that is added to a table.

Your client requires to find what last customer ID was entered into their system, then she/he increment it by 1 and use that number.  This is not very professional way of doing business specially if you have multiple transactions to enter data.

You have been assigned, to add a sequence number to custid starting with 200 and incremented by 1.  So, your customer ID would start from 200, 201, 202, and so on.

In this Hands-On, you will learn how to:  create sequence object, create and use "PRE-INSERT" trigger.

 

More Resources by Google:

Manuscript

Save the Form name as version 10.

 

Create a sequence number to increment the customer id number when you insert a new customer.

 

Go to MS-DOS Prompt.

Login to “sqlplus” as “iself” password “schooling.”

Create a sequence object that starts from 200 and is incremented by 1.

 

Use the “Next Value” Function to increment the sequence number.

Repeat to run the query.

 

Close the MS-DOS window or minimize it.

 

Open the "custid" property palette.

Change the "Required" property to "NO."

 

Create a "PRE-INSERT" trigger for the “Customer” data block.

Type “P” and “R,” and then select the trigger.

Write a select statement to assign a new sequence number to “custid.”

Compile the trigger and then close the window.

 

Run the application.

 

Click “Execute query.”

Navigate through the customers information.

 

Click on the "insert" icon.

Now, the form is on the “insert” mode.

Type the new customer information.

Remember that the “Customer ID” is going to be generated.

Save the record.

 

New “Customer ID" was generated.

 

Add more customers.

Duplicate the previous record.

Notice that even though the Customer ID is copied, the new "Customer ID" will be assigned to it.

Click on "save."

Notice that "custid" is changed to the new number (205).

 

Navigate through the application.

Then, close the application and save the changes.

 

Now, you should practice this over and over, until you become a master at it.

Good Luck.

 
 
 
Google
 
Web web site