iSelfSchooling.com - Copyright © 1999-2009 iSelfSchooling.com ||  References  |  Job Openings  || Login (Staff | Members)
    Home  | Search more...  |  FREE Online VIDEO Oracle Training 

    Oracle Syntax  | Suggestions  | Private Tutoring  | Group Collaboration

  Copyright & User Agreement

Email2aFriend  | Homepage us! |  Bookmark

Services

 Vision/Mission

 Services

 Biography

 Contact Us

 FREE Training

 SQL

 PL/SQL

 Forms 

 Reports

 Other TOOLS

 Fundamentals

 Performance

 OEM

 Application Server

 Grid Control

 Articles

 Prepare for OCP

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

More to know...

Acknowledgement**

 Who is who

 University Directory

 Links...

 

 

Topics:  Hands-On 04 - Creating PL/SQL Function

In this Hands-On, you write a PL/SQL Function to concatenate the customer's last name and first name to be separated by a comma.

For example (lastname, firstname).

You will:

    1- Write a PL/SQL function to concatenate the customer’s last name and first name separated by comma.

    2- Use input parameters.

    3- Run the stored procedure.

    4- Test the stored procedure.

    5- Save the function program.

 

More Resources by Google:

Manuscript

Create a "Function" to concatenate the customer's last name and first name to be separated by a comma.

Remember!  A "Function" can have none or many input parameters, but it returns one and only one value.

=

Select “Program Units” and click “create.”

=

Name the function "Full_Name,” then select "Function" and click “OK.”

 

Declare a datatype for the Function return value.

=

Declare a first name and last name input parameters.

Their datatypes should match with the datatype of the firstname and lastname in the customers table.

=

In the PL/SQL body, return the customers’ concatenated name with a syntax error and misspell the return statement.

Only just, to see what type of error messages we get.

=

Write the exception.

In the exception section, do nothing in the case of an exception.

=

Compile the function.

=

Read the error message.

Notice that the pipe line points right to the error.

Everything else in the stored procedure looks OK.

 

Correct the syntax.

=

Compile the function.

Successfully compiled.  Then close the window.

=

Save the function in the database server.

Choose the “Program” option and select the "PL/SQL interpreter"

=

 

Use the select statement to test the function and pass two input parameters to the full_name function from the dummy table.

Make the first parameter "John" and second "Kazerooni".

=

The concatenation was successful.

=

Query the fist and last name of the customers table.

=

Then, query the customers’ concatenated full name using the full_name function.

=

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

Good Luck!

 

 
 
Google
 
Web web site