Answers:
您的语法不太正确:您需要按顺序在INTO之前列出字段,并在以下列出相应的目标变量:
SELECT Id, dateCreated
INTO iId, dCreate
FROM products
WHERE pName = iName
==========建议==========
@martin clayton答案是正确的,但这只是一个建议。
请避免在存储过程中使用歧义变量。
范例:
SELECT Id, dateCreated
INTO id, datecreated
FROM products
WHERE pName = iName
上面的示例将导致错误(空值错误)
下面给出的例子是正确的。我希望这有道理。
范例:
SELECT Id, dateCreated
INTO val_id, val_datecreated
FROM products
WHERE pName = iName
您还可以通过引用表使它们明确,例如:
[提供者:maganap ]
SELECT p.Id, p.dateCreated INTO id, datecreated FROM products p
WHERE pName = iName
SELECT p.Id, p.dateCreated INTO id, datecreated FROM products p WHERE pName = iName