print_table
create or replace
procedure print_table( p_query in varchar
AUTHID CURRENT_USER
is
l_theCursor integer default dbms_sql
l_columnValue varchar
l_status integer;
l_descTbl dbms_sql
l_colCnt number;
begin
dbms_sql
dbms_sql
for i in
dbms_sql
end loop;
l_status := dbms_sql
while ( dbms_sql
for i in
lumn_value( l_theCursor
dbms_output
||
l_columnValue );
end loop;
dbms_output
end loop;
exception
when others then
dbms_sql
RAISE;
end;
/
grant execute on print_table to public;
例如:
一行記錄顯示如下:
ADMIN_MEMBER_ID : dealexpress
VIEW_NAME : Deal Express
BUSINESS_TYPE :
FIRST_NAME : Tim
LAST_NAME : Horton
JOB_TITLE :
PROVINCE : Wisconsin
COUNTRY : US
PHONE_COUNTRY :
PHONE_AREA :
PHONE_NUMBER :
FAX_COUNTRY :
FAX_AREA :
FAX_NUMBER :
MOBILE_NO :
ZIP :
ADDRESS :
CITY : Columbus
#######################################################
show_space
create or replace
procedure show_space
( p_segname in varchar
p_owner in varchar
p_type in varchar
p_partition in varchar
authid current_user
as
l_free_blks number;
l_total_blocks number;
l_total_bytes number;
l_unused_blocks number;
l_unused_bytes number;
l_LastUsedExtFileId number;
l_LastUsedExtBlockId number;
l_LAST_USED_BLOCK number;
procedure p( p_label in varchar
is
begin
dbms_output
p_num );
end;
begin
for x in ( select tablespace_name
from user_tablespaces
where tablespace_name = ( select tablespace_name
from user_segments
where segment_type = p_type
and segment_name = p_segname
and SEGMENT_SPACE_MANAGEMENT <>
)
loop
dbms_space
( segment_owner => p_owner
segment_name => p_segname
segment_type => p_type
partition_name => p_partition
freelist_group_id =>
free_blks => l_free_blks );
end loop;
dbms_space
( segment_owner => p_owner
segment_name => p_segname
segment_type => p_type
partition_name => p_partition
total_blocks => l_total_blocks
total_bytes => l_total_bytes
unused_blocks => l_unused_blocks
unused_bytes => l_unused_bytes
LAST_USED_EXTENT_FILE_ID => l_LastUsedExtFileId
LAST_USED_EXTENT_BLOCK_ID => l_LastUsedExtBlockId
LAST_USED_BLOCK => l_LAST_USED_BLOCK );
p(
p(
p(
p(
p(
p(
p(
p(
p(
end;
#######################################################################
moveall
set echo off
column order_col
column order_col
set heading off
set verify off
set feedback off
set echo off
spool move_build_tpcrm
!date
select decode( segment_type
segment_name
decode( segment_type
decode( segment_type
from user_segments
(select table_name
where segment_type in (
and segment_name = index_name (+)
and tablespace_name in
(自己選擇的表空間)
order by
/
!date
spool off
set heading on
set verify on
set feedback on
set echo on
REM UNCOMMENT TO AUTO RUN the generated commands
REM ELSE edit move_build
From:http://tw.wingwit.com/Article/program/Oracle/201311/17641.html