導航:首頁 > 凈水問答 > oracle過濾單詞

oracle過濾單詞

發布時間:2022-09-13 19:31:24

❶ oracle查詢過濾重復相同的數據。

SELECT DISTINCT TA.QA_TYPE TYPE,
TQ.TYPE_DESCRIPTION TYPEDESCRIPTION
FROM T_QA_RULE_DEFINE TA, T_QA_CHECK TQ
WHERE TA.QA_TYPE = TQ.TYPE
AND TA.QA_CHECK_TYPE = TQ.CHECK_TYPE
AND TA.VALID_FLAG = 'Y'
只取這兩來個字源段不就行了么,是不是你想要的

❷ oracle COUNT(DISTINCT P.SALARY_NO) 時候,要過濾掉P.SALARY_NO='0001'

SELECT SUM(P.IN_CARD_VALUE-P.OUT_CARD_VALUE) AS DISH_TOTAL_SALES_MONEY , SUM(P.WEIGHT) AS DISH_TOTAL_SALES_WEIGHT, COUNT(DISTINCT P.SALARY_NO) AS RECEPTION_NUMBER FROM T_PM_PAY P
LEFT JOIN T_DM_DISH D
ON P.DISH_NO = D.DISH_NO
having COUNT(DISTINCT P.SALARY_NO)>100 之類的

❸ 關於Oracle 數據查詢分組過濾問題。

select a,b,max(c) from table group by a,b;

❹ oracle查詢過濾條件如果......則輸出.......否則輸出........

CASE
WHEN sex = '1' THEN '男'
WHEN sex = '2' THEN '女'
ELSE '其他' END

樓主說的是這個嗎?

❺ Oracle怎麼用正則表達式過濾欄位中"非漢字"的所有字元

varreg=/([^抄s])/g;varstr="abcdef";vararr=str.match(reg);console.error(arr);

❻ oracle 要查詢 多個欄位 但是要過濾掉 重復的數據 sql 語句怎麼寫啊

加distinct,
SELECT distinct sequence_no, channel_id, base_id, proct_mode,model_code,rated_voltage, spec, brand_name, show_flag, model_id
FROM table_name
where user_id=1

查出來是沒有重復記錄的,如果想要model_id 沒有重復,還需要做別的條件的限制

❼ oracle 過濾條件 除了...之外

not (biding_scheme = 『true』 and flow_status !=『2』
)

=>> biding_scheme <> 『true』 or flow_status =『2』

❽ ORACLE中怎樣用正則表達式過濾中文字元

從表裡提取漢字, 需要考慮字元集, 不同的字元集漢字的編碼有所不同
這里以GB2312為例, 寫一函數准確地從表裡提取簡體漢字.

假設資料庫字元集編碼是GB2312, 環境變數(注冊表或其它)的字元集也是GB2312編碼
並且保存到表裡的漢字也都是GB2312編碼的

那麼也就是漢字是雙位元組的,且簡體漢字的編碼范圍是
B0A1 - F7FE
換算成10進制就是
B0 A1 F7 FE
176,161 - 247,254

我們先看一下asciistr函數的定義
Non-ASCII characters are converted to the form \xxxx, where xxxx represents a UTF-16 code unit.
但是這並不表示以 "\" 開始的字元就是漢字了

舉例如下
SQL> select * from test;

NAME
--------------------
,啊OO10哈
你好aa
大家好aa/
☆大海123
★ABC

這里第5條記錄有一個實心的五角星
然後用asciistr函數轉換一下試試
SQL> select name,asciistr(name) from test;

NAME ASCIISTR(NAME)
-------------------- ----------------------
,啊OO10哈 ,\554AOO10\54C8
你好aa \4F60\597Daa
大家好aa/ \5927\5BB6\597Daa/
☆大海123 \2606\5927\6D77123
★ABC \2605ABC

我們看到最後一條記錄的實心五角星也是 "\"開頭的
此時我們就不能用asciistr(欄位)是否存在 "\" 來判斷是否含有漢字了.

我的函數如下,基本思路是判斷字元的編碼是否在GB2312規定的漢字編碼范圍之內
[PHP]
create or replace function get_chinese(p_name in varchar2) return varchar2
as
v_code varchar2(30000) := '';
v_chinese varchar2(4000) := '';
v_comma pls_integer;
v_code_q pls_integer;
v_code_w pls_integer;
begin
if p_name is not null then
select replace(substrb(mp(p_name,1010),instrb(mp(p_name,1010),'ZHS16GBK:')),'ZHS16GBK: ','') into v_code from al where rownum=1;
for i in 1..length(p_name) loop
if lengthb(substr(p_name,i,1))=2 then
v_comma := instrb(v_code,',');
v_code_q := to_number(substrb(v_code,1,v_comma-1));
v_code_w := to_number(substrb(v_code,v_comma+1,abs(instrb(v_code,',',1,2)-v_comma-1)));
if v_code_q>=176 and v_code_q<=247 and v_code_w>=161 and v_code_w<=254 then
v_chinese := v_chinese||substr(p_name,i,1);
end if;
v_code := ltrim(v_code,'1234567890');
v_code := ltrim(v_code,',');
end if;
v_code := ltrim(v_code,'1234567890');
v_code := ltrim(v_code,',');
end loop;
return v_chinese;
else
return '';
end if;
end;
/
.
[/PHP]

