getcode
set feedback off
set heading off
set termout off
set linesize
set trimspool on
set verify off
spool &
prompt set define off
select decode( type||
null) ||
decode(line
text text
from user_source
where name = upper(
order by type
prompt /
prompt set define on
spool off
set feedback on
set heading on
set termout on
set linesize
############################################################
getallcode
set termout off
set heading off
set feedback off
set linesize
spool xtmpx
select
from user_objects
where object_type in (
/
spool off
spool getallcode_INSTALL
select
from user_objects
where object_type in (
/
spool off
set heading on
set feedback on
set linesize
set termout on
@xtmpx
############################################################
getaview
set heading off
set feedback off
set linesize
set trimspool on
set verify off
set termout off
set embedded on
set long
column column_name format a
column text format a
spool &
prompt create or replace view &
select decode(column_id
from user_tab_columns
where table_name = upper(
order by column_id
/
prompt ) as
select text
from user_views
where view_name = upper(
/
prompt /
spool off
set heading on
set feedback on
set verify on
set termout on
############################################################
getallview
set heading off
set feedback off
set linesize
set trimspool on
set verify off
set termout off
set embedded on
spool tmp
select
from user_views
/
spool off
set termout on
set heading on
set feedback on
set verify on
@tmp
##########################################################
gettrig
set heading off
set feedback off
set linesize
set trimspool on
set verify off
set termout off
set embedded on
spool &
select
trigger_name||
decode(substr(trigger_type
CHR(
triggering_event||chr(
table_name||
decode(instr(trigger_type
trigger_body
from user_triggers
where trigger_name = upper(
/
prompt /
spool off
set verify on
set feedback on
set termout on
set heading on
#################################################################
analyze
set serveroutput on size
declare
v_per number(
v_start number := dbms_utility
v_end number;
begin
for rec in (select segment_name
from user_segments group by segment_name
loop
if rec
dbms_stats
INDNAME=>rec
);
v_start := dbms_utility
elsif rec
case when rec
v_per :=
when rec
v_per :=
else
v_per :=
end case;
dbms_stats
TABNAME=>rec
ESTIMATE_PERCENT=>v_per
METHOD_OPT=>
v_start := dbms_utility
end if;
end loop;
end;
/
###############################################################
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 :
From:http://tw.wingwit.com/Article/program/Oracle/201311/16718.html