-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLaursen_Program4.sql
More file actions
53 lines (48 loc) · 1.15 KB
/
Laursen_Program4.sql
File metadata and controls
53 lines (48 loc) · 1.15 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--/***************************************************************/
-- Developer: Julie Laursen
--
-- Program #: 3
--
-- File Name: Program 3.sql
--
-- Course: ITSE 1345 Introduction to Oracle SQL and PL/SQL
--
-- Due Date: <Due Date>
--
-- Instructor: Fred Kumi
--
-- Chapter: 4
--
-- Description:
-- Calculate customer rating based on total purchases and display on the screen
--
set Serveroutput On;
DECLARE
lv_purchase NUMBER(10, 2);
lv_rating VARCHAR2(15);
BEGIN
lv_purchase := 600.00;
lv_rating := 'test';
IF lv_purchase > 500.00 THEN
lv_rating := 'high';
ELSIF lv_purchase > 350.00 THEN
lv_rating := 'medium';
ELSIF lv_purchase > 250.00 THEN
lv_rating := 'normal';
ELSE
lv_rating := 'low';
END IF;
DBMS_OUTPUT.PUT_LINE(lv_rating);
CASE
WHEN lv_purchase > 500.00 THEN
lv_rating := 'high';
WHEN lv_purchase > 350.00 THEN
lv_rating := 'medium';
WHEN lv_purchase > 250.00 THEN
lv_rating := 'normal';
ELSE
lv_rating := 'low';
END CASE;
DBMS_OUTPUT.PUT_LINE(lv_rating);
END;
/