随笔分类 - Oracle
摘要:SQL Cookbook 笔记(Oracle)(1)条件选择 case when(2)随机排序 order by dbms_random.value()(3)空值替换 coalesce、nvl(6)null值排序处理 select * from emp t order by t.comm desc 【nulls last | nulls first】(7)条件排序 select * from emp t order by t.job, case when t.job = 'SALESMAN' then comm else sal end desc, t.empno (8)集合.
阅读全文
摘要:详细参考:http://blog.csdn.net/crazyxingjc/article/details/7756299语法:select * from table start with cond1 connect by cond2 where cond3;典型的查询方式:(1)查子节点select t.id, t.pid, t.name from t_tree t start with t.id = 100 --开始节点 connect by prior t.id = t.pid; -- id优先,向下查子节点 -- 或 connect by t.pid = prior t....
阅读全文
摘要:1 sqlplus /nolog; 2 connect / as sysdba; 3 alter user sys identified by newPassword;4 alter user system identified by newPassword;
阅读全文
摘要:trunc,truncate美[trʌŋ'ket]adj. 截短的;被删节的vt. 把…截短;缩短;使成平面--用途:格式化时间、数字--语法:trunc(date/number[, format]) --Oracle trunc()函数的用法/**************日期********************/select trunc(sysdate) from dual --2011-3-18 今天的日期为2011-3-18select trunc(sysdate, 'mm') from dual --2011-3-1 返回当月第一天.select trunc
阅读全文
posted @ 2013-05-06 17:18
sleepyy
摘要:(一)decode--语法:decode( expression , search , result [, search , result]... [, default] )--语意:decode(value, if1, then1, if2, then2, ..., else)--eg. 查询性别代码sex_code,显示为汉字sex,男1女0其他9,对应的decode函数为:select decode(t.sex_code, 1, '男', 0, '女', '其他') sex from t_user t;(二)sign--语法:sign(n)
阅读全文
posted @ 2013-05-06 17:14
sleepyy

浙公网安备 33010602011771号