insert into B values
as select A.value as child,C.value as parent from A,(select A.value from A) C
where C.value like ('A.value%') and length(C.value)=Length(A.value)+1不知道对不对,你试试吧。我也试试。
as select A.value as child,C.value as parent from A,(select A.value from A) C
where C.value like ('A.value%') and length(C.value)=Length(A.value)+1不知道对不对,你试试吧。我也试试。
解决方案 »
- 请问一个RMAN备份的问题
- 如何在ORACLE中使用case
- 小弟想学oracle各位大哥大姐给推荐本书
- 使用ORACLE9I的EXTERNAL TABLE功能,文本中有汉字,但是查询出来的是乱码,如何解决?
- 导入数据的时候会停止
- 急问~~~~为什么我不能登陆SQL*Plus?系统提示 ORA-12560:TNS:协议适配器错误
- SQL Plus的小问题
- O8中的记录插入能不能像SQL中一样的方便,为什么没有图形操作界面
- 请问我的Oracle http server启动为何总是报错:无法找到动态链接库OCI.dll于指定路径?
- oracle12C连接问题
- 请问 oracle_ole_db8.17 安装后升级哪些文件?
- ora-01789:查询块具有不正确的结果列数
SQL> select * from a;VALUE
----------
a
ab
abc
e
abcdSQL> select y.value,a.value from (
2 select child,min(length(parent)),min(rb)rb from(
3 select a.value as child,(replace(b.value,a.value,'')) as parent,b.rowid as rb
4 from a,a b
5 where instr(b.value,a.value)>0
6 and length(replace(b.value,a.value,''))>0)
7 group by child)x,a,a y
8 where a.rowid(+)=x.rb and x.child(+)=y.value
9 /VALUE VALUE
---------- ----------
a ab
ab abc
abc abcd
abcd
e
SQL> select y.value,x.parent,a.value as child from (
2 select parent,min(length(parent)),min(rb)rb from(
3 select a.value as parent,(replace(b.value,a.value,'')) as child,b.rowid as rb
4 from a,a b
5 where instr(b.value,a.value)>0
6 and length(replace(a.value,b.value,''))>0)
7 group by parent)x,a,a y
8 where a.rowid(+)=x.rb and x.parent(+)=y.value
9 /VALUE PARENT CHILD
---------- ---------- ----------
a a ab
ab ab abc
abc abc abcd
abcd
e
SQL> select a.value as child,x.parent from (
2 select parent,min(length(parent)),min(rb)rb from(
3 select a.value as parent,(replace(b.value,a.value,'')) as child,b.rowid as rb
4 from a,a b
5 where instr(b.value,a.value)>0
6 and length(replace(a.value,b.value,''))>0)
7 group by parent)x,a
8 where a.rowid=x.rb(+)
9 /CHILD PARENT
---------- ----------
a
ab a
abc ab
e
abcd abcSQL>
----------
a
ab
abc
e
abcdSQL> select value child,(select max(value) from a where instr(b.value,a.value)>0
2 and length(b.value)>length(a.value)) parent from a b;CHILD PARENT
---------- ----------
a
ab a
abc ab
e
abcd abc
from A Y where LEN(Y.a)<LEN(X.a) and
substring(X.a,1,LEN(Y.a))=Y.a )
PARENT from A X order by a
from A Y where LEN(Y.value )<LEN(X.value ) and
substring(X.value ,1,LEN(Y.value ))=Y.value )
PARENT from A X order by value
2 and length(b.value)>length(a.value)) parent from a b;