2013年1月6日

对300万一张表数据,用游标进行循环,不同写法的效率比较

摘要: 对300万一张表数据,用游标进行循环,不同写法的效率比较1、显示游标declare cursor cur_2 is select a.cust_name from ea_cust.cust_info a; cust_id varchar2(100); begin open cur_2; loop fetch cur_2 into cust_id; exit when cur_2%notfound; NULL; end loop; close cur_2;end;--耗时48秒2、隐式游标declare begin for cur_2 in (select c.c... 阅读全文

posted @ 2013-01-06 18:12 Code changes life 阅读(1739) 评论(2) 推荐(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(sysdate,'yy') from dual --2013-01-01 返回当年第一天4.select trunc(sysdate,'dd') from 阅读全文

posted @ 2013-01-06 17:39 Code changes life 阅读(169112) 评论(1) 推荐(7) 编辑

oracle行列转换

摘要: Oracle 行列转换1、固定列数的行列转换如student subject grade--------- ---------- --------student1 语文 80student1 数学 70student1 英语 60student2 语文 90student2 数学 80student2 英语 100……转换为语文 数学 英语student1 80 70 60student2 90 80 100……语句如下:select student,sum(decode(subject,'语文', grade,null)) "语文",sum(decode( 阅读全文

posted @ 2013-01-06 16:38 Code changes life 阅读(2494) 评论(0) 推荐(0) 编辑

导航