Oracle11g SQLPLUS支持直接显示Blob数据
在Oracle10g及以前版本的sqlplus中,不能直接显示blob或者bfile类型的数据:
SQL> create table t(b blob);
Table created.
SQL> insert into t values('1');
1 row created.
SQL> select * from t;
SP2-0678: Column or attribute type can not be displayed by SQL*Plus
Table created.
SQL> insert into t values('1');
1 row created.
SQL> select * from t;
SP2-0678: Column or attribute type can not be displayed by SQL*Plus
Oracle11g中,sqlplus的这个限制已经取消,可以在sqlplus中直接显示blob和bfile类型的数据:
SQL> create table t(b blob);
Table created.
SQL> insert into t values('1');
1 row created.
SQL> select * from t;
B
-----------------
1
Table created.
SQL> insert into t values('1');
1 row created.
SQL> select * from t;
B
-----------------
1
sqlplus小窍门:脚本搜索路径
默认情况下,在sqlplus中通过start或者@调用脚本时,只会在系统当前工作路径中搜索脚本,例如下面的例子中,必须将脚本t.sql放到d:\目录下,否则将报错。
D:\>sqlplus ning/ning@orcl
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 24 13:35:21 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
NING@orcl>@t
I
----------
1
NING@orcl>@tt
SP2-0310: unable to open file "tt.sql"
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 24 13:35:21 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
NING@orcl>@t
I
----------
1
NING@orcl>@tt
SP2-0310: unable to open file "tt.sql"
sqlplus小窍门:生成html报告
通过设置markup html属性,可以将sqlplus的输出spool成html格式。
将如下脚本保存为html.sql
set markup HTML on
spool index.html
select * from test where rownum<11;
spool off
set markup HTML off
然后执行
NinGoo@windows>@html
sqlplus小窍门:还原session设置
sqlplus中有很多设置,可以通过set来更改,当然,更改只对当前session生效。
通过show all可以查看当前session的所有设置