最近回答了幾個(gè) CSDN “學(xué)習(xí)”功能里“問答”區(qū)的一些專業(yè)相關(guān)問題,回答過程中采用嚴(yán)謹(jǐn)?shù)姆绞剑?Oracle Live SQL 上進(jìn)行驗(yàn)證測試。這個(gè)很好用的 Oracle APEX 應(yīng)用我使用好幾年了,雖然近年來已轉(zhuǎn)行 MySQL 和國產(chǎn)數(shù)據(jù)庫領(lǐng)域,但仍然會(huì)遇到一些 Oracle 的問題,在這上面做在線 SQL 測試很方便,遂推薦給各位!
Oracle Live SQL 介紹
使用此網(wǎng)站可以共享和學(xué)習(xí) SQL 和 PL/SQL。 當(dāng)您使用此網(wǎng)站時(shí),您將被分配訪問 Oracle 數(shù)據(jù)庫中的**方案(或稱模式,Schema)**的權(quán)限。當(dāng)您運(yùn)行 SQL 和 PL/SQL 時(shí),會(huì)話中的每條語句都會(huì)被記錄下來。您對(duì)分配的方案的訪問是臨時(shí)的,在一段時(shí)間不活動(dòng)后,該方案將被初始化并回收給其他人。要永久保存您的工作,您需要將會(huì)話保存為腳本。保存的腳本可以回放、注釋、編輯、共享和下載。
此網(wǎng)站的功能包括:
- 在有限的時(shí)間內(nèi)對(duì) Oracle 數(shù)據(jù)庫方案進(jìn)行 SQL 訪問
- 能夠?qū)⒄Z句集保存為腳本
- 能夠與他人共享保存的腳本
- 用于瀏覽方案中對(duì)象的數(shù)據(jù)庫方案瀏覽器
- 內(nèi)嵌教學(xué)教程
- 包括 Java 在內(nèi)的流行語言的數(shù)據(jù)訪問示例
為什么要使用此網(wǎng)站:
- 開發(fā)和擴(kuò)展您的 Oracle 數(shù)據(jù)庫、SQL 和 PL/SQL 技能
- 訪問 Oracle 開發(fā)人員社區(qū)共享的 SQL 和 PL/SQL 示例
- 與他人分享您的 SQL 和 PL/SQL 數(shù)據(jù)庫專業(yè)知識(shí)
- 開發(fā)數(shù)據(jù)庫方案以便在其他地方部署
- 向 Oracle 社區(qū)請(qǐng)求有關(guān)數(shù)據(jù)庫語法的幫助
Live SQL 當(dāng)前運(yùn)行在 Oracle Database 19c EE Extreme Perf-19.17.0.0.0 上。
使用示例
使用 Oracle Live SQL 時(shí)需要登錄 Oracle 賬號(hào),因此您需要提前注冊(cè)或新注冊(cè)一個(gè) Oracle 賬號(hào),建議使用 Outlook 等國外郵箱注冊(cè)(考過 Oracle 認(rèn)證的應(yīng)該都知道),雖然國內(nèi)郵箱也沒什么問題,但可能會(huì)受政治因素影響。
測試在線 SQL
低代碼功能
實(shí)例
詳見 我的問答 。
SQL 代碼如下:
//簡化的原問題的等價(jià) SQL 方案
drop table t1;
create sequence seq_t1 start with 1 increment by 1;
create table t1(id number(20) default seq_t1.nextval primary key , code number(10));
insert into t1(code) select level from dual connect by level < 11;
insert into t1(code) select code from t1;
select * from t1 order by code;
select code,count(1) from t1 group by code order by code;
drop table t1 purge;
create table t1(code number(10));
insert into t1(code) select level from dual connect by level < 11;
select distinct code name from t1 order by code;
select (select distinct code name from t1) code from dual; /*這里模擬題主的SQL寫法,其實(shí)也有問題,應(yīng)該是題主多打了一個(gè)name */
//原問題的 SQL 方案
drop table t_track_pro_code;
drop table ba_bgt_info_hz;
create table t_track_pro_code(track_pro_code varchar2(30),track_pro_code_name varchar2(60));
create table ba_bgt_info_hz(track_pro_code varchar2(30),bgt_id number(16),ori_bgt_id number(16),bgt_doc_title varchar2(100),is_deleted number(1),importtype number(2),billstatus number(2));
insert into ba_bgt_info_hz values('aaa',101,1,'車輛購置稅收入補(bǔ)助地方資金',2,1,1);
insert into ba_bgt_info_hz values('aaa',101,1,'title',2,1,1);
insert into ba_bgt_info_hz values('aaa',101,1,'車輛購置稅收入補(bǔ)助地方資金',0,1,1);
insert into ba_bgt_info_hz values('aaa',101,1,'車輛購置稅收入補(bǔ)助地方資金',2,8,1);
insert into ba_bgt_info_hz values('aaa',101,1,'車輛購置稅收入補(bǔ)助地方資金',2,8,-1);
insert into ba_bgt_info_hz values('bbb',102,2,'title',2,1,1);
insert into ba_bgt_info_hz values('ccc',103,3,'車輛購置稅收入補(bǔ)助地方資金',2,1,1);
select * from ba_bgt_info_hz;
select * from t_track_pro_code;
//題主原始 SQL
insert into t_track_pro_code (track_pro_code,track_pro_code_name) select (with tb1 as (
select distinct m.track_pro_code from ba_bgt_info_hz m where m.ori_bgt_id in (
select t.bgt_id from ba_bgt_info_hz t where t.track_pro_code in (select distinct track_pro_code from ba_bgt_info_hz
where bgt_doc_title like '%車輛購置稅收入補(bǔ)助地方資金%' and is_deleted=2 and track_pro_code is not null and importtype not in (8,9))
and t.billstatus>=0 and t.importtype not in (8,9)
) and m.importtype not in (8,9) union
select distinct track_pro_code from ba_bgt_info_hz
where bgt_doc_title like '%車輛購置稅收入補(bǔ)助地方資金%' and is_deleted=2 and track_pro_code is not null and importtype not in (8,9)
) select distinct track_pro_code track_pro_code_name from tb1) track_pro_code,'車輛購置稅收入補(bǔ)助地方資金'
track_pro_code_name from dual;
insert into t_track_pro_code (track_pro_code,track_pro_code_name) with temp as (
select distinct track_pro_code from ba_bgt_info_hz
where bgt_doc_title like '%車輛購置稅收入補(bǔ)助地方資金%' and is_deleted=2 and track_pro_code is not null and importtype not in (8,9)),
tb1 as (
select distinct m.track_pro_code from ba_bgt_info_hz m where m.ori_bgt_id in (
select t.bgt_id from ba_bgt_info_hz t where t.track_pro_code in (select track_pro_code from temp) and t.billstatus>=0 and t.importtype not in (8,9)
) and m.importtype not in (8,9)
union select track_pro_code from temp /*因前面已經(jīng)去重了,union也會(huì)去重,所以這里無需distinct*/
)
select track_pro_code,'車輛購置稅收入補(bǔ)助地方資金' track_pro_code_name from tb1;
其他 Oracle 學(xué)習(xí)實(shí)用網(wǎng)站
除了在線測試 SQL 外,Oracle Live SQL 上還有很多學(xué)習(xí) Oracle SQL 的教程,可以很方便的點(diǎn)擊一個(gè)按鈕直接將教程中的代碼復(fù)制到并在其中運(yùn)行。這對(duì)于學(xué)習(xí)、從事 Oracle 數(shù)據(jù)庫開發(fā)工作的 Oracle Developer 很有幫助。文章來源:http://www.zghlxwxcb.cn/news/detail-704854.html
此外,該網(wǎng)站頁腳處也提到了 Ask Tom 和 Dev Gym 相關(guān)鏈接,還有 Oracle Learning Path 等。
`文章來源地址http://www.zghlxwxcb.cn/news/detail-704854.html
到了這里,關(guān)于【推薦】Oracle Live SQL——在線 Oracle SQL 測試工具的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!