问题描述
我正在尝试将以下查询用于 HPALM。
但是这是 Oracle 语法,我需要将其转换为 sql Server。
确实,const sidebar = document.querySelector('.sidebar');
const closebtn = document.querySelector('.closebtn');
closebtn.addEventListener('click',() => {
sidebar.classList.toggle('show');
});
是 Oracle 的一个特性。
SYS_CONNECT_BY_PATH
可以翻译吗?如果是,怎么办?
谢谢
解决方法
您可以为此使用递归 CTE(也可以在 Oracle 中),因此您可以先在当前的 Oracle 数据库中检查它。
@(Html.Kendo().Grid(Model)
.Name("marketWatchGrid")
.Columns(columns =>
{
columns.Bound(p => p.Clients).ClientTemplate("# if(Clients.indexOf(''')>-1) { # #= Clients # #} else {# #: Clients # #}#")
})
);
下面的例子
with a (ls_father_id,ls_id,path_) as (
select
ls_father_id,ls_name as path_
from lists
where ls_name in (select f.ls_name from lists f where f.ls_father_id = 0)
union all
select
b.ls_father_id,b.ls_id,a.path_ || '\' || b.ls_name
from b
join a
on b.ls_father_id = a.ls_id
)
select *
from a
LS_ID | LS_FATHER_ID | LS_NAME | PATH_ ----: | -----------: | :------ | :------------- 1 | 0 | aaa | aaa 2 | 1 | bb | aaa\bb 3 | 0 | c | c 4 | 2 | cca | aaa\bb\cca 5 | 4 | vvv | aaa\bb\cca\vvv 6 | 3 | f | c\f 7 | 1 | ee | aaa\ee
create table t
as
with a (ls_id,ls_father_id,ls_name) as (
select 1,'aaa' from dual union all
select 2,1,'bb' from dual union all
select 3,'c' from dual union all
select 4,2,'cca' from dual union all
select 5,4,'vvv' from dual union all
select 6,3,'f' from dual union all
select 7,'ee' from dual
)
select *
from a
select
t.*,substr(sys_connect_by_path(ls_name,'\'),2) as path_
from t
start with ls_name in (select f.ls_name from t f where f.ls_father_id = 0)
connect by prior ls_id = ls_father_id
order by ls_id
LS_ID | LS_FATHER_ID | PATH_ ----: | -----------: | :------------- 1 | 0 | aaa 2 | 1 | aaa\bb 3 | 0 | c 4 | 2 | aaa\bb\cca 5 | 4 | aaa\bb\cca\vvv 6 | 3 | c\f 7 | 1 | aaa\ee
dbfiddle here