错误(2,7):PLS-00428:此SELECT语句中应有一个INTO子句 [英] Error(2,7): PLS-00428: an INTO clause is expected in this SELECT statement

查看:558
本文介绍了错误(2,7):PLS-00428:此SELECT语句中应有一个INTO子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建此触发器并遇到以下编译器错误:

I'm trying to create this trigger and getting the following compiler errors:

create or replace
TRIGGER RESTAR_PLAZAS
AFTER INSERT ON PLAN_VUELO
BEGIN
SELECT F.NRO_VUELO, M.CAPACIDAD, M.CAPACIDAD - COALESCE((
SELECT count(*) FROM PLAN_VUELO P
WHERE P.NRO_VUELO = F.NRO_VUELO
       ), 0) as PLAZAS_DISPONIBLES
FROM VUELO F
      INNER JOIN MODELO M ON M.ID = F.CODIGO_AVION; 
END RESTAR_PLAZAS;


Error(2,7): PL/SQL: SQL Statement ignored
Error(8,5): PL/SQL: ORA-00933: SQL command not properly ended
Error(8,27): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:     begin case declare end exception exit for goto if loop mod    null pragma raise return select update while with    <an identifier> <a double-quoted delimited-identifier>    <a bind variable> << close current delete fetch lock insert    open rollback savepoint set sql execute commit forall merge    pipe 
Error(2,1): PLS-00428: an INTO clause is expected in this SELECT statement

此触发器有什么问题?

What's wrong with this trigger?

推荐答案

您将不允许

从PLAN_VUELO中选择计数(*)

SELECT count(*) FROM PLAN_VUELO

在PLAN_VUELO上的触发器中

in a trigger on PLAN_VUELO

请勿使用触发器.使用存储过程.

Don't use a trigger. Use a stored procedure.

这篇关于错误(2,7):PLS-00428:此SELECT语句中应有一个INTO子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