Oracle
程序员豆奶
后端程序员,Java,Python.
展开
-
ORACLE in与exists语句的区别(一)
select * from Awhere id in(select id from B)以上查询使用了in语句,in()只执行一次,它查出B表中的所有id字段并缓存起来.之后,检查A表的id是否与B表中的id相等,如果相等则将A表的记录加入结果集中,直到遍历完A表的所有记录.它的查询过程类似于以下过程List resultSet=[];Array A=(select * from A);Array...转载 2018-04-24 11:09:40 · 933 阅读 · 0 评论 -
Oracle trunc()函数的用法
--Oracle trunc()函数的用法/**************日期********************/1.select trunc(sysdate) from dual --2013-01-06 今天的日期为2013-01-062.select trunc(sysdate, 'mm') from dual --2013-01-01 返回当月第一天.3.select trunc(sy...转载 2018-04-24 19:16:41 · 684 阅读 · 0 评论 -
oracle数字转为字符串
oracle数字转为字符串.SQL> select ename,to_char(sal,'9999.000') salary from emp;ENAME SALARY---------- --------------------SMITH 808.000ALLEN 1608.000SQL> select ename,to_char(sal,'$00099999000.00' ) sa...转载 2018-04-25 10:31:52 · 22101 阅读 · 0 评论 -
Oracle 模糊查询
oracle: select * from a where a.name like b.name || '%'语义同 MySQL: select * from a where a.name like b.name +'%'原创 2018-04-25 15:36:21 · 537 阅读 · 0 评论 -
Oracle (+) 用法
一 加在字段后面oracle 中d.biz_id =e.case_id(+)相当于:select xxx from d left join e on d.biz_id =e.case_id二 加在表名后面SELECT a.*, b.* from a(+) = b就是一个右连接,等同于select a.*, b.* from a right join bSELECT a.*, b.* from...原创 2018-05-04 10:26:38 · 448 阅读 · 0 评论 -
oracle 存储过程遍历数据
摘要: Oracle存储过程,自定义数据类型,集合,遍历取值0.前言 在Oracle的存储过程中,可能会遇到数据处理,假如我们目前的功能在一个Packages中 Packages封装了多个不同功能的Procedure,我们在一个Procedure里面进行统计 在另外一个Procedure进行计算 这就需要一个存放结果集的地方 以前的解决方案是:建立了一个临时表...转载 2018-05-04 19:00:15 · 7939 阅读 · 0 评论 -
oracle的select into
1:冒号等于赋值 单个赋值declare v_name varchar2(10);beginv_name:='梦梦';2:select into 赋值select 列名 into 变量名 from 表名 where 条件2.1 select a(值1), b(值2),c(值3) into d,e,f from emp(表名) where id=xxx;注意点: 1:select a(值1), b(...转载 2018-05-07 11:00:03 · 14248 阅读 · 0 评论