日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle中isnumber函数,Oracle 函数isnumber问题

發布時間:2023/12/10 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle中isnumber函数,Oracle 函数isnumber问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Oracle中怎么判斷一列數據是否為數字類型, 沒有isnumber()這樣的函數, to_number()的時候又會出錯, 想找到是那行數據導致出現to_number()出問題了, 怎么辦?

我簡單的google了以下, 看到:

簡單的SQL:

select aa.rowid, instr(translate(aa.a,

'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',

'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X') as IS_A

FROM aa

對于一列中的其他特殊字符就得自己添加到Z后面了,要理解上面SQL的含義先理解幾個Oracle函數了:

---------------

translate( string1, string_to_replace, replacement_string )

string1 is the string to replace a sequence of characters with another set of characters.

string_to_replace is the string that will be searched for in string1.

replacement_string - All characters in the string_to_replace will be replaced with the corresponding character in the replacement_string.

Applies To:

* Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g

For example:

translate('1tech23', '123', '456); ?? ?would return '4tech56'

translate('222tech, '2ec', '3it'); ?? ?would return '333tith'

---------

instr( string1, string2 [, start_position [, nth_appearance ] ] )

string1 is the string to search.

string2 is the substring to search for in string1.

start_position is the position in string1 where the search will start. This argument is optional. If omitted, it defaults to 1. The first position in the string is 1. If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1.

nth_appearance is the nth appearance of string2. This is optional. If omitted, it defaults to 1.

Note:

If string2 is not found in string1, then the instr Oracle function will return 0.

Applies To:

* Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g

For example:

instr('Tech on the net', 'e') ?? ?would return 2; the first occurrence of 'e'

instr('Tech on the net', 'e', 1, 1) ?? ?would return 2; the first occurrence of 'e'

instr('Tech on the net', 'e', 1, 2) ?? ?would return 11; the second occurrence of 'e'

instr('Tech on the net', 'e', 1, 3) ?? ?would return 14; the third occurrence of 'e'

instr('Tech on the net', 'e', -3, 2) ?? ?would return 2.

自己簡單的測試了以下:

select to_number('3 3') from dual;

也會出問題了, 就將空格添加到上面的SQL中就可以了。

select aa.rowid, instr(translate(aa.a,

'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ',

'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X') as IS_A

FROM aa

閱讀(4107) | 評論(1) | 轉發(0) |

總結

以上是生活随笔為你收集整理的oracle中isnumber函数,Oracle 函数isnumber问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。