-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUPDATE2.sql
More file actions
66 lines (34 loc) · 961 Bytes
/
UPDATE2.sql
File metadata and controls
66 lines (34 loc) · 961 Bytes
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
54
55
56
57
58
59
60
61
62
63
64
65
66
exec update_customer(11489,'AKASH');
Select * from customer_details where customer_id=11489;
Create or replace procedure update_customer(
C_ID IN NUMBER,
CUST_NAME IN VARCHAR2
--ZIP_CODE IN VARCHAR2,
--STATE_NAME IN VARCHAR2,
--ADDRESS IN VARCHAR2
)
IS
Cust_ID number(5);
no_cust_ID_exist exception;
--contact_ID number;
--notuniquecontact exception;
customerempty exception;
cust_not_exist exception;
Begin
select count(*) into CUST_ID from customer_details where customer_details.CUSTOMER_ID=C_ID;
IF(cust_id=0)
then raise cust_not_exist;
elsif (CUST_NAME IS NULL or LENGTH(CUST_NAME)=0)
Then raise customerempty;
else
update customer_details set CUSTOMER_NAME=CUST_NAME where customer_details.customer_id=C_ID;
END IF;
Exception
When cust_not_exist
then
raise_application_error(-20001,'Customer ID entered does not exist');
when customerempty
then
raise_application_error(-20002,'Customer name cannot be empty');
END;
COMMIT;