[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

How do i create a stored procedure that has multiple complex parts that include functions?

Asked by curiousperson in Oracle CRM, PL / SQL

Tags: stored procedure, plsql, oracle

This is a very complex procedure so I need as much help as I can get because I am new to database programming and need help as soon as possible.
 I need to create a stored procedure that accepts information on the size of the slip desired (slip_size) and produces a listing of the marinas (marina_name)  in that state with slips that size.
Example of slip_size: 100x30x80

Here are the following requirements:
1) the user provides a state(two-letter abbreviation), width, length, depth as parameters
2) determine which marinas are located in the state specified by the user in the parameter. If no marinas are in that state,display a message to the user indicating that TM(the name of the database) does not represent any marinas in that state.
3) If there are marinas in the state, determine if any of the slips in the marinas have a width that   is equal to or greater than the width provided by the user, a length that is equal to or greater than the length provided by the user, and a depth that is equal to or greater than the depth provided by the user.
4)If no slips are found to satisfy those requirements, then display a message to the user.
5) if any slips are found that satisfy the requirements,
    a) display the marina name(marina_name),
    b) marina phone number (Marina_Areacode, Marina_phone) based on this function:

   -- SEE CODE SECTION

    c) display the manager's name(Manager_FName, Manager_LName).
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
-- This function is purely for getting the phone number only
 
CREATE OR REPLACE FUNCTION formatPhone(pvAreaCode VARCHAR2,
                                       pvNumber   VARCHAR) RETURN VARCHAR2 IS
   lvAreaCode VARCHAR2(3);
   lvNumber   VARCHAR2(7);
BEGIN
   -- remove trailing/leading whitespace
   lvAreaCode := TRIM(pvAreaCode);
   lvNumber   := TRIM(pvNumber);
 
   -- check for invalid format (wrong number of digits, or other non-numeric characters)
   IF NOT regexp_like(lvAreaCode,
                      '^\d{3}$') OR
      NOT regexp_like(lvNumber,
                      '^\d{7}$') THEN
      RAISE_application_error(-20001,
                              'incorrect format: should be xxx xxxxxxx');
   END IF;
    
   -- format and return result
   RETURN '(' || lvAreaCode || ')' || substr(lvNumber,
                                             1,
                                             3) || '-' || substr(lvNumber,
EXCEPTION
   WHEN VALUE_ERROR THEN
      RAISE_application_error(-20001,
                              'incorrect format: should be xxx xxxxxxx');
END formatPhone;
[+][-]07/02/09 07:20 AM, ID: 24763600Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Oracle CRM, PL / SQL
Tags: stored procedure, plsql, oracle
Sign Up Now!
Solution Provided By: curiousperson
Participating Experts: 1
Solution Grade: A
 
[+][-]07/02/09 05:52 AM, ID: 24762707Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07/02/09 07:09 AM, ID: 24763469Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/02/09 07:29 AM, ID: 24763714Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625