我正在尝试在过程
中执行此查询set mailSeq = (
select MailSequence
from MailIdentity
where Customer = customer
and MailDate = mailDate
);
我在这张表中有4条记录
Id Customer MailDate MailSequence
1 1 2014-04-05 00:00:00 5
2 1 2014-04-06 00:00:00 2
3 2 2014-04-05 00:00:00 9
4 2 2014-04-06 00:00:00 5
我将程序称为
call my_procedure(2, '2014-04-05')
参数是客户和邮件日期
如果我在程序之外执行查询,它会返回一条我想要的记录,但是当我调用该程序时,它会返回4条记录。
对此有任何帮助吗?
答案 0 :(得分:0)
我遇到了同样的问题,看了之后我意识到它是什么。不要让输入参数与where子句中的fieldname同名。
答案 1 :(得分:-1)
我也遇到了这个问题,我发现参数在哪里:
like where Customer = customer
and MailDate = mailDate
左侧和右侧是相同的,所以永远都是真的