LightDB 22.4 新特性之相容Oracle樹形查詢
支援樹形查詢
Oracle:
LightDB:
支援sys_connect_by_path語句
lightdb@test=# lightdb@test=# SELECT empno,ename,SUBSTR(sys_connect_by_path(ename,'->'),3) AS sys_connect_by_path_col lightdb@test-# FROM EMP lightdb@test-# START WITH ENAME = 'KING' /*mgr is null*/ lightdb@test-# CONNECT BY MGR = (PRIOR EMPNO); empno | ename | sys_connect_by_path_col -------+--------+--------------------------- 7839 | KING | KING 7566 | JONES | KING->JONES 7698 | BLAKE | KING->BLAKE 7782 | CLARK | KING->CLARK 7499 | ALLEN | KING->BLAKE->ALLEN 7521 | WARD | KING->BLAKE->WARD 7654 | MARTIN | KING->BLAKE->MARTIN 7788 | SCOTT | KING->JONES->SCOTT 7844 | TURNER | KING->BLAKE->TURNER 7900 | JAMES | KING->BLAKE->JAMES 7902 | FORD | KING->JONES->FORD 7934 | MILLER | KING->CLARK->MILLER 7369 | SMITH | KING->JONES->FORD->SMITH 7876 | ADAMS | KING->JONES->SCOTT->ADAMS (14 rows) lightdb@test=# SELECT LEVEL,empno,ename,mgr -- , (PRIOR ename) AS mgr_name lightdb@test-# FROM EMP lightdb@test-# START WITH ENAME = 'KING' lightdb@test-# CONNECT BY MGR = (PRIOR EMPNO); level | empno | ename | mgr -------+-------+--------+------ 1 | 7839 | KING | 2 | 7566 | JONES | 7839 2 | 7698 | BLAKE | 7839 2 | 7782 | CLARK | 7839 3 | 7499 | ALLEN | 7698 3 | 7521 | WARD | 7698 3 | 7654 | MARTIN | 7698 3 | 7788 | SCOTT | 7566 3 | 7844 | TURNER | 7698 3 | 7900 | JAMES | 7698 3 | 7902 | FORD | 7566 3 | 7934 | MILLER | 7782 4 | 7369 | SMITH | 7902 4 | 7876 | ADAMS | 7788 (14 rows)
lt_restore支援--table_exists_action
如下使用
lt_dump -U lightdb -d test -n public -Fd -f test -v
匯出完後使用lt_restore恢復資料,預設情況下,會報表衝突
[lightdb@node1 ~]$ lt_restore test -U lightdb -d test -n public -v lt_restore: connecting to database for restore lt_restore: creating TABLE "public.dept" lt_restore: while PROCESSING TOC: lt_restore: from TOC entry 571; 1259 24124 TABLE dept lightdb lt_restore: error: could not execute query: ERROR: relation "dept" already exists Command was: CREATE TABLE public.dept ( deptno numeric(2,0) NOT NULL, dname varchar2(14), loc varchar2(13) ); lt_restore: creating TABLE "public.emp" lt_restore: from TOC entry 570; 1259 24116 TABLE emp lightdb lt_restore: error: could not execute query: ERROR: relation "emp" already exists Command was: CREATE TABLE public.emp ( empno numeric(4,0) NOT NULL, ename varchar2(10),
新增--table-exists-action引數之後
[lightdb@node1 ~]$ lt_restore test -U lightdb -d test -n public --table_exists_action=replace -v lt_restore: connecting to database for restore lt_restore: table public.dept exists, drop table before restore due to table_exists_action of replace. lt_restore: creating TABLE "public.dept" lt_restore: table public.emp exists, drop table before restore due to table_exists_action of replace. lt_restore: creating TABLE "public.emp" lt_restore: processing data for table "public.dept" lt_restore: processing data for table "public.emp" lt_restore: creating CONSTRAINT "public.dept pk_dept" lt_restore: creating CONSTRAINT "public.emp pk_emp"
q語句語法支援
lightdb@test=# select q'[alter table ]' || table_name from user_tables; ?column? ------------------ alter table EMP alter table DEPT (2 rows)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-2929060/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LightDB 22.4 新特性之相容Oracle sqluldr2OracleSQL
- LightDB 22.4 新特性之完全相容Oracle varchar2資料型別Oracle資料型別
- LightDB 22.4 新特性之相容Oracle線上轉換普通表為分割槽表Oracle
- LightDB 22.4 新特性之支援Oracle cardinality和ordered_predicates hintOracle
- LightDB 23.1相容Oracle新特性支援Oracle
- oracle樹形查詢Oracle
- lightdb新特性--相容oracle儲存過程的聯合陣列Oracle儲存過程陣列
- lightdb -- Oracle相容 -- rownumOracle
- lightdb -- merge into insert 相容 OracleOracle
- LightDB23.1新特性支援Oracle hint增強DB2Oracle
- LightDB/postgresql內建特性之訪問oracle之oracle_fdw介紹SQLOracle
- LightDB/PostgreSQL 相容Oracle儲存過程SQLOracle儲存過程
- 遞迴樹形查詢所有分類遞迴
- oracle之樹狀結構的儲存與展示(遞迴查詢)Oracle遞迴
- 聊聊mysql的樹形結構儲存及查詢MySql
- 【SQL】Oracle查詢轉換之 OR用法SQLOracle
- 資料結構之查詢(順序、折半、分塊查詢,B樹、B+樹)資料結構
- Spark 3.0 新特性 之 自適應查詢與分割槽動態裁剪Spark
- 【SQL】Oracle查詢轉換之物化檢視查詢重寫SQLOracle
- 樹形結構的選單表設計與查詢
- Oracle 查詢Oracle
- 平衡查詢樹
- 多路查詢樹
- ORACLE_OCP之SQL_子查詢OracleSQL
- MySql樹形結構(多級選單)查詢設計方案MySql
- 8.0新特性-並行查詢innodb_parallel_read_threads並行Parallelthread
- oracle常用查詢Oracle
- oracle 基本查詢Oracle
- Oracle psu查詢Oracle
- oracle 精確查詢和模糊查詢Oracle
- oracle語法相容--如何透過with recursive語法來實現oracle的分層查詢Oracle
- 查詢最佳化——查詢樹結構
- 【SQL】Oracle查詢轉換之謂詞推送SQLOracle
- oracle全文索引之如何實現查詢Oracle索引
- JS遞迴過濾樹形結構陣列物件--模糊查詢JS遞迴陣列物件
- oracle 21c 新特性之 CHECKSUM 分析函式Oracle函式
- ORACLE 19c 新特性之混合分割槽表Oracle
- Oracle 18C新特性之PDB snapshot(快照) CarouselOracle