易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle中实现主键自动生成

 ID是主健,实现插入一个NAME,ID自动增加
SQL>   create   table   t1  
      2     (  
      3         id       number,  
      4         name   varchar2(10)  
      5     )  
      6     ;  
 SQL>   create   sequence   T1ID_SEQ  
      2     minvalue   1  
      3     maxvalue   999999  
      4     start   with   1  
      5     increment   by   1  
      6     cache   20  
      7     ;
创建触发器
sql> create or replace trigger tr
 before insert on table for each row
 begin
  select to_char(seq.nextval) into :new.id form dual;
 end tr;
 /


相关文档:

Oracle 多表连接子查询

1.求部门中哪些人薪水最高:
select ename,sal
from emp join
(
    select max(sal) max_sal, deptno
    from emp
    group by deptno
) t
on (emp.sal = t.max_sal and emp.deptno = t.deptno);
2.求部门平均薪水的等级:
select deptno, avg_sal, grade ......

ORACLE to_char函数详解

 The following are number examples for the to_char function.
to_char(1210.73, '9999.9')
would return '1210.7'
to_char(1210.73, '9,999.99')
would return '1,210.73'
to_char(1210.73, '$9,999.00')
would return '$1,210.73'
to_char(21, '000099')
would return '000021'
The following is a list ......

Oracle 移动数据文件的操作方法


将表空间和数据文件从一个位置移动到另一个位置的操作方法
一. OFFLINE
OFFLINE 分为ALTER DATABASE 与 ALTER TABLESPACE OFFLINE,
他们的区别参看blog:http://blog.csdn.net/tianlesoftware/archive/2009/11/29/4898800.aspx
按数据文件来:
1.先将相应的数据文件 offl ......

Oracle 中的 TO_DATE 和 TO_CHAR 函数

oracle 中 TO_DATE 函数的时间格式,以 2008-09-10 23:45:56 为例

格式
说明
显示值
备注

 
Year(年):
yy
two digits(两位年)
08
 
yyy
three digits(三位年)
008
 
yyyy
four digits(四位年)
2008
 
 
Month(月):
mm
number(两位月)
09
 
mon
abbre ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号