473,405 Members | 2,210 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,405 software developers and data experts.

please find out mistake.

Hello everybody,

I need your help to write the following procedure. I did it but dont get the out put so please help me that where I made mistake. I written the procedure just after the specification.


Write a program that computes a salesperson’s commission according to the specifications outlined below.

A particular company computes a salesperson’s weekly commission as follows:

If the salesperson sold less than or exactly equal to $ 500 in
products / services, then the salesperson’s commission rate
is 3.00

If the salesperson sold more than $ 500 but not more than $ 1,000 in products / services, then the salesperson’s commission rate
is 5.00

If the salesperson sold more than $ 1,000 in products / services,
then the salesperson’s commission rate is 10.00

To compute a salesperson’s commission, multiply the commission rate by his / her total sales.
************************************************
I WRITE DOWN AS UNDER.
set serveroutput on;
set verify off;
declare
sales number := &sales;
comm_rate number(5,2);
commission number(6,2);

begin
if sales <= 500
then comm_rate := 0.03;
else if sales <= 1000
then comm_rate := 0.05;
else
comm_rate := 0.10;
end if;

commission := comm_rate * sales;
dbms_output.put_line('Employees commission is' || commission);

End;

BUT ITS NOT WORKING . PLEASE LET ME KNOW WHERE I MADE MISTAKE.

Thank you.
Deven Oza
Dec 9 '06 #1
3 2043
What you typed in should work.

One thing to watch for in SQL*Plus is avoid putting blank lines in your anonymous PL/SQL block.

It could fool the interpreter and think that the code did not belong together.

As with all PL/SQL code, issue a slash ( / ) all by itself in the first column to execute the code.

Good luck!

Mondo Tofu
Dec 10 '06 #2
suvam
31
Can u mention what is the actual error coming during compilation ?
Dec 12 '06 #3
Hi u missed one more end if;
that is the problem.

the following code works.check it.

SQL> declare
2 sales number := &sales;
3 comm_rate number(5,2);
4 commission number(6,2);
5 begin
6 if sales <= 500
7 then comm_rate := 0.03;
8 else if sales <= 1000
9 then comm_rate := 0.05;
10 else
11 comm_rate := 0.10;
12 end if;
13 end if;
14 commission := comm_rate * sales;
15 dbms_output.put_line('Employees commission is' || commission);
16 end;
17 /
Enter value for sales: 300
old 2: sales number := &sales;
new 2: sales number := 300;

PL/SQL procedure successfully completed.

SQL> set serveroutput on;
SQL> /
Enter value for sales: 300
old 2: sales number := &sales;
new 2: sales number := 300;
Employees commission is9

PL/SQL procedure successfully completed.
Dec 13 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: TAM | last post by:
Hi, I have two pages designed using CSS (without tables), http://www.ngrain.com/CSS/home1.htm designed for IE and http://www.ngrain.com/CSS/home2.htm designed for NN, Mozilla, FireFox...
1
by: progII | last post by:
Hello, i am struggling the whole night cos of my c++ homework. deadline is very soon. (april 4th) i have to implement a calender. i store every calender entry in a list. a calender entry is...
5
by: TrvlOrm | last post by:
Can any one please help me...I am new to JavaScript and I have been struggling with this code for days now and can't figure it out. I would like to get the Buttons to correspond with the action...
8
by: Cyberdog | last post by:
HI, I am learning javascript, and at the moment I am working on truth tables. Can someone please tell me, is "NOT A AND B" the same as "NOT A AND NOT B". Thanks
18
by: free2cric | last post by:
Hi, I attanded an interview on C++ Question asked were and my answers to them.. 1. In a CPP program what does memory leak occure? -- i said.. In a constructor , the pointer variables were...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
17
by: so many sites so little time | last post by:
all right so the script is pretty simple it goes it retrives what the id of the post is and it lets you edit it well no it doesnt. now if you go to www.kirewire.com/pp2/index/php you will see a...
31
by: karthi84 | last post by:
hi, i have a p4 system with 2.66Ghz processor and 768Mb Ram my system was working fine. but now a days it has become much slower when it boots. i have removed all the programs that starts up...
67
by: gator | last post by:
I am quite new to XML and posted a request for example code yesterday. Unfortunately, I did not do a very good job in explaining what I was looking for. Here is an example of a small piece of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.