在oracle中如何用一條select語句查詢欄位中非純

時間 2021-10-14 22:24:01

1樓:匿名使用者

--1.正則判斷,適用於10g以上版本

--非正整數

select 欄位 from 表 where regexp_replace(欄位,'\d','') is not null;

--非數值型別

select 欄位 from 表 where regexp_replace(欄位,'^[-\+]?\d+(\.\d+)?$','') is not null;

--2.自定義函式,判斷非值型別

create or replace function isnumber(col varchar2) return integer is

i number;

begin

i := to_number(col);

return 1;

exception

when others then

return 0;

end;

select 欄位 from 表 where isnumber(欄位)=0;

2樓:匿名使用者

where isnumeric(欄位)>0 是純數字的

where ( isnumeric(欄位)<0 or 欄位為null)非純數字的值,包括空值

3樓:匿名使用者

create function is_integer(in_varchar in varchar2) return integer as

flag integer;

i    integer;

begin

for i in 1 .. length(in_varchar) loop

if ascii(substr(in_varchar,i,1))>= 48 and

ascii(substr(in_varchar,i,1))<= 57 then

flag:= 0;

else

flag:= -1;

exit;

end if;

end loop;

return flag;

end is_integer;

自己親測,有圖有真相,希望能幫助到你。

4樓:匿名使用者

select *

from table_name

where translate(column_name,'#0123456789','#') is not null or column_name is null

oracle怎麼在字元欄位中查出只包含數字的資料

5樓:匿名使用者

如果你的條件不允許你寫plsql函式的話,就用正規表示式,如下:

select *

from table

where regexp_substr(check, '^[0-9\.\-]\d*\.\d+$') is not null;

6樓:

你應該希望提取的欄位只要含有數字就提出,剔除空和不含數字的字串。

select * from table where regexp_substr(check,'[0-9]+') is not null

7樓:bolibei玻璃

declare   v_length  number default 0;

t_sum    number default 0;

t_num    number default 0;

t_is_num number default 0;

v_str    tmp_xyx26.t2%type;

cursor t_cur is select t2 from tmp_xyx26 where regexp_substr(t2, '[0-9]+') is not null;

begin  open t_cur;

loop    fetch t_cur      into v_str;

exit when t_cur%notfound;    t_sum := 0;

select length(v_str) into v_length from dual;

for i in 1 .. v_length loop    select ascii(substr(v_str, i, 1)) into t_is_num from dual;

if t_is_num between 48 and 57 then   select substr(v_str, i, 1) into t_num from dual;

t_sum := t_sum + t_num;

else null;

end if;

end loop;

dbms_output.put_line;

end loop;

close t_cur;

end;

8樓:吾兒樑龍慶

select * from tablename where check<> regexp_replace(check,'[^0-9]');

目前我就想到這個方法

sql資料庫查詢中,空值查詢條件怎麼寫?

9樓:小小小小吃貨丫

1、首先需要建立資料庫表t_user_info,利用建立表sql語句create table。

2、向數版據庫表裡插

入資料,權按照插入sql語句insert into 執行。

3、插入完畢後,查詢資料庫表記錄select 欄位 from table。

4、查詢資料庫表t_user_info使用者地址為空的記錄select * from table from 欄位 is null。

5、查詢資料庫表t_user_info使用者**不為空的記錄,select * from table where 欄位 is not null。

6、查詢資料庫表t_user_info**不為空且地址為空的記錄,select * from table where 欄位 is not null and 欄位 is null。

10樓:哎呀

在ms sql server和baioracle這兩個主要的資料du庫中,空值都比較特殊,不

zhi能直接用"="或dao"<>"號來比較,如果你內要用這兩個符號比較,就容

會發現,空值即不在等於的集內,也不在不等於的集內。

特別注意的是,空值用“<>”(不等於)比較時,也不在集合內!具體的你自已測試一下就明白了。

常見的做法是用"is null"或“is not null”來確定是不是空值。比如你的情況應該改寫語句為:

where itemno is null

11樓:可靠的王者

一般需要傳輸,稽核,對比,通過,才肯提交,就可能查詢了

12樓:匿名使用者

什麼資料庫?

sqlserver有isnull()函式,可以直接寫成

where isnull(itemno,'')=''

13樓:匿名使用者

select * from table where itemno='' *這個就

是表示此bai字du段沒有任何zhi

值select * from table where itemno is null  *這個就是表示此欄位值為null

你查詢語句dao是不是還有其它的條

回件,若有,找找其答它條件是不是下錯了。

14樓:匿名使用者

where itemno is null 即可

15樓:匿名使用者

itemno='' or itemno is null

16樓:海南生活幫

生活幫:身體共有六條經絡,具體都在腿上的什麼部位?聽聽專家怎麼說

oracle中查詢某欄位不為空的sql語句怎麼寫

17樓:

sql中判斷非空不能用等號,因為null在sql中被看作特殊符號,必須使用關鍵字 is和not

select * from a where info is not null

18樓:江湖浪子

select id,info from 表名 where info is not null;

19樓:匿名使用者

select * from a where info is not null;

20樓:匿名使用者

比如insert into table a (a1,b1)values("a1",'');

對於這種情況,因抄為表裡存的是'',其實是沒有內容的,要查詢這個欄位,不能直接使用

select *

from a

where b1='';

sql中判斷非空不能用等號,因為null在sql中被看作特殊符號,必須使用關鍵字 is和not

應該如此使用:

select * from a where b1 is null

或者:select * from a where b1 is not null

21樓:匿名使用者

select * from 表名 where 某欄位 is null;

某欄位為空。

select * from 表名 where 某欄位 is not null;

某欄位不為空。

22樓:miss丶暖風

select * from tablename where a is not null and a !="";

oracle中查詢某欄位不為空或者為空的sql語句怎麼寫

23樓:匿名使用者

比如copy

insert into table a (a1,b1)values("a1",'');

對於這種情況,因為表裡

bai存的是'',其實是沒有

du內容的,要查詢這個欄位

zhi,dao不能直接使用

select *

from a

where b1='';

sql中判斷非空不能用等號,因為null在sql中被看作特殊符號,必須使用關鍵字 is和not

應該如此使用:

select * from a where b1 is null或者:select * from a where b1 is not null

24樓:匿名使用者

select * from tbl where id is not null;

select * from tbl where id is null;

oracle中刪除兩條相同記錄中的一條該怎麼操作

1.不含大欄位 clob等 的 例子 create table test a number,b number 方法一 通過group by rowid,效率低 delete from test t where t.rowid not in select min rowid from test gro...

如何用電飯煲蒸一條清蒸魚

桃 準備材料 鯽魚,豆鼓,鹽,生抽,醋,料酒,生薑,小蔥,豬油,香油。1 小蔥洗淨,生薑切絲備用。2 新鮮鯽魚洗淨,去內臟,去掉內壁黑膜。用刀在魚身上劃幾道口子,方便入味。把魚周身,裡裡外外都抹一層鹽。3 擺上薑絲,把豆鼓,生抽,醋,料酒,豬油放小碗裡拌勻淋到魚身上醃製約15分鐘左右。4 小蔥打成結...

怎麼用vc畫出一條直線,如何用VC 在視窗中畫線

在你的c view類上右鍵 新增成員函式型別void 函式名ddaline 引數是兩個點的xy座標 還有顏色值rgb 一共五個引數 再次滑鼠右鍵c view新增成員變數 引數兩個點的座標 四個引數 都是float 公有成員public 如果直接在窗體里根據已知引數話直線的話 把你的 放在ondraw...