我是一名初学者程序员,我正在尝试学习 SQL,但在这里遇到了一个问题,我得到的问题是:
编写一个
UpdateSuggestedPrice
接受 ISBN 编号和新建议价格的程序。如果 ISBN 不存在,则引发错误消息。如果没有错误,将建议价格更新为新价格。
Create PROCEDURE UpdateSuggestedPrice (@ISBN char(10), @SuggestedPrice smallmoney)
AS
BEGIN
if @ISBN is null
Begin
Raiserror ('Provide a valid ISBN',16,1)
End
else
Begin
if (select COUNT(*) from Title where SuggestedPrice = @SuggestedPrice) = 0
begin
Select 'Description sucessfully added'
insert into Title (SuggestedPrice)
values (@SuggestedPrice)
End
Else
Raiserror ('Description already exists',16,1)
End
End
Return
-- Here I'm trying to execute the procedure, search for ISBN and
-- then update the suggested price, can someone please tell me
-- what I'm doing wrong.
execute UpdateSuggestedPrice @ISBN= '1021031040', @SuggestedPrice = '40'