create or replace package types
as
   type cursorType is ref cursor;
end;
/

create or replace procedure outin (p_cursor OUT types.cursorType,deptnum IN VARCHAR2)
is
begin
	open p_cursor for select * from EDepartment where deptid=deptnum;
end;
/
create or replace procedure inout (deptnum IN VARCHAR2,p_cursor OUT types.cursorType)
is
begin
	open p_cursor for select * from EDepartment where deptid=deptnum;
end;
/
create or replace procedure inoutvarchar (deptnum IN VARCHAR2,p_cursor OUT VARCHAR2)
is
begin
	select name into p_cursor from EDepartment where deptid=deptnum;
end;
/

create or replace procedure fourout ( p_cursor OUT types.cursorType, aname OUT VARCHAR2, deptnum OUT VARCHAR2, pall OUT types.cursorType )
is
begin
	select name into aname from EDepartment where deptid='glasses';
	select deptid into deptnum from EDepartment where name='Hardware';
	open p_cursor for select name, deptid from EDepartment;
	open pall for select * from EDepartment;
end;
/

create or replace procedure insertfield 
is
begin
	insert into EDepartment values ('clothes', 'new Fashion', 'none');
end;
/
create or replace procedure insertfieldparam(adeptid IN VARCHAR2, aname IN VARCHAR2 )
is
begin
	insert into EDepartment values (adeptid, aname, 'none');
end;
/

create or replace function flist return types.cursortype
as
   l_cursor   types.cursorType;
begin
   open l_cursor for select * from EDepartment;
   return l_cursor;
end;
/