"Column does not belong to referenced table" 为什么?



这段代码应该删除一个相册,但我不知道为什么它仍然不起作用

declare variable al_eliminare integer;
begin
select count(album.id) from album where id = :id_album
into :al_eliminare;
if(al_eliminare = 0)
then delete from album where album.id = id_album;
suspend;
end

在语句中使用存储过程参数或变量时,必须在参数或变量名称前面加上冒号:

在删除语句中

delete from album where album.id = id_album

Firebird 解析器将考虑id_album列名,并且album表中不存在此类列。这就是您收到错误的原因。

若要指示它是存储过程变量或参数,请在前面加上:

delete from album where album.id = :id_album

最新更新