单步存储过程的几个问题
我的存储过程:
CREATE PROCEDURE Test @ID nvarchar(12),@AddMoney money
AS
DECLARE @_money money
DECLARE @_欠款金额 money
DECLARE @_Temp money
SELECT
@_money=Money.dbo._Main._money, @_欠款金额=NM2000.dbo.l_reader._欠款金额
from
Money.dbo._Main,NM2000.dbo.l_reader
where
Money.dbo._Main._id=@ID and NM2000.dbo.l_reader._读者条码=@ID
if(@_欠款金额=0 or @_欠款金额>0 and @_money>=20 )
begin
set @_money=@AddMoney+@_money
update Money.dbo._Main set Money.dbo._Main._money=@_money where Money.dbo._Main._id=@ID
end
if(@_欠款金额>0 and @_money<20)
begin
if (@Addmoney+@_money<20)
begin
set @_money=@AddMoney+@_money
set @_欠款金额=@_欠款金额-@AddMoney
update Money.dbo._Main set Money.dbo._Main._money=@_money where Money.dbo._Main._id=@ID
update NM2000.dbo.l_reader set NM2000.dbo.l_reader._欠款金额=@_欠款金额 where NM2000.dbo.l_reader._读者条码=@ID
end
if (@Addmoney+@_money>=20)
begin
set @_Temp=20-@_money
set @_money=@AddMoney+@_money
set @_欠款金额=@_欠款金额-@_Temp
update Money.dbo._Main set Money.dbo._Main._money=@_money where Money.dbo._Main._id=@ID
update NM2000.dbo.l_reader set NM2000.dbo.l_reader._欠款金额=@_欠款金额 where NM2000.dbo.l_reader._读者条码=@ID
end
end
GO
单步的时候一到set就报:
ODBC: 消息 0,级别 19,状态 1
[Microsoft][ODBC SQL Server Driver][SQL Server]SqlDumpExceptionHandler: 进程 58 发生了严重的异常 c0000005 EXCEPTION_ACCESS_VIOLATION。SQL Server 将终止该进程。
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionRead (WrapperRead()).
服务器: 消息 11,级别 16,状态 1,行 0
[Microsoft][ODBC SQL Server Driver][Shared Memory]一般性网络错误。请检查网络文档。
如果过程中有事务是不是不能单步?应为我的过程原来有事务,但是我一单步到select就报错了
然后我把事务去掉就能走远点,这是为什么?
还有我单步的时候看到@@connections这个参数,这是不是写的连接数?我发现我每连一次它就+1,是不是我的连接还在???如果是的话意思是每次调试都没有释放资源,或者说是关闭连接?
CREATE PROCEDURE Test @ID nvarchar(12),@AddMoney money
AS
DECLARE @_money money
DECLARE @_欠款金额 money
DECLARE @_Temp money
SELECT
@_money=Money.dbo._Main._money, @_欠款金额=NM2000.dbo.l_reader._欠款金额
from
Money.dbo._Main,NM2000.dbo.l_reader
where
Money.dbo._Main._id=@ID and NM2000.dbo.l_reader._读者条码=@ID
if(@_欠款金额=0 or @_欠款金额>0 and @_money>=20 )
begin
set @_money=@AddMoney+@_money
update Money.dbo._Main set Money.dbo._Main._money=@_money where Money.dbo._Main._id=@ID
end
if(@_欠款金额>0 and @_money<20)
begin
if (@Addmoney+@_money<20)
begin
set @_money=@AddMoney+@_money
set @_欠款金额=@_欠款金额-@AddMoney
update Money.dbo._Main set Money.dbo._Main._money=@_money where Money.dbo._Main._id=@ID
update NM2000.dbo.l_reader set NM2000.dbo.l_reader._欠款金额=@_欠款金额 where NM2000.dbo.l_reader._读者条码=@ID
end
if (@Addmoney+@_money>=20)
begin
set @_Temp=20-@_money
set @_money=@AddMoney+@_money
set @_欠款金额=@_欠款金额-@_Temp
update Money.dbo._Main set Money.dbo._Main._money=@_money where Money.dbo._Main._id=@ID
update NM2000.dbo.l_reader set NM2000.dbo.l_reader._欠款金额=@_欠款金额 where NM2000.dbo.l_reader._读者条码=@ID
end
end
GO
单步的时候一到set就报:
ODBC: 消息 0,级别 19,状态 1
[Microsoft][ODBC SQL Server Driver][SQL Server]SqlDumpExceptionHandler: 进程 58 发生了严重的异常 c0000005 EXCEPTION_ACCESS_VIOLATION。SQL Server 将终止该进程。
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionRead (WrapperRead()).
服务器: 消息 11,级别 16,状态 1,行 0
[Microsoft][ODBC SQL Server Driver][Shared Memory]一般性网络错误。请检查网络文档。
如果过程中有事务是不是不能单步?应为我的过程原来有事务,但是我一单步到select就报错了
然后我把事务去掉就能走远点,这是为什么?
还有我单步的时候看到@@connections这个参数,这是不是写的连接数?我发现我每连一次它就+1,是不是我的连接还在???如果是的话意思是每次调试都没有释放资源,或者说是关闭连接?
...全文
相关推荐
Oracle如何使用PL/SQL调试存储过程
主要介绍了Oracle如何使用PL/SQL调试存储过程,文中通过图文介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
让postgresql支持存储过程(函数)的调试.doc
让postgresql支持存储过程(函数)的调试.doc 还有edb-debugger 工具包
\"Oracle 存储过程\"简单总结
NULL 博文链接:https://fangguanhong.iteye.com/blog/1979512
sql存储过程几个简单例子
sql存储是数据库操作过程中比较重要的一个环节,对于一些初学者来说也是比较抽象难理解的,本文我将通过几个实例来解析数据库中的sql存储过程,这样就将抽象的事物形象化,比较容易理解。 例1: create proc proc_stu @sname varchar(20), @pwd varchar(20) as select * from ren where sname=@sname and pwd=@pwd go 查看结果:proc_stu ‘admin’,’admin’ 例2: 下面的存储过程实现用户验证的功能,如果不成功,返回0,成功则返回1. CREATE PROCEDUREVAL
oracle存储过程单步调试的方法
详细介绍oracle存储过程单步调试的方法。学会了存储过程的调试方法,对于Oracle函数的调试也大同小异。


应用实例
