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

常用的一些ORACLE命令

查找数据库中所有字段  以对应的表
select C.column_name,C.TABLE_NAME from dba_tab_columns C where owner=''
查每个科目class 分数scro前三名
select id, name, class, scro
   from (select row_number() over(partition by class order by scro desc)  cnt,
                id,
                name,
                class,
                scro
           from student) a
  where a.cnt <= 3;
查找排序后的前三行
  select *
  from (select rw.*, rownum
          from (select *
                  from student d
                 where d.class = 'b'
                 order by d.scro desc) rw
         where rw.id >= 1
         order by rw.class desc) n
where rownum <= 3
表复制
insert into table_a (id,name,age) select b.id,b.name,b.age from table_b;
--删除表数据的触发器
CREATE OR REPLACE PROCEDURE delete_data
IS
BEGIN
   delete from test ;
   COMMIT;
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      NULL;
   WHEN OTHERS
   THEN
      RAISE;
END delete_data;
--定时删除  每隔5分钟执行一次的计划
DECLARE
  X NUMBER;
BEGIN
  SYS.DBMS_JOB.SUBMIT
&nbs


相关文档:

110个Oracle 常用函数的总结

SQL中的单记录函数
1.ASCII
返回与指定的字符对应的十进制数;
SQL> select ascii(A) A,ascii(a) a,ascii(0) zero,ascii( ) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2.CHR
给出整数,返回对应的字符;
SQL> select chr(54740) zhao,chr(65) chr65 from dual;
......

oracle根据主外键查表

select a.constraint_name, a.table_name, b.constraint_name
  from user_constraints a, user_constraints b
where a.constraint_type = 'R'
  and b.constraint_type = 'P'
  and a.r_constraint_name = b.constraint_name
P 代表主键
R 代表外键 ......

ORACLE处理日期大全

在oracle中处理日期大全
  TO_DATE格式  
Day:  
dd number 12  
dy abbreviated fri  
day spelled out friday  
ddspth spelled out, ordinal twelfth  
Month:  
mm number 03  
mon abbreviated mar   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号