-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setup-Database.sql
30 lines (27 loc) · 1.04 KB
/
Setup-Database.sql
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
CREATE TABLE "FOO"."EMPLOYEE"
(
"ID" NUMBER(10,0) GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 100 CACHE 20 NOORDER NOCYCLE ,
"NAME" VARCHAR2(255 BYTE),
"SALARY" NUMBER(10,0),
"ADDRESS" VARCHAR2(500 BYTE)
);
Insert into "FOO".EMPLOYEE (ID,NAME,SALARY,ADDRESS) values (100,'Rana',10500,'FR');
Insert into "FOO".EMPLOYEE (ID,NAME,SALARY,ADDRESS) values (101,'John',18000,'US');
Insert into "FOO".EMPLOYEE (ID,NAME,SALARY,ADDRESS) values (102,'Maya',15000,'BE');
Insert into "FOO".EMPLOYEE (ID,NAME,SALARY,ADDRESS) values (103,'Fred',20000,'ES');
CREATE OR REPLACE PROCEDURE "FOO".USP_GET_EMPLOYEES (EMP_CURSOR OUT SYS_REFCURSOR)
AS
Begin
Open EMP_CURSOR FOR
SELECT ID, NAME, SALARY,ADDRESS FROM Employee;
End;
CREATE OR REPLACE PROCEDURE "FOO"."USP_FIND_EMPLOYEES"
(
MIN_SALARY IN INT,
MAX_SALARY IN INT,
EMP_CURSOR OUT SYS_REFCURSOR
) AS
BEGIN
OPEN EMP_CURSOR FOR
SELECT ID, NAME, SALARY,ADDRESS FROM Employee WHERE SALARY BETWEEN MIN_SALARY AND MAX_SALARY;
END;