473,327 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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

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
2 3785
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: William F. O'Neill | last post by:
Am using Powerbuilder 8.0.4 and SQL Server 2000. Have just installed Windows XP SP2, and can no longer connect to my SQL Server db. Someone suggested that I need to reset the port for the db at...
2
by: thechaosengine | last post by:
Hi everyone, Is there anyway to create some sort of catch-all in windows forms applications that could ensure that no unexpected exceptions bring down an application? For example, perhaps...
1
by: news.microsoft.com | last post by:
Is there an elegant way to clear out the ADO connection pool used by the SQL Server State Service following a cluster failover? We are using a SQL Cluster to store both the ASP Session State...
2
by: Manish Naik | last post by:
Hi, Using ASP.Net, I want to store and retrive documents (Word, excel, etc) from SQL Server 2000 database. I have tried image type data field, but could not succed. Can any one help me please. ...
3
by: Terry Olsen | last post by:
I've got 2 different web pages, both updating the same SQL database. One is for the Technician and one is for the Manager. The technician's update page works fine but the Manager's update page...
0
by: Colmeister | last post by:
I recently read Jason Clark's excellent article on Unhandled Exceptions (http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx) and have attempted to incorporate the features he talks...
2
by: Chris Moore | last post by:
I am new to .NET & SQL Server and am having fits trying to connect to a SQL Server Database/table. Can someone please please please send me a copy of their connection process (connection,...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
3
by: Bobby | last post by:
Hi, I have an application which uses Access 2003 as both the FE and the BE. However, for a number of good reasons, I am in the process of converting the BE to SQL server 2003. I am not converting...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.