By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,501 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,501 IT Pros & Developers. It's quick & easy.

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

P: n/a
AB
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.
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
AB wrote:
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!!


We don't do homework, we merely hint...
1) Find out if you have a valid input
(hint: should have 2 space(blocks),
surrounded by characters)
2) Find out which form is used...
(hint: comma seems an indicator)

Other hints: lookup the upper, lower, instr and substr functions.
One more: documentation is on :
http://otn.oracle.com/pls/db10g/port...mo3?selected=1
Look for the SQL Reference.
--

Regards,
Frank van Bortel

Jul 19 '05 #2

P: n/a

"Frank van Bortel" <fv********@netscape.net> wrote in message
news:c8**********@news1.tilbu1.nb.home.nl...
| AB wrote:
|
| > 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!!
|
| We don't do homework, we merely hint...
| 1) Find out if you have a valid input
| (hint: should have 2 space(blocks),
| surrounded by characters)
| 2) Find out which form is used...
| (hint: comma seems an indicator)
|
| Other hints: lookup the upper, lower, instr and substr functions.
| One more: documentation is on :
| http://otn.oracle.com/pls/db10g/port...mo3?selected=1
| Look for the SQL Reference.
| --
|
| Regards,
| Frank van Bortel
|

SQL Reference for functions (upper, etc)
PL/SQL Reference for programming constructs (declarations, loops, case, etc)

-- mcs
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.