存储过程:
create or replace procedure MoveTreeNode(tblName in varchar2,
orderName in varchar2,
levelName in varchar2,
p_order in number,
p_level in number,
m_order in number,
m_level in number) is
StrSQL varchar2(2000);
p_min number(10);
m_min number(10);
m_moveOrder number(10);
m_moveLeve number(10);
m_count number(10);
m_first number(10);
m_second number(10);
begin
--求移动节点末端下个节点排序数
strsql := 'select NVL(min(' || orderName || '),-1) FROM ' || tblName;
StrSQL := StrSQL || ' where ' || orderName || '>:moduleOrderNum and ' ||
levelName || '<=:m_level';
execute immediate StrSQL
into m_min
using m_order, m_level;
if (m_min <= 0) then
begin
strsql := 'select NVL(max(' || orderName || '),-1) FROM ' || tblName;
StrSQL := StrSQL || ' where ' || orderName || '>:moduleOrderNum and ' ||
levelName || '>=:m_level';
execute immediate StrSQL
into m_min
using m_order, m_level;
if (m_min <= 0) then
m_min := m_order + 1;
else
m_min := m_min + 1;
end if;
end;
end if;
strsql := 'select count(' || orderName || ') FROM ' || tblName;
StrSQL := StrSQL || ' where ' || orderName || '>=:moduleOrderNum and ' ||
orderName || '<:m_level';
execute immediate StrSQL
into m_count
using m_order, m_min;
--求父节点末端下个节点排序数
strsql := 'select NVL(min(' || orderName || '),-1) FROM ' || tblName;
StrSQL := StrSQL || ' where ' || orderName || '>:moduleOrderNum and ' ||
levelName || '<=:m_level';
execute immediate StrSQL
into p_min
using p_order, p_level;
if (p_min <= 0) then
begin
strsql := 'select NVL(max(' || orderName || '),-1) FROM ' || tblName;
StrSQL := StrSQL || ' where ' || orderName || '>:moduleOrderNum and ' ||
levelName || '>=:m_level';
execute immediate StrSQL
into p_min
using p_order, p_level;
if (p_min <= 0) then
p_min := p_order + 1;
else
p_min := p_order + 1;
end if;
end;
end if;
--更新父级末端节点以下节点
StrSQL := 'update ' || tblName || ' set ' || orderName || ' = ' ||
orderName || '+:marginModule where ' || orderName ||
' >=:parentOrder';
execute immediate strsql
using m_count, p_min;
--计算移动节点
m_moveLeve := m_level - (p_level + 1);
if (m_order <= p_min) then
begin
m_moveOrder := p_min - m_order;
m_first := m_order;
m_second := m_min;
end;
else
begin
m_moveOrder := p_min + m_count - m_order;
m_first := m_order + m_count;
m_second := m_min + m_count;
end;
end if;
StrSQL := 'update ' || tblName || ' set ' || orderName || ' = ' ||
orderName || '+:SUBODER,' || levelName || ' = ' || levelName ||
' -:SubLEVEL where ' || orderName || ' >=:M_ORDER and ' ||
orderName || ' <:M_ORDERNext';
execute immediate StrSQL
using m_moveOrder, m_moveLeve, m_first, m_second;
end MoveTreeNode;
/××××××××××××××××××××××××××××××××××××××
该存储过程在plsql中调试没有问题,但在.net中调用时出错了,不知道是哪里错误,希望大虾们给予帮助,小弟先谢了。
ORA-06550: 第 1 行, 第 30 列:
PLS-00103: 出现符号 ":"在需要下列之一时:
( - + case mod new not null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> avg count current exists max min prior sql
stddev sum variance execute forall merge time timestamp
interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<一个带有字符集说明的可带引号的字符串文字>
<一个可带引号的 SQL 字符串>
符号 "(在 ":" 继续之前已插入。
ORA-06550: 第 1 行, 第 53 列:
PLS-00103: 出现符号 ":"在需要下列之一时:
( - + case mod new not null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> avg count current exists max min prior sql
stddev sum variance execute forall merge t
ORA-06550: 第 1 行, 第 78 列:
PLS-00103: 出现符号 ":"在需要下列之一时:
( - + case mod new not null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> avg count current exists max min prio
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OracleClient.OracleException: ORA-06550: 第 1 行, 第 30 列:
PLS-00103: 出现符号 ":"在需要下列之一时:
( - + case mod new not null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> avg count current exists max min prior sql
stddev sum variance execute forall merge time timestamp
interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<一个带有字符集说明的可带引号的字符串文字>
<一个可带引号的 SQL 字符串>
符号 "(在 ":" 继续之前已插入。
ORA-06550: 第 1 行, 第 53 列:
PLS-00103: 出现符号 ":"在需要下列之一时:
( - + case mod new not null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> avg count current exists max min prior sql
stddev sum variance execute forall merge t
ORA-06550: 第 1 行, 第 78 列:
PLS-00103: 出现符号 ":"在需要下列之一时:
( - + case mod new not null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> avg count current exists max min prio