orcale sql常用语句

1. case .. when .. then .. end Oracle CASE WHEN 用法介绍

 1 select nvl(sum(case p.need_mistake_audit_level

 2                  when 1 then

 3                   (case

 4                     when mis.audit_status in (-1, 0) then

 5                      1

 6                     else

 7                      0

 8                   end)

 9                  when 2 then

10                   (case

11                     when mis.audit_status in (-1, 0) or

12                          (mis.audit_status in (1) and mis.audit_status2 in (0, 3)) then

13                      1

14                     else

15                      0

16                   end)

17                  else

18                   0

19                end),

20            0) status

21   from base_mistake mis

22   left join permission_sgdac p

23     on mis.sec_id = p.id

24  where mis.data_table = 'XXX'

25    and mis.data_column = 'OOO'

26    and mis.data_id = '8612bada1581445796a8f644d65c7968';

 2.  Ruthless的 oracle 博文

oracle初级系列教程

oracle中级系列教程

oracle高级系列教程

oracle分析函数

3. 账户相关操作

查询数据库账户信息:select a.username, a.password, a.lock_date, a.account_status from dba_users a;

给指定用户解锁:ALTER USER scott ACCOUNT UNLOCK;

使用ALTER USER语句为scott账户设置口令:ALTER USER scott IDENTIFIED BY tiger;

 Oracle查询用户所有表

你可能感兴趣的:(orcale)