MySql错误“;未知列';inDate';在';其中第'条&引用;

MySql错误“;未知列';inDate';在';其中第'条&引用;,mysql,Mysql,我一直在尝试在MySql中运行这个存储过程。但这是一个错误: "Unknown column 'inDate' in 'where clause" CREATE DEFINER=`root`@`localhost` PROCEDURE `Cus_Emails`(inDate varchar(10)) truncate table tt; insert tt(CompanyName, CustomerNumber, ServicePoint, EmailAddressSequenc, Em

我一直在尝试在MySql中运行这个存储过程。但这是一个错误:

"Unknown column 'inDate' in 'where clause"


CREATE DEFINER=`root`@`localhost` PROCEDURE `Cus_Emails`(inDate varchar(10))

truncate table tt;
insert  tt(CompanyName, CustomerNumber, ServicePoint, EmailAddressSequenc, EmailAddress, 
CustomerBusinessUnit)
select distinct '01' CompanyName, s.CustomerNo CustomerNumber, if(d.LINE_DESC like '%/%', substring_index(d.LINE_DESC, '/', -1), '') ServicePoint, '01' EmailAddressSequenc, 'Invoice.inbox@healthscope.com.au' EmailAddress, s.ServicePoint CustomerBusinessUnit
from doc_details d join doc_refs r on d.REF_ID=r.REF_ID
Join service_points s On s.CustomerNo=Trim(substring_index(substring_index(d.LINE_DESC, '/', 1), ' ', -1))
where d.ENTRY_ID like concat(inDate, '%') and d.PAGE_NUM=1 And d.LINE_NUM in (1,2) And (d.LINE_DESC like '-%' Or d.LINE_DESC Like '0%') and d.doc_type='INV'
Union 
select distinct '01' CompanyName, s.CustomerNo CustomerNumber, if(d.LINE_DESC like '%/%', substring_index(d.LINE_DESC, '/', -1), '') ServicePoint, '01' EmailAddressSequenc, 'Invoice.inbox@healthscope.com.au' EmailAddress, s.ServicePoint CustomerBusinessUnit
from doc_details d join doc_refs r on d.REF_ID=r.REF_ID
Join service_points s On s.CustomerNo=Trim(substring_index(substring_index(d.LINE_DESC, '/', 1), ' ', -1))
where d.ENTRY_ID like concat(inDate, '%') and d.PAGE_NUM=1 And d.LINE_NUM in (3)  and d.doc_type='CRE';

因为在您的表中,没有
inDate

再次检查列名并更正它

检查:

我猜

常设机构: 有效的SQL过程语句


这意味着您必须将您的语句(
truncate
insert
)括在
BEGIN
END
中。否则,例程体只是
truncate
,变量
inDate
超出了程序范围。

这里的cos、ur、u是什么?请使用适当的词语,并强调一点:回答前务必阅读问题,因为在您的表中,inDate列不存在。这就是为什么mySQL在where条件的where子句中为您提供“未知列'inDate'"请按"暂停","暂停","暂停","暂停"。是这样,;Textspeak是不可读的,而且你的答案中可以输入的字符数量不受限制。把Textspeak放在一边,你显然没有阅读问题
inDate
是一个过程参数,不是表中的一列。如果我错了,请纠正我。参数充当临时列名我说得对吗?mysql已经清楚地说明了错误。如果没有,它与列名、拼写或声明有关