plsql function/package [message #635913] |
Sat, 11 April 2015 07:30 |
|
lexonsteel
Messages: 1 Registered: April 2015 Location: Briton
|
Junior Member |
|
|
Hi Guru, I am a novice/learning oracle PLSQL using jdeveloper
I have a very simple db table called TYPES with the following columns
PRICE: 100, 200, 300, 400
QUANTITY: 1,2,3,4
DURATION: 1,2,4,6,
CARS; VINTAGE, LIMO, LUXURY(including wedding transport)
I want to calculate the following discounts based on the table above;
40% discount for duration of 2 or more days (DURATION)
20% discount for two or more cars(QUANTITY)
10% discount for wedding transport (CARS)
Many thanks
[Updated on: Sat, 11 April 2015 07:32] Report message to a moderator
|
|
|
Re: plsql function/package [message #635914 is a reply to message #635913] |
Sat, 11 April 2015 08:03 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
Hi,
Welcome to the forum!
Please read and follow the OraFAQ Forum Guide and How to use [code] tags, to enable us to help you.
Why PL/SQL? Do it in SQL.
I see it to be simple mathematical calculations. I would use a CASE statement to check the DURATION and QUANTITY, and return the DISCOUNTED PRICE. The filter predicate will take care of the type of CAR.
But, it is not at all clear how are these values related? You need to provide a working test case. Create and insert statements. And show us your desired output based on the rules you explain.
Edit : Added Moderator bit
[Updated on: Sat, 11 April 2015 08:06] Report message to a moderator
|
|
|
|