Created
June 26, 2018 07:56
-
-
Save abrarShariar/2960c8470e9cbc0b261e9e39e3d67e20 to your computer and use it in GitHub Desktop.
PLSQL lab tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe emp; | |
describe dept; | |
select emp.empno from emp; | |
-- 1 | |
DECLARE | |
e_no emp.empno % TYPE := :input_no; | |
ename emp.ename % TYPE; | |
job emp.job % TYPE; | |
hiredate emp.hiredate % TYPE; | |
BEGIN | |
select e.ename, e.hiredate, e.job into ename, hiredate, job from emp e where e.empno = e_no; | |
dbms_output.put_line(ename || hiredate || job); | |
END | |
-- 2 | |
DECLARE | |
dept_no emp.deptno % TYPE := input; | |
total_emp number(100); | |
salary_sum number(100); | |
BEGIN | |
select count(e.empno), sum() from emp e | |
join dept d | |
on e.deptno = d.deptno | |
group by e.deptno having e.deptno = dept_no | |
END; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment