我有以下 pl/sql,我想将其转换为 T-SQL。我用谷歌搜索但没有找到任何文章。
DECLARE
l_retval VARCHAR2(32767);
l_rows VARCHAR2(32767);
BEGIN
FOR i IN (SELECT emp.empno AS empno
,emp.ename AS ename
,mgr.empno AS mgr_empno
,mgr.ename AS mgr_ename
FROM emp emp
,emp mgr
WHERE emp.mgr = mgr.empno(+)
)
LOOP
l_rows := l_rows||'{''emp_empno'':'''||i.empno||''',''emp_ename'':'''||i.ename||''',''mgr_empno'':'''||i.mgr_empno||''',''mgr_ename'':'''||i.mgr_ename||'''},';
END LOOP;
l_retval := '['||rtrim(l_rows,',')||']';
htp.prn(l_retval);
END;