if @番号 is null or @名称 is null begin select @工种 = 工种 from A where 番号 = @番号 and 名称 =@名称 end else begin set @return = '番号或名称,含有空值。请检查!' end return @return 仅作参考!
楼上是sql server的语法吧,可不是oracle的
不好意思,刚开始搞Oracle。顺着就出来SQL Server的东东了。参考参考哈!
select * from tab where id like nvl(参数1,'%') and name like nvl(参数2,'%') and ....
MS SQLselect @工种 = 工种 from A where 番号 = isnull(@番號,番號) and 名称 =isnull(@名称,名称)
if @番号 is null or @名称 is null
begin
select @工种 = 工种 from A where 番号 = @番号 and 名称 =@名称
end
else
begin
set @return = '番号或名称,含有空值。请检查!'
end return @return
仅作参考!