麻烦将SQLServer的语法改为Oracle的语法(100分)

  • 主题发起人 主题发起人 WilliamGui
  • 开始时间 开始时间
W

WilliamGui

Unregistered / Unconfirmed
GUEST, unregistred user!
麻烦将SQLServer的语法改为Oracle的语法<br><br>create or replace function GetDeptChild(pDeptID: guid)<br>return RetTable(deptid guid not null)<br>as begin<br><br>&nbsp; declare k int<br>&nbsp; declare tmpTable(deptid guid not null)<br>&nbsp; declare tmpTable1(deptid guid not null)<br><br>&nbsp; if not exists(select 1 from Dept where DeptID=pDeptID) then return;<br><br>&nbsp; insert into RetTable(deptid) values(pDeptID)<br><br>&nbsp; insert into tmpTable(deptid) values(pDeptID)<br><br>&nbsp; set k=0<br>&nbsp; while exist(select 1 from Dept where ParentID in (<br>&nbsp; &nbsp; select deptid from tmpTable))<br>&nbsp; begin<br>&nbsp; &nbsp; if k&gt;20 then exit else set k=k+1;<br>&nbsp; &nbsp; insert into RetTable(deptid)<br>&nbsp; &nbsp; &nbsp; select DeptID from Dept where ParentID in (<br>&nbsp; &nbsp; &nbsp; &nbsp; select deptid from tmpTable)<br>&nbsp; &nbsp; delete tmpTable1<br>&nbsp; &nbsp; insert into tmpTable1<br>&nbsp; &nbsp; &nbsp; select deptid from tmpTable<br>&nbsp; &nbsp; delete tmpTable<br>&nbsp; &nbsp; insert into tmpTable(deptid)<br>&nbsp; &nbsp; &nbsp; select DeptID from Dept where ParentID in (<br>&nbsp; &nbsp; &nbsp; &nbsp; select deptid from tmpTable1)<br>&nbsp; end<br><br>end
 
先在每一句结束处加上;号
 
帮你顶一下吧,我没学过Oracle
 
你不给我发工资,俺也不欠你的,所以不用你麻烦了<br>大富翁是解惑学习的地方,不是帮你打工应付你老板的地方<br>--见谅[:D]
 
你随便在网上找个 Oracle Sql 的贴子学一下吧。
 

Similar threads

I
回复
0
查看
706
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
3K
import
I
I
回复
0
查看
3K
import
I
后退
顶部