oracle函式 轉換函式

2021-08-30 00:27:15 字數 848 閱讀 2688

1、asciistr(str)

說明:將任意字符集的字串轉換為當前資料庫例項對應的ascii字串。

select asciistr('中華民族') from dual;

備註:和該函式相似的有ascii,它是取得字串第乙個字元的ascii碼,後面的字元不管;chr是將ascii碼轉換為對應的字元。

2、cast()

說明:將乙個內建資料型別或集合型別轉變為另乙個內建資料型別或集合型別。

select cast(sysdate as varchar2(100)) from dual;

3、chartorowid(str)

說明:將字串轉變為rowid資料型別,但字串必須符合rowid格式。

4、convert(str,char_set,source_char_set)

說明:將字串從乙個字符集轉變為另乙個字符集。str為要轉變的字串,char_set為轉變後的字符集,source_char_set為該字串原始的字符集。

select convert('中國','us7ascii','zhs16gbk') from dual;

4、rowidtochar(rowid)

說明:將rowid轉換為對應的varchar2資料型別值。

5、to_char()

select to_char(n』中國』) from dual; 轉變為本地字符集型別

select to_char(10000,』l99g999d99mi』) from dual; 轉換成貨幣格式

6、to_date()

轉變為日期格式。

7、to_number()

將字串轉變為數字值,但字串必須是數字(0~9)。

oracle轉換函式

我的日誌 分類 oracle 應用 開發聚寶盆 2007.5.29 17 34 作者 獨上層樓 說明 將任意字符集的字串轉換為當前資料庫例項對應的 ascii 字串。select asciistr 中華民族 from dual 備註 和該函式相似的有 ascii,它是取得字串第乙個字元的 ascii...

Oracle 轉換函式

oracle函式知識 轉換函式,轉換函式將值從一種資料型別轉換為另外一種資料型別。常用的轉換函式有 1.to char d n fmt 把日期和數字轉換為制定格式的字串。fmt是格式化字串,日期的格式化字串前面已經學習過。演示 to char對日期的處理 sql select to char sys...

Oracle 轉換函式

1.asciistr asciistr x 將x轉換為ascii字串。select asciistr abc from dual asciistr abc abc2.bin to num bin to num 將二進位制數x轉換為number型別 select bin to num 1,0,1 fr...