Home » Other » Training & Certification » procedures
procedures [message #281488] Sat, 17 November 2007 07:59 Go to next message
mrparr
Messages: 9
Registered: October 2007
Junior Member
Could anyone help, take a look at this and tell me what I am missing.
I have to customize the given PL/SQL template to reproduce and display the menu. STOP as soon as I can see the full display and prompt me for your input. STOP as soon as soon as I can get the menu to display as shown.

R2D2 Car Repair Shop
==================

Main Menu
=========




Select One of the Options Below:


1. Work with Employee Table
2. Work with Maintenance Tasks Table
3. Work with Car Repair Order Table
4. Work with Repair Material Inventory Table
5. Work with Quarries and Reports
6. End Program

Enter Your Selection(1-6)=>:

2.0 Briefly discuss the problem and the reason why the GetSelection Procedure
will not work to prompt the end-user for his/her selection. What work-around recommendation would
you make?


SQL> CREATE OR REPLACE PROCEDURE DisplayMenu
2 AS
3 BEGIN
4 DBMS_OUTPUT.PUT_LINE(CHR(0));
5 DBMS_OUTPUT.PUT_LINE(CHR(0));
6 DBMS_OUTPUT.PUT_LINE(CHR(0));
7 DBMS_OUTPUT.PUT_LINE(CHR(0));
8 DBMS_OUTPUT.PUT_LINE(CHR(0));
9 DBMS_OUTPUT.PUT_LINE(CHR(0));
10 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||CHR(9)||'R2D2 Car Repair Shop');
11 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||CHR(9)||'====================')
12 DBMS_OUTPUT.PUT_LINE(CHR(0))
13 DBMS_OUTPUT.PUT_LINE(CHR(0)),
14 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||CHR(9)||CHR(9)||'Main Menu');
15 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||CHR(9)||CHR(9)||'=========')
16 DBMS_OUTPUT.PUT_LINE(CHR(0))
17 DBMS_OUTPUT.PUT_LINE(CHR(0)),
18 DBMS_OUTPUT.PUT_LINE('Select One of the Options below:');
19 DBMS_OUTPUT.PUT_LINE(CHR(0));
20 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||'1. Work With Employee Table');
21 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||'2. Work With Maintenance Tasks Table');
22 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||'3. Work With Car Repair Order Table');
23 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||'5. Work With Quarries and Reports');
24 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||'6. End Program');
25 DBMS_OUTPUT.PUT_LINE(CHR(0));
26 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||'Enter Your Selection=>:');
27 END DisplayMenu;
28
29
30 DECLARE
31 SET SERVEROUTPUT OFF FEEDBACK ON;
32 PROMPT
33 v_Option Number;
34 BEGIN
35 DisplayMenu();
36 GetSelection();
37 EXCEPTION
38 WHEN OTHERS THEN
39 NULL;
40
41 END GetSelection;
42 /

Warning: Procedure created with compilation errors.

SQL> show procedures
SP2-0158: unknown SHOW option "procedures"
SQL> show errors
Errors for PROCEDURE DISPLAYMENU:

