Experiment: Programs Related Function: Steps For Experiment/practical: (A) : ANSWER
Experiment: Programs Related Function: Steps For Experiment/practical: (A) : ANSWER
Experiment: Programs Related Function: Steps For Experiment/practical: (A) : ANSWER
1) Task to be done:
(A): ANSWER :-
EMP_ID NUMBER(10),
EMP_NAME VARCHAR2(20),
SALARY NUMBER(20),
MIN_SALARY NUMBER(20),
MAX_SALARY NUMBER(20)
);
INSERT INTO EMP VALUES('1', 'VIJAY', '25000', '20000','50000');
DECLARE
SAL_ACHIEVE NUMBER,
TARGET_QTY NUMBER,
EMP_ID NUMBER
RETURN NUMBER
IS
INCENTIVE NUMBER := 0;
BEGIN
UPDATE EMP
DBMS_OUTPUT.PUT_LINE (
);
RETURN 1;
END IF;
END ;
DECLARE
RES NUMBER;
BEGIN
END;
Output
(B) : Answer:-
CREATE TABLE EMPLOYEE(
EMP_ID VARCHAR(15),
EMP_NAME VARCHAR(30),
EMP_AGE NUMBER(2),
EMP_CITY VARCHAR(30),
EMP_SALARY NUMBER(10),
EMP_MIN_SALARY NUMBER(10),
EMP_MAX_SALARY NUMBER(10)
);
BEGIN
INSERTRECORD('21MCI1068','AKHAND PRATAP SINGH',22,'AGRA',50000,60000,100000);
INSERTRECORD('21MCI1001','ADITYA',20,'MATHURA',85000,60000,100000);
INSERTRECORD('21MCI1002','AMAN',23,'JAMMU',90000,60000,100000);
INSERTRECORD('21MCI1003','NIKHIL',21,'JAIPUR',55000,60000,100000);
INSERTRECORD('21MCI1004','DEVESH',25,'JALANDHAR',70000,60000,100000);
INSERTRECORD('21MCI1005','TAPO',26,'DHAKA BANGLADESH',75000,60000,100000);
INSERTRECORD('21MCI1006','GOPAL',27,'NEW DELHI',90000,60000,100000);
INSERTRECORD('21MCI1007','VISHAL',23,'AHMEDABAD',80000,60000,100000);
INSERTRECORD('21MCI1008','RAJESH',24,'BENGALURU',85000,60000,100000);
INSERTRECORD('21MCI1009','ADARSH',24,'NAGPUR',65000,60000,100000);
END;
AKHAND PRATAP
21MCI1068 22 AGRA 50000 60000 100000
SINGH
21MCI1001 ADITYA 20 MATHURA 85000 60000 100000
21MCI1002 AMAN 23 JAMMU 90000 60000 100000
21MCI1003 NIKHIL 21 JAIPUR 55000 60000 100000
21MCI1004 DEVESH 25 JALANDHAR 70000 60000 100000
21MCI1005 TAPO 26 DHAKA BANGLADESH 75000 60000 100000
21MCI1006 GOPAL 27 NEW DELHI 90000 60000 100000
21MCI1007 VISHAL 23 AHMEDABAD 80000 60000 100000
21MCI1008 RAJESH 24 BENGALURU 85000 60000 100000
21MCI1009 ADARSH 24 NAGPUR 65000 60000 100000
DECLARE
RES NUMBER;
TMP_EMP_ID VARCHAR(15) := '21MCI1068';
BEGIN
RES := FUNCTION2(TMP_EMP_ID);
END;
Statement processed.
The employee ADITYA ID 21MCI1001 works in salary 85000 which is higher than mid-range of salary 80000
Now, If you check salary will be updated, As salary is higher than mid range, salary will be increased by 8%.
1) Output
2. Calling of function
Evaluation Grid: