You are on page 1of 2

create or replace procedure emp_count_dept_15

is
emp_count int;
begin
select count(*) into emp_count from employee
where dno=5;
dbms_output.put_line('Number of emps from dept 5 is: ' ||emp_count);
end;
/

2. show errors;
3. correct errors
4. create or replace procedure
5. set serveroutput on;
6. exec emp_count_dept5;

create or replace procedure dynamic_proc(e_dno int)


is
e_count int;
Begin
select count(*) into e_count
from employee where dno=e_dno;
dbms_output.put_line('Number of employees from deptno '||e_dno|| ' is '||e_count);
end dynamic_proc;

create or replace procedure proc_empcnt_job


(e_address employee.address%type)
as
ecount int;
begin
select count(*) into ecount from employee
where address=e_address;
dbms_output.put_line('Given address: '|| e_address);
dbms_output.put_line('Number of emps: '|| ecount);
end;

DELETE PROCEDURE PROCEDURE_NAME

TO SEE ALL VIEWS

DESC USER_VIEWS
SELECT VIEW_NAME FROM USER_VIEWS

TO SEE ALL PROCEDURES

DESC USER_PROCEDURES
SELECT OBJECT_NAME FROM USER_PROCEDURES
create or replace procedure dept_mgr(d_no int)
is
mgr_name varchar(20);
begin
select e.fname into mgr_name from employee e, department d

You might also like