CREATE OR REPLACE PACKAGE USERS as
TYPE u_type is record
(
uname VARCHAR2(30 BYTE),
uuser number,
uctime date,
uptime date,
uexptime date,
ultime date
);
TYPE ut_type is table of u_type;
function statistika return ut_type pipelined;
end users;
/
CREATE OR REPLACE PACKAGE BODY USERS as
function statistika return ut_type pipelined
as
begin
FOR rec in (
select u.name ,u.user#,
u.ctime, u.ptime, u.exptime, u.ltime
from sys.user$ u, sys.ts$ dts, sys.ts$ tts
where u.name = user
and u.datats# = dts.ts#
and u.tempts# = tts.ts#
and u.type# = 1
)
loop
pipe row(rec);
end loop;
end;
end users;
/
SQL> select * from table(users.statistika)
UNAME UUSER UCTIME UPTIME UEXPTIME ULTIME
--------------------- ----------- ------------------------------ ----------------------------- ---------------- -----------
Я ЛЮБИМЫЙ 10 08.03.2000 11:48:45 08.03.2000 11:48:45
|