⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.sql

📁 数据库的开发事例
💻 SQL
字号:
create  procedure   update_date(@x char(40)=null,@y datetime =null)
as
if (@x is null or @y is null)
begin
print '必须同时提供一个产品名称和一个指定日期作为参数'
return  13
end
if not exists(select * from 	产品  where 产品名称 = @x)
begin
	print  '没有指定名称的产品'
 	return  -103
end
if not exists(select * from 	产品,订单明细表 
	      where 产品名称=@x and  产品.产品号=订单明细表.产品号)			
begin
	print  '没有满足条件的产品'
 	return  -103
end
update 订购单
set  订购日期=@y
where 订购单.订单号  in 
          (select 订单明细表.订单号  from 订单明细表 
	   where  订单明细表.产品号 in
           (select 产品.产品号   from 产品
            where  产品名称= @x)
           )
return 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -