oracle之把表文件导出成文本文件
1 spool
spool d:\test\table.dat
select * from table_name;
spool off
2 sqlplus user/password@sid @test.sql > table.dat
test.sql
select * from table_name;
exit;
相关文档:
测试table
create table table1 (id int,name char)
insert into table1
select 1,'q'
union all select 2,'r'
union all select 3,'3'
union all select 4,'5'
要求按指定的id顺序(比如2,1,4,3)排列获取table1的数据
方法1:使用union all,但是有256条数据的限制
select id,name from table1 where id=2
union al ......
来源(http://www.javaeye.com/topic/190221)
一、 常用日期数据格式
1.Y或YY或YYY 年的最后一位,两位或三位
SQL> Select to_char(sysdate,'Y') from dual;
TO_CHAR(SYSDATE,'Y')
--------------------
7
SQL> Select to_char(sysdate,'YY') from dual;
TO_CHAR(SYSDATE,'YY')
---------------------
07 ......
使用
set
pagesize 1000
set
linesize 132
col
TS_NAME form a24
col
PIECES form 9999
col
PCT_FREE form 999.9
col
PCT_USED form 999.9
select
*
from (select Q2.OTHER_TNAME TS_NAME,
PIECES,
& ......
oracle 日期函数
在oracle数据库的开发中,常因为时间的问题大费周章,所以特地将ORACLE数据的日期函数收藏致此。乃供
他日所查也。
add_months(d,n) 日期d加n个月
last_day(d) 包含d的月?的最后一天的日期
new_time(d,a,b) a?区的日期和??d在b?区的日期和??
next_day(d,day) 比 ......