SlideShare a Scribd company logo
PLSQL- Assignment
1. Write a PLSQL Program to find out the greatest of any two numbers ?
SQL> DECLARE
2 N1 NUMBER;
3 N2 NUMBER;
4 BEGIN
5 DBMS_OUTPUT.PUT_LINE('ENTER NUMBER');
6 N1:=&N1;
7 DBMS_OUTPUT.PUT_LINE('ENTER NUMBER');
8 N2:=&N2;
9 IF N1<N2 THEN
10 DBMS_OUTPUT.PUT_LINE(' '||N2||' IS GREATER THAN '||N1||'');
11 ELSE
12 DBMS_OUTPUT.PUT_LINE(' '||N1||' IS GREATER THAN '||N2||'');
13 END IF;
14 END;
15 /
2. Write a PLSQL Program to enter any number and find out whether it’s positive or
negative or zero?
SQL> DECLARE
2 N1 NUMBER;
3 BEGIN
4 DBMS_OUTPUT.PUT_LINE('ENTER NUMBER');
5 N1:=&N1;
6 IF N1>0 THEN
7 DBMS_OUTPUT.PUT_LINE(' '||N1||' is positive');
8 ELSIF N1=0 THEN
9 DBMS_OUTPUT.PUT_LINE(' '||N1||' is equal to zero');
10 ELSE
11 DBMS_OUTPUT.PUT_LINE(' '||N1||' is Negative');
12 END IF;
13 END;
14 /
3. Create PLSQL function and to the factorial of given number ?
SQL> CREATE OR REPLACE FUNCTION FACTORIAL(N IN NUMBER)
2 RETURN NUMBER IS F NUMBER(10);
3 BEGIN
4 F:=1;
5 FOR I IN 1..N LOOP
6 F:=F*I;
7 END LOOP;
8 RETURN F;
9 END;
10 /
SQL> DECLARE
2 N NUMBER;
3 FACT NUMBER;
4 BEGIN
5 DBMS_OUTPUT.PUT_LINE('ENTER A NUMBER');
6 N:=&N;
7 FACT:=FACTORIAL(N);
8 DBMS_OUTPUT.PUT_LINE('FACTORIAL OF GIVEN NUMBER IS '||FACT||' ');
9 END;
10 /
4. Write a PL/SQL program to display the details of the employee number 7369 ?.
(oracle emp table).
SQL> DECLARE
2 n_empno INTEGER := 7369;
3 v_ename emp.ename%TYPE;
4 v_job emp.job%TYPE;
5 n_mgr emp.mgr%TYPE;
6 n_sal emp.sal%TYPE;
7 d_hiredate emp.hiredate%TYPE;
8 n_deptno emp.deptno%TYPE;
9 BEGIN
10 SELECT ename,
11 job,
12 mgr,
13 hiredate,
14 sal,
15 deptno
16 INTO v_ename,
17 v_job,
18 n_mgr,
19 d_hiredate,
20 n_sal,
21 n_deptno
22 FROM emp
23 WHERE empno = n_empno;
25 DBMS_OUTPUT.put_line ('Employee Name: ' || v_ename);
26 DBMS_OUTPUT.put_line ('Job: ' || v_job);
27 DBMS_OUTPUT.put_line ('Manager: ' || n_mgr);
28 DBMS_OUTPUT.put_line ('Hiredate: ' || d_hiredate);
29 DBMS_OUTPUT.put_line ('Salary: ' || n_sal);
30 DBMS_OUTPUT.put_line ('Department: ' || n_deptno);
31 Exception
32 When others then
33 DBMS_OUTPUT.put_line ('Error: ' || sqlerrm);
34 END;
35 /
5. Write a PL/SQL program to accept the Employee Name and display the details of that
Employee including the Department Name.
(oracle emp table)
SQL> DECLARE
2 v_ename varchar2(20):='ADAMS';
3 v_no emp.empno%TYPE;
4 v_job emp.job%TYPE;
5 n_mgr emp.mgr%TYPE;
6 n_sal emp.sal%TYPE;
7 d_hiredate emp.hiredate%TYPE;
8 n_deptno emp.deptno%TYPE;
9 BEGIN
10
11 SELECT empno,
12 job,
13 mgr,
14 hiredate,
15 sal,
16 deptno
17 INTO v_ename,
18 v_job,
19 n_mgr,
20 d_hiredate,
21 n_sal,
22 n_deptno
23 FROM emp
24 WHERE ename = v_ename;
27 DBMS_OUTPUT.put_line ('Job: ' || v_job);
28 DBMS_OUTPUT.put_line ('Manager: ' || n_mgr);
29 DBMS_OUTPUT.put_line ('Hiredate: ' || d_hiredate);
30 DBMS_OUTPUT.put_line ('Salary: ' || n_sal);
31 DBMS_OUTPUT.put_line ('Department: ' || n_deptno);
32 Exception
33 When others then
34 DBMS_OUTPUT.put_line ('Error: ' || sqlerrm);
35 END;
36 /
6. Write a PL/SQL block to increase the salary of employees either by 30 % or 5000
whichever is minimum for a given Department _Code.
SQL> DECLARE
2 C1_SAL NUMBER(10);
3 C2_SAL NUMBER(10);
4 C_SAL STAFF_MASTER.STAFF_SAL%TYPE;
5 CURSOR C_STAFF_MASTER IS SELECT STAFF_SAL FROM STAFF_MASTER WHERE
DEPT_CODE=&DEPT_CODE;
6 BEGIN
7 OPEN C_STAFF_MASTER;
8 LOOP
9 FETCH C_STAFF_MASTER INTO C_SAL;
10 EXIT WHEN C_STAFF_MASTER%NOTFOUND;
11 C1_SAL:=C_SAL*0.3;
12 C2_SAL:=C_SAL+5000;
13 IF C1_SAL>C2_SAL THEN
14 UPDATE STAFF_MASTER SET STAFF_SAL=C2_SAL;
15 ELSE
16 UPDATE STAFF_MASTER SET STAFF_SAL=C1_SAL;
17 END IF;
18 DBMS_OUTPUT.PUT_LINE(C_SAL);
19 END LOOP;
20 CLOSE C_STAFF_MASTER;
21 END;
22 /
7. Find out 30% of salary, if it is more than 5000, increase by 5000. If it is less than 5000,
increase by 30% of salary
(oracle emp table)
CREATE OR REPLACE PROCEDURE SALCAL( NUM IN NUMBER) AS
P NUMBER;
SAL NUMBER;
BEGIN
P := (NUM / 100) * 30;
IF( P > 5000) THEN
SAL := NUM + 5000;
ELSE
SAL := NUM + P;
END IF;
DBMS_OUTPUT.PUT_LINE('UPDATED SALARY : '|| SAL);
END;
/
8. Write a PL/SQL program to check for the commission for an employee no 7369. If no
commission exists, then display the error message. Use Exceptions.
(oracle emp table)
SQL> DECLARE
2 n_empno INTEGER := 7369;
3 v_ename emp.ename%TYPE;
4 v_job emp.job%TYPE;
5 n_mgr emp.mgr%TYPE;
6 n_sal emp.sal%TYPE;
7 d_hiredate emp.hiredate%TYPE;
8 n_deptno emp.deptno%TYPE;
9 n_comm emp.comm%TYPE;
10 BEGIN
11 SELECT comm into n_comm FROM emp WHERE empno = n_empno and empno<>'';
12
13 DBMS_OUTPUT.put_line ('commision for an Employee No 7369: ' || n_comm);
14
15 Exception
16 When others then
17 DBMS_OUTPUT.put_line ('Error: ' || sqlerrm);
18
19 END;
20 /
9. Create Procedure that lists all employees' numbers and name from the 'emp' table
using a cursor
(oracle emp table)
CREATE OR REPLACE PROCEDURE get_infoEmployees
AS
CURSOR employees IS SELECT EMPNO,ENAME FROM EMP;
BEGIN
FOR rec in employees
LOOP
dbms_output.put_line (' Employee NO : ' || rec.EMPNO);
dbms_output.put_line( 'EMPLOYEE NAME :' || rec.ENAME );
END LOOP;
END get_infoEmployees;
/
10. Create Procedure that selects an employee row given the employee
number and displays certain columns
(oracle emp table)
SQL> CREATE OR REPLACE PROCEDURE GETNAME(ECODE IN EMP.EMPNO%TYPE,
EROW OUT EMP%R
OWTYPE) IS
2 BEGIN
3 SELECT * INTO EROW FROM EMP WHERE EMPNO = ECODE;
4 END;
5 /
Procedure created.
SQL> DECLARE
2 EMP_ROW EMP%ROWTYPE;
3 BEGIN
4 GETNAME(7902,EMP_ROW);
5 DBMS_OUTPUT.PUT(EMP_ROW.ENAME || ' ' || EMP_ROW.EMPNO);
6 DBMS_OUTPUT.PUT_LINE(' ' || EMP_ROW.SAL);
7 DBMS_OUTPUT.NEW_LINE;
8 END;
9 /
11. Create Procedure that queries the 'emp' table based on
department number and employee number or name. Returns
employee number and name as IN OUT parameters and job,
hire date, and salary as OUT parameters.
(oracle emp table)
CREATE OR REPLACE PROCEDURE emp_query (
p_deptno IN NUMBER,
p_empno IN OUT NUMBER,
p_ename IN OUT VARCHAR2,
p_job OUT VARCHAR2,
p_hiredate OUT DATE,
p_sal OUT NUMBER
)
IS
BEGIN
SELECT empno, ename, job, hiredate, sal
INTO p_empno, p_ename, p_job, p_hiredate, p_sal
FROM emp
WHERE deptno = p_deptno
AND (empno = p_empno
OR ename = UPPER(p_ename));
END;
/
12. Procedure to call 'emp_query_caller' with IN and IN OUT
parameters. Displays the results received from IN OUT and
OUT parameters.
SQL> CREATE OR REPLACE PROCEDURE emp_query_caller
2 IS
3 v_deptno NUMBER(2);
4 v_empno NUMBER(4);
5 v_ename VARCHAR2(10);
6 v_job VARCHAR2(9);
7 v_hiredate DATE;
8 v_sal NUMBER;
9 BEGIN
10 v_deptno := 30;
11 v_empno := 0;
12 v_ename := 'Martin';
13 emp_query(v_deptno, v_empno, v_ename, v_job, v_hiredate, v_sal);
14 DBMS_OUTPUT.PUT_LINE('Department : ' || v_deptno);
15 DBMS_OUTPUT.PUT_LINE('Employee No: ' || v_empno);
16 DBMS_OUTPUT.PUT_LINE('Name : ' || v_ename);
17 DBMS_OUTPUT.PUT_LINE('Job : ' || v_job);
18 DBMS_OUTPUT.PUT_LINE('Hire Date : ' || v_hiredate);
19 DBMS_OUTPUT.PUT_LINE('Salary : ' || v_sal);
20 EXCEPTION
21 WHEN TOO_MANY_ROWS THEN
22 DBMS_OUTPUT.PUT_LINE('More than one employee was selected');
23 WHEN NO_DATA_FOUND THEN
24 DBMS_OUTPUT.PUT_LINE('No employees were selected');
25 END;
26 /
13. CREATE package with a procedure to find department name of the given employee and
function to calculate net salary of the given employee with below percentages.
(da – 0.3%, hra 0.8%, pf 0.2%)
CREATE OR REPLACE PACKAGE TESTPACKAGE IS
FUNCTION CALCNET(ECODE NUMBER) RETURN NUMBER;
PROCEDURE FIND_DEPARTMENT_NAME(ECODE NUMBER);
END;
/
CREATE OR REPLACE PACKAGE BODY TESTPACKAGE IS
FUNCTION CALCNET(ECODE NUMBER) RETURN NUMBER IS
TSAL NUMBER;
DA NUMBER;
HRA NUMBER;
PF NUMBER;
NSAL NUMBER;
BEGIN
SELECT SAL INTO TSAL FROM EMP WHERE EMPNO = ECODE;
DA := TSAL * 0.3;
HRA := TSAL * 0.8;
PF := TSAL * 0.2;
NSAL := TSAL + DA + HRA - PF;
RETURN NSAL;
END CALCNET;
PROCEDURE FIND_DEPARTMENT_NAME(ECODE NUMBER) IS
DN VARCHAR2(20);
BEGIN
SELECT DNAME INTO DN FROM DEPT WHERE DEPTNO IN (SELECT DEPTNO FROM EMP
WHERE EMPNO = ECODE);
DBMS_OUTPUT.PUT_LINE('DEPARTMENT NAME:'|| DN);
END FIND_DEPARTMENT_NAME;
END TESTPACKAGE;
/
14. Create a after insert trigger to insert a record into log table.
CREATE OR REPLACE TRIGGER T_LOG
AFTER INSERTON EMPLOYEE
FOR EACH ROW
DECLARE
USERNAME VARCHAR2(20);
BEGIN
SELECT USER INTOUSERNAME FROMDUAL;
INSERT INTOE_LOG VALUES(:NEW.EMPNO,:NEW.ENAME,:NEW.SAL,:NEW.JOB,USERNAME);
DBMS_OUTPUT.PUT_LINE('NEW ENTRY ADDED IN E_LOG');
END;
/

