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

時間 2021-10-14 22:23:54

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

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

5樓:小小小小吃貨丫

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。

6樓:哎呀

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

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

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

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

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

where itemno is null

7樓:可靠的王者

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

8樓:匿名使用者

什麼資料庫?

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

where isnull(itemno,'')=''

9樓:匿名使用者

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

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

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

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

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

10樓:匿名使用者

where itemno is null 即可

11樓:匿名使用者

itemno='' or itemno is null

12樓:海南生活幫

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

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

13樓:

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

select * from a where info is not null

14樓:江湖浪子

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

15樓:匿名使用者

select * from a where info is not null;

16樓:匿名使用者

比如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

17樓:匿名使用者

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

某欄位為空。

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

某欄位不為空。

18樓:miss丶暖風

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

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

19樓:匿名使用者

比如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

20樓:匿名使用者

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...

LabVIEW中如何定時一條一條地傳送串列埠命令

你可以利用時間結構中的超時事件。時間結構在剛建立的時候,預設的事件就是超時事件,他表示當事件結構結構內的任何事件都沒有觸發達到設定的時間時,超時事件觸發,執行超時事件框內對應的 對於你所要求的定時自動傳送命令,設定的間隔時間其實就是超時時間,當然事件結構內也可以新增其他事件,手動傳送命令。超時事件的...

一根繩子如何綁自己?如何用一條繩子捆綁自己

方法一 適合長繩子,先用繩子的一頭做一個絞索,就是可活動的繩圈,把另一端找個地方固定住,然後把繩圈重疊成三個小繩圈,把手在背後平行穿過這個三個小繩圈組成的繩圈 就是背後小高手 然後向遠處走把繩圈收緊到自己滿意的程度,然後轉圈把上臂綁住,最後轉到了固定繩子的地方用背後的手拉住餘繩離你手最近的地方以保持...