set echo on/off 是否显示脚本中的需要执行的命令
set feedback on/off 是否显示 select 结果之后返回多少行的提示
set linesize n 设置一行最多显示多少字符,之前就是因为 n 设得过大,导致行与行之间有空白行
set termout on/off 在执行脚本时是否在屏幕上输出结果,如果 spool 到文件可以将其关闭
set heading on/off 是否显示查询结果的列名,如果设置为 off,将用空白行代替,如果要去除该空白行,可以用 set pagesize 0
set pagesize n 设置每页的行数,将 n 设为 0 可以不显示所有 headings, page breaks, titles, the initial blank line, and other formatting information
set trimspool on/off 在 spool 到文件时是否去除输出结果中行末尾的空白字符,之前的隔行可以用该参数去掉,和该参数对应的是 trimout,后者用于屏幕输出
set trimout on/off 是否去掉屏幕上输出结果行末尾的空白字符
1/.建临时表
create table tmp_phone_20080301_log_exp as select USER_MSISDN, case when instr( user_agent,'/') >0 then --instr(user_agent,'/') substr( user_agent,0,instr(user_agent,'/')-1) else user_agent end phone, incoming_request_time from tmp_phone_20080301_remain_log t group by USER_MSISDN, user_agent , inc
2/.sqlplus格式调整:
set echo off
set linesize 300
set heading on/off 是否显示查询结果的列名,如果设置为 off,将用空白行代替,如果要去除该空白行,可以用 set pagesize 0
3/.spool /home/oracle/MSISDN_UA_TOP5.csv
4/. select user_msisdn||','||phone||','||to_char(incoming_request_time,'yyyy-mm-dd hh24:mi:Ss') from tmp_phone_20080301_log_exp where MOD(to_number(user_msisdn),10) = 1 ;
5/. spool off - peterbull peter on 2008-03-06