-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sql
More file actions
37 lines (29 loc) · 1.29 KB
/
Copy pathpackage.sql
File metadata and controls
37 lines (29 loc) · 1.29 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
create or replace package std is
procedure new_student(
nameStudent OUT VARCHAR2,
status out varchar2,
nameStudentIn in USER1.name%TYPE,
ageStudentIn in USER1.age%TYPE
);
end std;
create or replace package body std is
procedure new_student(
nameStudent OUT VARCHAR2,
status out varchar2,
nameStudentIn in USER1.name%TYPE,
ageStudent in USER1.age%TYPE
) is
begin
BEGIN
insert into student(name,age) values(namestudentIn,agestudentIn)
RETURNING name
INTO nameStudent;
COMMIT;
status:='ok';
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
status:='user already exists';
WHEN OTHERS THEN
status:=SQLERRM;
END;
end new_student;