Oracle使用筆記

2022-06-23 21:57:12 字數 495 閱讀 3990

1. nvl 函式 lnv(val,rep_val)

if (val) 字段值 ==null  返回  rep_val 

例:  user表

id            name         age 

1             atimo          18

2             null              20

select nvl(name,sys_name) from user where id=2

結果 : sys_name (替換null值)

2. nvl2(字段,值1,值2)

若字段值為null 返回 值1 不為null 返回值2 (即不返回原始值)

3. decode(value,if1,then1,if2,then2,if3,then3,...,else)

decode(條件,值1,返回值1,值2,返回值2,...值n,返回值n,預設值)

Oracle 使用筆記

原理 for each row r a in table a outer table for each rowr bintable b inner table ifr ajoin withr bthen return r a r b 適用範圍 a.outer table很小 or b.inner t...

oracle使用筆記

1 scott解鎖 alter user scott identified by tiger alter user scott account unlock 2 導表 d oracle table.sql 3 檢視表結構 desc table 4 連線資料 hello world 5 去重 dist...

oracle使用筆記

一.判斷某個欄位是另外的值的時候,返回另外的值 decode函式 decode value,if1,then1,if2,then2,if2,then2,else 表示如果value等於if1時,decode函式的結果返回then1,如果不等於任何乙個if值,則返回else。參考文章 二.oracle...