要學的東西很多,一直在努力中............!
希望佛祖赐予我智慧吧!阿门!!!
PLSQL常用方法汇总
上一篇 /
下一篇 2008-06-05 16:46:37
/ 个人分类:ORACLE 開發
在SQLPLUS下,实现中-英字符集转换
`"l8@dWv0alter session set nls_language='AMERICAN';ITPUB个人空间,p,f8hM#l M BB
alter session set nls_language='SIMPLIFIED CHINESE';ITPUB个人空间G(O5A3|CN lZ
主要知识点:
U_
w6b^@0一、有关表的操作ITPUB个人空间E6P"k4c!a~[
g
1)建表
)S BHQ#u0create table test as select * from dept; --从已知表复制数据和结构ITPUB个人空间5@7jTz5~!EK@
create table test as select * from dept where 1=2; --从已知表复制结构但不包括数据ITPUB个人空间 H5Vo-~T9~~
ga}/h
2)插入数据:ITPUB个人空间-k
G-fNE
insert into test select * from dept;
K \p6?^6U i4Yw0二、运算符ITPUB个人空间E6K8?Zh0Q/~
算术运算符:+ - * / 可以在select 语句中使用
l/Y7w+Q.][3J8k7T"Fb0连接运算符:|| select deptno|| dname from dept;
`ZUS sM|;J0比较运算符:> >= = != < <= like between is null in
6Lv&vi|!wXF!h0逻辑运算符:not and or
V,q4q`
}F&_0集合运算符: intersect ,union, union all, minus
I4l.{lp1tO
?0要求:对应集合的列数和数据类型相同
^y"m!|wCM*Gg0查询中不能包含long 列
4z9Yi
lF0列的标签是第一个集合的标签
3ra/R4c A&P0使用order by时,必须使用位置序号,不能使用列名ITPUB个人空间+_-ju Iv1gh(p
例:集合运算符的使用:ITPUB个人空间$I3mEax{ {
intersect ,union, union all, minus
2sA'ZT,a0|7HZu)W0select * from emp intersect select * from emp where deptno=10 ;
8[F!jV+k,k0select * from emp minus select * from emp where deptno=10;ITPUB个人空间Xd
i7hR2A
select * from emp where deptno=10 union select * from emp where deptno in (10,20); --不包括重复行ITPUB个人空间s9v2_'|9Ws8X,^U{
select * from emp where deptno=10 union all select * from emp where deptno in (10,20); --包括重复行
7V&CfpjG+z0ITPUB个人空间.b9[6F qJ7` mG$gu%{
三,常用 ORACLE 函数
o-{zg3Sc0sysdate为系统日期 dual为虚表