首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

定义自个儿的login.sql

2012-08-02 
定义自己的login.sql 本login.sql是参考tom大师的login.sql根据自己的习惯编写的REM turn off the termina

定义自己的login.sql

 本login.sql是参考tom大师的login.sql根据自己的习惯编写的

REM turn off the terminal output - make it so SQLPlus does notREM print out anything when we log inset termout offREM default your editor here.  SQLPlus has many individual settingsREM This is one of the most important onesdefine _editor=viREM serveroutput controls whether your DBMS_OUTPUT.PUT_LINE callsREM go into the bit bucket (serveroutput off) or get displayedREM on screen.  I always want serveroutput set on and as bigREM as possible - this does that.  The format wrapped elementsREM causes SQLPlus to preserve leading whitespace - very usefulset serveroutput on size 1000000 format wrappedREM Here I set some default column widths for commonly queriedREM columns - columns I find myself setting frequently, day after daycolumn object_name format a30column segment_name format a30column file_name format a40column name format a30column file_name format a30column what format a30 word_wrappedcolumn plan_plus_exp format a100REM by default, a spool file is a fixed width file with lots ofREM trailing blanks.  Trimspool removes these trailing blanksREM making the spool file significantly smallerset trimspool onREM LONG controls how much of a LONG or CLOB sqlplus displaysREM by default.  It defaults to 80 characters which in generalREM is far too small.  I use the first 5000 characters by defaultSet long 5000REM This sets the default width at which sqlplus wraps output.REM I use a telnet client that can go upto 200 characters wide -REM hence this is my preferred setting.set linesize 200REM SQLplus will print column headings every N lines of outputREM this defaults to 14 lines.  I find that they just clutter myREM screen so this setting effectively disables them for allREM intents and purposes - except for the first page of courseset pagesize 9999REM MY SQL_NAME , it different from tom ,it prefer to hostname/username@databaseREM here is how I set my signature prompt in sqlplus toREM username@database>   I use the NEW_VALUE concept to formatREM a nice prompt string that defaults to IDLE (useful for thoseREM of you that use sqlplus to startup their databases - theREM prompt will default to idle> if your database isn't started)define gname=idlecolumn global_name new_value gnameselect sys_context('userenv', 'host')||'/'||lower(user) || '@' ||       substr( global_name, 1, decode( dot,                                       0, length(global_name),                                          dot-1) ) global_name  from (select global_name, instr(global_name,'.') dot          from global_name );set sqlprompt '&gname> 'REM and lastly, we'll put termout back on so sqlplus printsREM to the screenset termout on


热点排行