好,現在來執行一些語句
SQL> select * from test;

NAME
--------------------
,啊OO10哈
你好aa
大家好aa/
☆大海123
★ABC

5 rows selected.

1. 列出有漢字的記錄
SQL> select name from test where length(get_chinese(name))>0;

NAME
--------------------
,啊OO10哈
你好aa
大家好aa/
☆大海123

4 rows selected.

2. 列出有漢字的記錄,並且只列出漢字

SQL> select get_chinese(name) from test where length(get_chinese(name))>0;

GET_CHINESE(NAME)
---------------------------------------------------------------------------
啊哈
你好
大家好
大海

4 rows selected.

需要說明的是GB2312共有6763個漢字,即72*94-5=6763
我這里是計算72*94,沒有減去那5個,那五個是空的。等查到了再減去
============

改寫這個函數,可以提取非漢字或者漢字
該函數有兩個參數,第一個表示要提取的字元串,第二個是1,表示提取漢字,是非1,表示提取非漢字

[PHP]
create or replace function get_chinese
(
p_name in varchar2,
p_chinese in varchar2
) return varchar2
as
v_code varchar2(30000) := '';
v_chinese varchar2(4000) := '';
v_non_chinese varchar2(4000) := '';
v_comma pls_integer;
v_code_q pls_integer;
v_code_w pls_integer;
begin
if p_name is not null then
select replace(substrb(mp(p_name,1010),instrb(mp(p_name,1010),'ZHS16GBK:')),'ZHS16GBK: ','') into v_code from al where rownum=1;
for i in 1..length(p_name) loop
if lengthb(substr(p_name,i,1))=2 then
v_comma := instrb(v_code,',');
v_code_q := to_number(substrb(v_code,1,v_comma-1));
v_code_w := to_number(substrb(v_code,v_comma+1,abs(instrb(v_code,',',1,2)-v_comma-1)));
if v_code_q>=176 and v_code_q<=247 and v_code_w>=161 and v_code_w<=254 then
v_chinese := v_chinese||substr(p_name,i,1);
else
v_non_chinese := v_non_chinese||substr(p_name,i,1);
end if;
v_code := ltrim(v_code,'1234567890');
v_code := ltrim(v_code,',');
else
v_non_chinese := v_non_chinese||substr(p_name,i,1);
end if;
v_code := ltrim(v_code,'1234567890');
v_code := ltrim(v_code,',');
end loop;
if p_chinese = '1' then
return v_chinese;
else
return v_non_chinese;
end if;
else
return '';
end if;
end;
/

.
[/PHP]
SQL> select * from a;

NAME
--------------------
我們啊、
他(艾呀)是★們
他的\啊@

SQL> select get_chinese(name,1) from a;

GET_CHINESE(NAME,1)
-----------------------------------------
我們啊
他艾呀是們
他的啊

SQL> select get_chinese(name,0) from a;

GET_CHINESE(NAME,0)
-----------------------------------------

()★
\@

SQL>

❾ oracle篩選方法

oracle篩選用where子句。

如emp表中有如下內容:

❿ oracle查詢語句過濾重復數據問題

select distinct x,y ferom t;
select x,y from t group by x,y;
select * from t group by x,y having count(*)>1 ;--查出有重復記錄的數據,如果having count(*)=1 是查出沒有重復記錄的數據
select * from t a1 where rowid=(select max(rowid) from t a2 where a2.x=a1.x and a2.y=a1.y); --利用rowid唯一,適用於少量重復數據
還有 rank over(partition)這個函數你也可以好好看哈哦

閱讀全文

與oracle過濾單詞相關的資料

熱點內容
高效過濾器檢漏儀廣度計 瀏覽:563
污水提升泵安裝距離 瀏覽:702
濰坊小區純凈水75多少一桶 瀏覽:924
水壺水垢醋清除妙招 瀏覽:708
凈化器火鹼清洗後火鹼怎麼處理 瀏覽:495
PAC對反滲透膜的影響 瀏覽:940
小酒廠現場蒸餾出來就能喝嗎 瀏覽:826
室外雨污水管道過路面 瀏覽:975
別墅廚房污水提升泵 瀏覽:120
四川省城鎮污水處理廠執行標准 瀏覽:344
家外面暖氣有幾道過濾網 瀏覽:132
醫院污水處理膜工藝 瀏覽:716
反滲透凈水器過濾器清洗 瀏覽:138
視頻天籟怎麼打開空調濾芯 瀏覽:499
純水精靈可以召喚多少種水之幻型 瀏覽:641
攪拌污水處理辦法 瀏覽:477
c50汽油濾芯在哪裡 瀏覽:975
污水泵啟動馬達怎麼接 瀏覽:443
污水的BOD大概 瀏覽:323
愉升飲水機怎麼關童鎖 瀏覽:36