More Related Content

What's hot

Mc amca04919 plsql programs
Mc amca04919 plsql programsMc amca04919 plsql programs
Mc amca04919 plsql programs
Ashwin Kumar
 
PHPUnit Myth
PHPUnit MythPHPUnit Myth
PHPUnit Myth
jameslabs
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
Marcello Duarte
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03
Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01
Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 13
Oracle - Program with PL/SQL - Lession 13Oracle - Program with PL/SQL - Lession 13
Oracle - Program with PL/SQL - Lession 13
Thuan Nguyen
 
Lab 07
Lab 07Lab 07
Lab 07
rinkuchat
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
Nawaz Sk
 
Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05
Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10
Thuan Nguyen
 
Practical approach for testing your software with php unit
Practical approach for testing your software with php unitPractical approach for testing your software with php unit
Practical approach for testing your software with php unit
Mario Bittencourt
 
SQL Tuning Overview
SQL Tuning OverviewSQL Tuning Overview
SQL Tuning Overview
Kai Liu
 
Top 40 sql queries for testers
Top 40 sql queries for testersTop 40 sql queries for testers
Top 40 sql queries for testers
tlvd
 
Xenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practicesXenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practices
Lucas Jellema
 
Plsql coding conventions
Plsql coding conventionsPlsql coding conventions
Plsql coding conventions
Fang Yu
 
Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17
Thuan Nguyen
 