LINE/COL ERROR
-------- -----------------------------------------------------------------
12/6 PLS-00103: Encountered the symbol "DBMS_OUTPUT" when expecting
one of the following:
:= . ( % ;
The symbol ":=" was substituted for "DBMS_OUTPUT" to continue.

13/6 PLS-00103: Encountered the symbol "DBMS_OUTPUT" when expecting
one of the following:
. ( * % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between || multiset member SUBMULTISET_
The symbol "." was substituted for "DBMS_OUTPUT" to continue.

LINE/COL ERROR
-------- -----------------------------------------------------------------

13/34 PLS-00103: Encountered the symbol "," when expecting one of the
following:
. ( * % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between || multiset member SUBMULTISET_

14/71 PLS-00103: Encountered the symbol ";" when expecting one of the
following:
. ( ) , * % & | = - + < / > at in is mod remainder not range
rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or

LINE/COL ERROR
-------- -----------------------------------------------------------------
like between || multiset member SUBMULTISET_

16/6 PLS-00103: Encountered the symbol "DBMS_OUTPUT" when expecting
one of the following:
:= . ( % ;
The symbol ":=" was substituted for "DBMS_OUTPUT" to continue.

17/6 PLS-00103: Encountered the symbol "DBMS_OUTPUT" when expecting
one of the following:
. ( * % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like

LINE/COL ERROR
-------- -----------------------------------------------------------------
between || multiset member SUBMULTISET_
The symbol "." was substituted for "DBMS_OUTPUT" to continue.

17/34 PLS-00103: Encountered the symbol "," when expecting one of the
following:
. ( * % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between || multiset member SUBMULTISET_

18/62 PLS-00103: Encountered the symbol ";" when expecting one of the
following:

LINE/COL ERROR
-------- -----------------------------------------------------------------
. ( ) , * % & | = - + < / > at in is mod remainder not range
rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or
like between || multiset member SUBMULTISET_

30/1 PLS-00103: Encountered the symbol "DECLARE" when expecting one of
the following:
end not pragma final instantiable order overriding static
member constructor map
Re: procedures [message #281491 is a reply to message #281488] Sat, 17 November 2007 08:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ Read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.

2/ Always post your Oracle version (4 decimals).

3/ PL/SQL executes on SERVER and so does not interacts with client (unless you use Forms, in this case you don't post in the correct forum)

4/ A create procedure command ends with a /, so line 28 should be /

5/ when others the null is an ERROR

6/ "41 END GetSelection;" where GetSelection starts?

7/ ...

Regards
Michel

[Updated on: Sat, 17 November 2007 08:31]

Report message to a moderator

Re: procedures [message #281495 is a reply to message #281491] Sat, 17 November 2007 10:17 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Moreover, every statement should end with a semi-colon (;). Your statements have miscellaneous termination signs (from nothing over comma to semi-colon).

A summary (from my point of view) is this: your effort in writing this code is lousy. You didn't even TRY to make it work nor provide code which would (at least) compile; this is full of errors which don't deserve to be corrected by anyone else but you.

As far as I'm concerned, you shouldn't post back until you fix most of the obvious errors and then ask for help about a specific problem. I hope you dont' expect someone of us to "Briefly discuss the problem and the reason why ...". It is your homework, not ours. I'm not a writer to write an essay about it.
Re: procedures [message #281518 is a reply to message #281491] Sat, 17 November 2007 19:59 Go to previous messageGo to next message
mrparr
Messages: 9
Registered: October 2007
Junior Member
Thank you for your direction. That was a big help to me.
Re: procedures [message #281519 is a reply to message #281495] Sat, 17 November 2007 20:05 Go to previous messageGo to next message
mrparr
Messages: 9
Registered: October 2007
Junior Member
Thank you, I was not looking for anyone to do my homework. I just needed someone to point somethings that I did not see. I did correct the errors and successfully completed the assignment. Thank you for following your own guidelines on politeness!!!
Re: procedures [message #281587 is a reply to message #281519] Sun, 18 November 2007 09:02 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Oh, come on! You didn't see the obvious
Check line terminators

12 DBMS_OUTPUT.PUT_LINE(CHR(0))
13 DBMS_OUTPUT.PUT_LINE(CHR(0)),
14 DBMS_OUTPUT.PUT_LINE(CHR(9)||CHR(9)||CHR(9)||CHR(9)||'Main Menu');

and needed to be pushed into the right direction? You've been sloppy, and that's the whole truth. Posting such a code and expecting someone to spend his/her time to help you about such things is just not right, whether you like it or not.

If you really managed to make it work - congratulations! I'm really glad to hear that!
Previous Topic: Create trigger
Next Topic: OCP
Goto Forum:
  


Current Time: Sat Dec 10 03:04:31 CST 2016

Total time taken to generate the page: 0.09420 seconds