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 05 - Creating PL/SQL Function

In this Hands-On, you write a PL/SQL Function to return the department name (dname).  You use one input parameter to pass the department number (deptno) and return its department name.

You will:

    1- Write a PL/SQL function to return a department name.

    2- Use department number as an input parameter.

    3- Run the stored procedure.

    4- Test the stored procedure.

    5- Save the function in the local library,

    6- Save the function in the database server.

 

More Resources by Google:

Manuscript

Select “Program Units.”

 

Click on the “Create” icon.

 

Type the function name “department_name.”

 

Then checkmark “Function,” and click “OK.”

 

Define a datatype for the Function return value.

Define an input parameter to pass the department number.

Declare a department name variable.

 

In the body section, use an implicit cursor to assign the department name to the department name variable where the department number is the same as the input parameter.

=

Return the department name if the record was found.

=

In the exception section, write an exception to return “no data found” message if there was no match.

Always write the “Others” exception.

=

Compile the function.

=

Close the window.

=

Save the function in the database server.

 

In the “PL/SQL interpreter” section, use the “select” statement and use the department number 10 to test the function.

 

To test the exception, call the function again using the department number that does not exist in the department table.

 

Query the department name function against the employee table sorted by the employee name.

Notice that you didn’t join the department table with the employee table.

=

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

Good Luck.

 

 
 
Google
 
Web web site