Set Focus SQL Portfolio
Set Focus SQL PortfolioSet Focus SQL Portfolio
Set Focus SQL Portfolio
brentbybee
 
Practice create procedure
Practice   create procedurePractice   create procedure
Practice create procedure
cit gubbi
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
vijaybusu
 

What's hot (19)

Mc amca04919 plsql programs
Mc amca04919 plsql programsMc amca04919 plsql programs
Mc amca04919 plsql programs
 
PHPUnit Myth
PHPUnit MythPHPUnit Myth
PHPUnit Myth
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01
 
Oracle - Program with PL/SQL - Lession 13
Oracle - Program with PL/SQL - Lession 13Oracle - Program with PL/SQL - Lession 13
Oracle - Program with PL/SQL - Lession 13
 
Lab 07
Lab 07Lab 07
Lab 07
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
 
Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05
 
Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10
 
Practical approach for testing your software with php unit
Practical approach for testing your software with php unitPractical approach for testing your software with php unit
Practical approach for testing your software with php unit
 
SQL Tuning Overview
SQL Tuning OverviewSQL Tuning Overview
SQL Tuning Overview
 
Top 40 sql queries for testers
Top 40 sql queries for testersTop 40 sql queries for testers
Top 40 sql queries for testers
 
Xenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practicesXenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practices
 
