Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> PL/SQL: Exceptions & Sub-programs...

PL/SQL: Exceptions & Sub-programs...

From: AB <desafiada6_at_yahoo.com>
Date: 15 May 2004 10:48:21 -0700
Message-ID: <f63a3fd.0405150948.60b13fd4@posting.google.com>


I have an assignment due in a database programming class and to my horror I have no idea where to even begin with this problem!! PLEASE HELP!! Write a PL/SQL procedure, parse_name, which accepts a string representing names and returns the title, the first name, and the last name. The first name and last name returned from the procedure should be in upper cases while the title returned should presever the orginal case. The input name string is in one of the following two formats:

		FIRST_NAME LAST_NAME TITLE
		LAST_NAME, FIRST_NAME TITLE

The first format depicts that the name string starts with a person's first name and last name with a space in between, followed by a space, and then the title of the person. On the other hand, the second format states that the name string starts with a person's last name, followed by a comma and a space, and then the first name suffixed with the title with a space before it.

The following are examples of valid name strings conforming to the formats:

  1. Jane Doe Ms.
  2. Doe, Jane Ms.

Your procedure should return , and Ms. for title, JANE for first name, and DOE for last name for the above two input strings.

Your procedure should generate exceptions if any one of the three components of the input name string is missing. Further, a message should be printed indicating that the input string is invalid. For instance, the following input strings should cause an exception to be generated and the appropriate messages printed:

  1. Doe
  2. Jane Doe
  3. Doe, Jane

You should wrap parse_name within an anonymous PL/SQL block that accepts the name string through SQL*Plus substitution variables, calls parse_name with the input string, and then prints the title, the first name, and the last name returned from the parse_name procedure. You should print the title first, followed by the first name and then the last name, separated by spaces. Received on Sat May 15 2004 - 12:48:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US