嵌套在脚本文件中开始,脚本执行期间堆栈溢出
最近我需要从 Excel 工作表生成脚本文件。我几乎能够完成任务了。但是问题是脚本文件中局部变量的使用越多。由于局部变量较多,在toad中执行脚本文件期间,它会在插入脚本期间抛出错误PL/SQL 102堆栈溢出异常。 这是语法
"declare Q2 integer;
begin
select table1_seq.nextval into Q2 from dual;
insert into table1 values(Q2,sysdate,'BATCH',sysdate,'BATCH',sysdate,'BATCH',2,'N',null,null);
insert into table2 values(Q2,table2_seq.nextval,sysdate,'BATCH',sysdate,'BATCH',sysdate,'BATCH',2,'BLAH','Y',null,null);
"
请注意,在上面的代码中,我没有“end;”声明“Q2”后的声明 原因是我希望这个变量“Q2”的范围一直可用到最后。
在 Q2 下,我可能有另一个声明 A1 A2
有些东西看起来像这样
Declare Q1 int;
Begin
Insert()
Declare A1 int;
Begin
Insert()
Declare S1 int;
Begin
insert()......
........................
.......................
End;
End;
End;
在上面我可能有 100-300 个 vairbales ,因为它看起来像嵌套的,因为弹出了嵌套堆栈错误。如果是这种情况,是否有可能增加嵌套深度级别,以便它将解析所有脚本变量。 或者是否有任何原因导致堆栈溢出。
即使我没有超出范围的嵌套 IF 或 For 循环。但是在我的脚本文件中运行时我收到“堆栈溢出错误”。请问上面的情况也属于嵌套情况吗?请尽快帮我。
-马亨德
Recently I'm having requirement to generate script file from excel sheet. I'm able to acomplish task almost. Bu the problem is usage of Local varibales are more in script file are more.Becuase of more Local variale, During execution of script file in toad,it throws an error PL/SQL 102 Stack overflow exception during insertion script.
Here is the syntax
"declare Q2 integer;
begin
select table1_seq.nextval into Q2 from dual;
insert into table1 values(Q2,sysdate,'BATCH',sysdate,'BATCH',sysdate,'BATCH',2,'N',null,null);
insert into table2 values(Q2,table2_seq.nextval,sysdate,'BATCH',sysdate,'BATCH',sysdate,'BATCH',2,'BLAH','Y',null,null);
"
Notice that in the above code, I didnot have "end;" statement after declaring 'Q2'
Reason is the i want scope of this variable 'Q2' available till end.
Under Q2 I may have another declare A1 A2
Some thing Look like this
Declare Q1 int;
Begin
Insert()
Declare A1 int;
Begin
Insert()
Declare S1 int;
Begin
insert()......
........................
.......................
End;
End;
End;
In the above I may have 100-300 vairbales ,Since it looks like nested, Because of Nesting Stack error is poping up. If that is case ,is ther any possiblity of increase Nested Depth level so tht it will parse all script varibales.
Or Is there any reason of having stack overflow.
even though Im not having nested IF or For Loops which goes out of scope.But in my script file while runing im getting "Stack overflow error". Will the above situation also falls into nested case. Please help me out ASAP.
-Mahender
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“声明”并不用于每个变量,它表示“声明块”的开始。
您将所有变量声明放在 DECLARE 和 BEGIN 之间,将所有代码放在 BEGIN 和 END 之间。
这并不是说您不能嵌套匿名块,只是您似乎误解了 DECLARE 关键字的含义。
"Declare" is not used for each variable, it signifies the start of the "declaration block".
You put all of your variable declarations between DECLARE and BEGIN, and all of your code between BEGIN and END.
This is not to say that you can't nest anonymous blocks, it's just that you seem to misunderstand the meaning of the DECLARE keword.