Plsql coding conventions
Plsql coding conventionsPlsql coding conventions
Plsql coding conventions
 
Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17Oracle - Program with PL/SQL - Lession 17
Oracle - Program with PL/SQL - Lession 17
 
Set Focus SQL Portfolio
Set Focus SQL PortfolioSet Focus SQL Portfolio
Set Focus SQL Portfolio
 
Practice create procedure
Practice   create procedurePractice   create procedure
Practice create procedure
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
 

Similar to PLSQL.docx

February0504 pm
February0504 pmFebruary0504 pm
February0504 pm
sankarbpc4918
 
Plsql programs
Plsql programsPlsql programs
Plsql programs(encrypted)
Plsql programs(encrypted)Plsql programs(encrypted)
Plsql programs(encrypted)
Karunakar Singh Thakur
 
Programming in Oracle with PL/SQL
Programming in Oracle with PL/SQLProgramming in Oracle with PL/SQL
Programming in Oracle with PL/SQL
lubna19
 
PL-SQL.pdf
PL-SQL.pdfPL-SQL.pdf
PL-SQL.pdf
Anas Nakash
 
12c Mini Lesson - Improved Error Handling in PLSQL
12c Mini Lesson - Improved Error Handling in PLSQL12c Mini Lesson - Improved Error Handling in PLSQL
12c Mini Lesson - Improved Error Handling in PLSQL
Connor McDonald
 
