使用SQL*PLUS构建完美excel或html输出
转自:http://hong9270503.blog.163.com/blog/static/127292320091611319516/
通过SQL*PLUS我们可以构建友好的输出,满足多样化用户需求。
本例通过简单示例,介绍通过sql*plus输出xls,html两种格式文件.
首先创建两个脚本:
1.main.sql
用以设置环境,调用具体功能脚本
2.功能脚本-get_tables.sql
为实现具体功能之脚本
通过这样两个脚本可以避免spool中的冗余信息.
示例如下:
1.main.sql脚本:
[oracle@jumper utl_file]$ more main.sql
set
linesize 200
set term off verify off feedback off pagesize 999
set
markup html on entmap ON spool on preformat off
spool tables.xls
@get_tables.sql
spool
off
exit
2.get_tables.sql脚本:
[oracle@jumper
utl_file]$ more get_tables.sql
select
owner,table_name,tablespace_name,blocks,last_analyzed
from all_tables
order by 1,2;
3.执行并获得输出:
[oracle@jumper utl_file]$
sqlplus "/ as sysdba" @main
SQL*Plus: Release 9.2.0.4.0 -
Production on Mon Apr 25 10:30:11 2005
Copyright (c) 1982, 2002,
Oracle Corporation. All rights reserved.
Connected to:
Oracle9i
Enterprise Edition Release 9.2.0.4.0 - Production
With the
Partitioning option
JServer Release 9.2.0.4.0 - Production
Disconnected
from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With
the Partitioning option
JServer Release 9.2.0.4.0 - Production
[oracle@jumper
utl_file]$ ls -l tables.xls
-rw-r--r-- 1 oracle dba 69539 Apr 25
10:30 tables.xls
[oracle@jumper utl_file]$
此处输出为xls文件,通过下图我
们可以看到输出效果:
把main.sql脚本中的,spool tables.xls更改为spool
tables.htm,我们可以获得htm格式输出,效果如下图:
相关文档:
http://www.experts-exchange.com/Programming/Languages/C/Q_24038236.html
/* CWebPage.c
This is a Win32 C application (ie, no MFC, WTL, nor even any C++ -- just plain C) that demonstrates
how to embed a browser "control" (actually, an OLE object) in your own window (in order to display a
web p ......
这两个操作默认是被屏蔽了的,需要手动拦截按键消息然后处理。
如果嵌入HTML的窗口拿不到WM_KEYDOWN这样的消息,就只好直接在消息循环里拦截了:
{
while (0 != (r = GetMessage(&msg, NULL, 0, 0))) {
if (r == -1) {
break;
}
if (CheckIfDealCopyPaste(msg)) {
......
1.导出整个数据库
mysqldump -u 用户名 -p 数据库名 > 导出的文件名
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.导出一个表
mysqldump -u 用户名 -p 数据库名 表名> ......
SQL Server 2005 创建到 Oracle10g 的链接服务器
由 lwgboy @ MoFun.CC, 在 08-9-12 下午5:00
标记: linkserver, oracle, sqlserver, 链接服务器
SQL Server 2005 创建到 Oracle10g 的链接服务器
SQL Server 2005 异类数据源(ORACLE10G)链接服务器的建立
本文简述SqlServer 2005 链接到 Oracle10g 服务器的过程及基 ......
如图1、2,id=1的数据是NULL,其他的为非NULL的数据。
一般情况下,会用两种方法!
方法1.t-sql:insert into E values(1,'NULL'),插入后,在打开表的情况下看到的
是'NULL'(我想是为了区分NULL,才加的引号),但是查询的时候不影响,显示的是NULL,
如图1、2,id为6的数据。
如果要插入带单引号的'NULL',insert i ......