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
- oracle樹形選單查詢Oracle
- 樹形查詢
- lightdb新特性--相容oracle儲存過程的聯合陣列Oracle儲存過程陣列
- lightdb -- Oracle相容 -- rownumOracle
- Oracle 樹形結構查詢的特殊用法Oracle
- oracle 樹查詢Oracle
- 10g樹形查詢新特性CONNECT_BY_ROOT的9i實現方式
- 10g樹形查詢新特性CONNECT_BY_ISLEAF的9i實現方式
- 10g樹形查詢新特性CONNECT_BY_ISCYCLE的9i實現方式(四)
- 10g樹形查詢新特性CONNECT_BY_ISCYCLE的9i實現方式(三)
- 10g樹形查詢新特性CONNECT_BY_ISCYCLE的9i實現方式(二)
- 10g樹形查詢新特性CONNECT_BY_ISCYCLE的9i實現方式(一)
- [轉載]使用Oracle樹形查詢應注意 - Start with / Connect byOracle
- LightDB23.1新特性支援Oracle hint增強DB2Oracle
- oracle flashback特性(1.2)--閃回查詢之As of scnOracle
- lightdb -- merge into insert 相容 OracleOracle
- 遞迴樹形查詢所有分類遞迴
- ORACLE 樹形查詢(connect by...start with...)的應用(三)Oracle
- ORACLE 樹形查詢(connect by...start with...)的應用(一)Oracle
- Oracle Database 10g新特性-閃回版本查詢OracleDatabase
- LightDB/postgresql內建特性之訪問oracle之oracle_fdw介紹SQLOracle
- oracle flashback特性(1.1)--閃回查詢之As of timestampOracle
- oracle flashback特性(1.4)--閃回查詢之Transaction queryOracle
- LightDB/PostgreSQL 相容Oracle儲存過程SQLOracle儲存過程
- 樹形結構的儲存與查詢
- 樹形查詢也瘋狂&優化措施優化
- oracle flashback特性(1.5)--閃回查詢之制約因素Oracle
- 全面學習oracle flashback特性(1.2)--閃回查詢之As of scnOracle
- Oracle隱形引數查詢指令碼Oracle指令碼
- 查詢oracle中的隱形引數Oracle
- 聊聊mysql的樹形結構儲存及查詢MySql
- [20150907]樹形查詢.txt