Oracle
OracleOracle
Oracle
Yo Seven
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptx
metriohanzel
 
SQL-PL
SQL-PLSQL-PL
Sql pl
Sql plSql pl
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
gilpinleeanna
 
A New View of Database Views
A New View of Database ViewsA New View of Database Views
A New View of Database Views
Michael Rosenblum
 
BScPLSQL.pdf
BScPLSQL.pdfBScPLSQL.pdf
BScPLSQL.pdf
DHANUSHTEJVUNNAM
 
PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319
ARVIND SARDAR
 
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 Apurv Gupta, BCA ,Final year , Dezyne E'cole College Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
dezyneecole
 
Oracle trigger
Oracle triggerOracle trigger
Oracle trigger
nasrul28
 
Programming in C Lab
Programming in C LabProgramming in C Lab
Programming in C Lab
Neil Mathew
 
Ss dotnetcodexmpl
Ss dotnetcodexmplSs dotnetcodexmpl
Ss dotnetcodexmpl
rpravi12
 
PLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptxPLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptx
vamsiyadav39
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
jhe04
 

Similar to PLSQL.docx (20)

February0504 pm
February0504 pmFebruary0504 pm
February0504 pm
 
Plsql programs
Plsql programsPlsql programs
Plsql programs
 
Plsql programs(encrypted)
Plsql programs(encrypted)Plsql programs(encrypted)
Plsql programs(encrypted)
 
Programming in Oracle with PL/SQL
Programming in Oracle with PL/SQLProgramming in Oracle with PL/SQL
Programming in Oracle with PL/SQL
 
PL-SQL.pdf
PL-SQL.pdfPL-SQL.pdf
PL-SQL.pdf
 
12c Mini Lesson - Improved Error Handling in PLSQL
12c Mini Lesson - Improved Error Handling in PLSQL12c Mini Lesson - Improved Error Handling in PLSQL
12c Mini Lesson - Improved Error Handling in PLSQL
 
Oracle
OracleOracle
Oracle
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptx
 
SQL-PL
SQL-PLSQL-PL
SQL-PL
 
Sql pl
Sql plSql pl
Sql pl
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
 
A New View of Database Views
A New View of Database ViewsA New View of Database Views
A New View of Database Views
 
BScPLSQL.pdf
BScPLSQL.pdfBScPLSQL.pdf
BScPLSQL.pdf
 
PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319
 
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 Apurv Gupta, BCA ,Final year , Dezyne E'cole College Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 
Oracle trigger
Oracle triggerOracle trigger
Oracle trigger
 
Programming in C Lab
Programming in C LabProgramming in C Lab
Programming in C Lab
 
Ss dotnetcodexmpl
Ss dotnetcodexmplSs dotnetcodexmpl
Ss dotnetcodexmpl
 
PLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptxPLSQLmy Updated (1).pptx
PLSQLmy Updated (1).pptx
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
 

Recently uploaded

Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 

Recently uploaded (20)

Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 

PLSQL.docx

  • 1. PLSQL- Assignment 1. Write a PLSQL Program to find out the greatest of any two numbers ? SQL> DECLARE 2 N1 NUMBER; 3 N2 NUMBER; 4 BEGIN 5 DBMS_OUTPUT.PUT_LINE('ENTER NUMBER'); 6 N1:=&N1; 7 DBMS_OUTPUT.PUT_LINE('ENTER NUMBER'); 8 N2:=&N2; 9 IF N1<N2 THEN 10 DBMS_OUTPUT.PUT_LINE(' '||N2||' IS GREATER THAN '||N1||''); 11 ELSE 12 DBMS_OUTPUT.PUT_LINE(' '||N1||' IS GREATER THAN '||N2||''); 13 END IF; 14 END; 15 / 2. Write a PLSQL Program to enter any number and find out whether it’s positive or negative or zero? SQL> DECLARE 2 N1 NUMBER; 3 BEGIN
  • 2. 4 DBMS_OUTPUT.PUT_LINE('ENTER NUMBER'); 5 N1:=&N1; 6 IF N1>0 THEN 7 DBMS_OUTPUT.PUT_LINE(' '||N1||' is positive'); 8 ELSIF N1=0 THEN 9 DBMS_OUTPUT.PUT_LINE(' '||N1||' is equal to zero'); 10 ELSE 11 DBMS_OUTPUT.PUT_LINE(' '||N1||' is Negative'); 12 END IF; 13 END; 14 / 3. Create PLSQL function and to the factorial of given number ? SQL> CREATE OR REPLACE FUNCTION FACTORIAL(N IN NUMBER) 2 RETURN NUMBER IS F NUMBER(10); 3 BEGIN 4 F:=1; 5 FOR I IN 1..N LOOP 6 F:=F*I; 7 END LOOP; 8 RETURN F; 9 END; 10 / SQL> DECLARE 2 N NUMBER; 3 FACT NUMBER; 4 BEGIN 5 DBMS_OUTPUT.PUT_LINE('ENTER A NUMBER'); 6 N:=&N;
  • 3. 7 FACT:=FACTORIAL(N); 8 DBMS_OUTPUT.PUT_LINE('FACTORIAL OF GIVEN NUMBER IS '||FACT||' '); 9 END; 10 / 4. Write a PL/SQL program to display the details of the employee number 7369 ?. (oracle emp table). SQL> DECLARE 2 n_empno INTEGER := 7369; 3 v_ename emp.ename%TYPE; 4 v_job emp.job%TYPE; 5 n_mgr emp.mgr%TYPE; 6 n_sal emp.sal%TYPE; 7 d_hiredate emp.hiredate%TYPE; 8 n_deptno emp.deptno%TYPE; 9 BEGIN 10 SELECT ename, 11 job, 12 mgr, 13 hiredate, 14 sal, 15 deptno 16 INTO v_ename, 17 v_job,
  • 4. 18 n_mgr, 19 d_hiredate, 20 n_sal, 21 n_deptno 22 FROM emp 23 WHERE empno = n_empno; 25 DBMS_OUTPUT.put_line ('Employee Name: ' || v_ename); 26 DBMS_OUTPUT.put_line ('Job: ' || v_job); 27 DBMS_OUTPUT.put_line ('Manager: ' || n_mgr); 28 DBMS_OUTPUT.put_line ('Hiredate: ' || d_hiredate); 29 DBMS_OUTPUT.put_line ('Salary: ' || n_sal); 30 DBMS_OUTPUT.put_line ('Department: ' || n_deptno); 31 Exception 32 When others then 33 DBMS_OUTPUT.put_line ('Error: ' || sqlerrm); 34 END; 35 / 5. Write a PL/SQL program to accept the Employee Name and display the details of that Employee including the Department Name. (oracle emp table) SQL> DECLARE 2 v_ename varchar2(20):='ADAMS';
  • 5. 3 v_no emp.empno%TYPE; 4 v_job emp.job%TYPE; 5 n_mgr emp.mgr%TYPE; 6 n_sal emp.sal%TYPE; 7 d_hiredate emp.hiredate%TYPE; 8 n_deptno emp.deptno%TYPE; 9 BEGIN 10 11 SELECT empno, 12 job, 13 mgr, 14 hiredate, 15 sal, 16 deptno 17 INTO v_ename, 18 v_job, 19 n_mgr, 20 d_hiredate, 21 n_sal, 22 n_deptno 23 FROM emp 24 WHERE ename = v_ename;
  • 6. 27 DBMS_OUTPUT.put_line ('Job: ' || v_job); 28 DBMS_OUTPUT.put_line ('Manager: ' || n_mgr); 29 DBMS_OUTPUT.put_line ('Hiredate: ' || d_hiredate); 30 DBMS_OUTPUT.put_line ('Salary: ' || n_sal); 31 DBMS_OUTPUT.put_line ('Department: ' || n_deptno); 32 Exception 33 When others then 34 DBMS_OUTPUT.put_line ('Error: ' || sqlerrm); 35 END; 36 / 6. Write a PL/SQL block to increase the salary of employees either by 30 % or 5000 whichever is minimum for a given Department _Code. SQL> DECLARE 2 C1_SAL NUMBER(10); 3 C2_SAL NUMBER(10); 4 C_SAL STAFF_MASTER.STAFF_SAL%TYPE; 5 CURSOR C_STAFF_MASTER IS SELECT STAFF_SAL FROM STAFF_MASTER WHERE DEPT_CODE=&DEPT_CODE; 6 BEGIN 7 OPEN C_STAFF_MASTER; 8 LOOP 9 FETCH C_STAFF_MASTER INTO C_SAL;
  • 7. 10 EXIT WHEN C_STAFF_MASTER%NOTFOUND; 11 C1_SAL:=C_SAL*0.3; 12 C2_SAL:=C_SAL+5000; 13 IF C1_SAL>C2_SAL THEN 14 UPDATE STAFF_MASTER SET STAFF_SAL=C2_SAL; 15 ELSE 16 UPDATE STAFF_MASTER SET STAFF_SAL=C1_SAL; 17 END IF; 18 DBMS_OUTPUT.PUT_LINE(C_SAL); 19 END LOOP; 20 CLOSE C_STAFF_MASTER; 21 END; 22 / 7. Find out 30% of salary, if it is more than 5000, increase by 5000. If it is less than 5000, increase by 30% of salary (oracle emp table) CREATE OR REPLACE PROCEDURE SALCAL( NUM IN NUMBER) AS P NUMBER; SAL NUMBER; BEGIN
  • 8. P := (NUM / 100) * 30; IF( P > 5000) THEN SAL := NUM + 5000; ELSE SAL := NUM + P; END IF; DBMS_OUTPUT.PUT_LINE('UPDATED SALARY : '|| SAL); END; / 8. Write a PL/SQL program to check for the commission for an employee no 7369. If no commission exists, then display the error message. Use Exceptions. (oracle emp table) SQL> DECLARE 2 n_empno INTEGER := 7369; 3 v_ename emp.ename%TYPE; 4 v_job emp.job%TYPE; 5 n_mgr emp.mgr%TYPE; 6 n_sal emp.sal%TYPE; 7 d_hiredate emp.hiredate%TYPE; 8 n_deptno emp.deptno%TYPE;
  • 9. 9 n_comm emp.comm%TYPE; 10 BEGIN 11 SELECT comm into n_comm FROM emp WHERE empno = n_empno and empno<>''; 12 13 DBMS_OUTPUT.put_line ('commision for an Employee No 7369: ' || n_comm); 14 15 Exception 16 When others then 17 DBMS_OUTPUT.put_line ('Error: ' || sqlerrm); 18 19 END; 20 / 9. Create Procedure that lists all employees' numbers and name from the 'emp' table using a cursor (oracle emp table) CREATE OR REPLACE PROCEDURE get_infoEmployees AS CURSOR employees IS SELECT EMPNO,ENAME FROM EMP; BEGIN FOR rec in employees LOOP
  • 10. dbms_output.put_line (' Employee NO : ' || rec.EMPNO); dbms_output.put_line( 'EMPLOYEE NAME :' || rec.ENAME ); END LOOP; END get_infoEmployees; / 10. Create Procedure that selects an employee row given the employee number and displays certain columns (oracle emp table) SQL> CREATE OR REPLACE PROCEDURE GETNAME(ECODE IN EMP.EMPNO%TYPE, EROW OUT EMP%R OWTYPE) IS 2 BEGIN 3 SELECT * INTO EROW FROM EMP WHERE EMPNO = ECODE; 4 END; 5 / Procedure created. SQL> DECLARE 2 EMP_ROW EMP%ROWTYPE; 3 BEGIN 4 GETNAME(7902,EMP_ROW); 5 DBMS_OUTPUT.PUT(EMP_ROW.ENAME || ' ' || EMP_ROW.EMPNO); 6 DBMS_OUTPUT.PUT_LINE(' ' || EMP_ROW.SAL); 7 DBMS_OUTPUT.NEW_LINE; 8 END;
  • 11. 9 / 11. Create Procedure that queries the 'emp' table based on department number and employee number or name. Returns employee number and name as IN OUT parameters and job, hire date, and salary as OUT parameters. (oracle emp table) CREATE OR REPLACE PROCEDURE emp_query ( p_deptno IN NUMBER, p_empno IN OUT NUMBER, p_ename IN OUT VARCHAR2, p_job OUT VARCHAR2, p_hiredate OUT DATE, p_sal OUT NUMBER ) IS BEGIN SELECT empno, ename, job, hiredate, sal INTO p_empno, p_ename, p_job, p_hiredate, p_sal FROM emp WHERE deptno = p_deptno AND (empno = p_empno OR ename = UPPER(p_ename)); END; / 12. Procedure to call 'emp_query_caller' with IN and IN OUT parameters. Displays the results received from IN OUT and OUT parameters. SQL> CREATE OR REPLACE PROCEDURE emp_query_caller
  • 12. 2 IS 3 v_deptno NUMBER(2); 4 v_empno NUMBER(4); 5 v_ename VARCHAR2(10); 6 v_job VARCHAR2(9); 7 v_hiredate DATE; 8 v_sal NUMBER; 9 BEGIN 10 v_deptno := 30; 11 v_empno := 0; 12 v_ename := 'Martin'; 13 emp_query(v_deptno, v_empno, v_ename, v_job, v_hiredate, v_sal); 14 DBMS_OUTPUT.PUT_LINE('Department : ' || v_deptno); 15 DBMS_OUTPUT.PUT_LINE('Employee No: ' || v_empno); 16 DBMS_OUTPUT.PUT_LINE('Name : ' || v_ename); 17 DBMS_OUTPUT.PUT_LINE('Job : ' || v_job); 18 DBMS_OUTPUT.PUT_LINE('Hire Date : ' || v_hiredate); 19 DBMS_OUTPUT.PUT_LINE('Salary : ' || v_sal); 20 EXCEPTION 21 WHEN TOO_MANY_ROWS THEN 22 DBMS_OUTPUT.PUT_LINE('More than one employee was selected'); 23 WHEN NO_DATA_FOUND THEN 24 DBMS_OUTPUT.PUT_LINE('No employees were selected'); 25 END; 26 / 13. CREATE package with a procedure to find department name of the given employee and function to calculate net salary of the given employee with below percentages. (da – 0.3%, hra 0.8%, pf 0.2%) CREATE OR REPLACE PACKAGE TESTPACKAGE IS
  • 13. FUNCTION CALCNET(ECODE NUMBER) RETURN NUMBER; PROCEDURE FIND_DEPARTMENT_NAME(ECODE NUMBER); END; / CREATE OR REPLACE PACKAGE BODY TESTPACKAGE IS FUNCTION CALCNET(ECODE NUMBER) RETURN NUMBER IS TSAL NUMBER; DA NUMBER; HRA NUMBER; PF NUMBER; NSAL NUMBER; BEGIN SELECT SAL INTO TSAL FROM EMP WHERE EMPNO = ECODE; DA := TSAL * 0.3; HRA := TSAL * 0.8; PF := TSAL * 0.2; NSAL := TSAL + DA + HRA - PF; RETURN NSAL; END CALCNET; PROCEDURE FIND_DEPARTMENT_NAME(ECODE NUMBER) IS DN VARCHAR2(20); BEGIN SELECT DNAME INTO DN FROM DEPT WHERE DEPTNO IN (SELECT DEPTNO FROM EMP WHERE EMPNO = ECODE); DBMS_OUTPUT.PUT_LINE('DEPARTMENT NAME:'|| DN); END FIND_DEPARTMENT_NAME; END TESTPACKAGE;
  • 14. / 14. Create a after insert trigger to insert a record into log table. CREATE OR REPLACE TRIGGER T_LOG AFTER INSERTON EMPLOYEE FOR EACH ROW DECLARE USERNAME VARCHAR2(20); BEGIN SELECT USER INTOUSERNAME FROMDUAL; INSERT INTOE_LOG VALUES(:NEW.EMPNO,:NEW.ENAME,:NEW.SAL,:NEW.JOB,USERNAME); DBMS_OUTPUT.PUT_LINE('NEW ENTRY ADDED IN E_LOG'); END; /