日期:2014-05-17  浏览次数:20637 次

一个简单的触发器,可是它在报错。。。
SQL code

CREATE OR REPLACE TRIGGER mds_temperature_log_trg
AFTER INSERT
ON mds_temperature_log
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
declare
v_description varchar2(10);
v_areaid varchar2(10);
v_temperature  number;
v_humidity number;
v_time date;
begin
if inserting then
    v_areaid := :new.AREA_ID;
    v_temperature :=:new.TEMPERATURE;
    v_humidity := :new.HUMIDITY;
    v_time := :new.CREATION_DATE;
    select DESCRIPTION int v_description from mds_temperature_parameters where AREA_ID =v_areaid;
    dbms_output.put_line(v_description);
   -- if (v_description='IQC' and (v_temperature>26 or v_temperature<24)) or (v_description='IQC' and v_humidity<=70)  then
      --  insert into common_mail_notice values
      --  (COMMON_MAIL_NOTICE_SEQ.nextval,5557,v_description||'|'|| v_TEMPERATURE||'|'||v_humidity||'|'||to_char(v_time,'yyyy-MM-dd HH24:mi:ss'),'N',sysdate,'SYS',sysdate,'SYS',sysdate);
   -- end if;
end if;
end;



===================================================================================
(1):PL/SQL: ORA-00923: 未找到要求的 FROM 关键字
(2):PL/SQL: SQL Statement ignored

------解决方案--------------------
SQL code


---int 改为into试试
select DESCRIPTION into v_description from mds_temperature_parameters where AREA_ID =v_areaid;
--

------解决方案--------------------
select into 返回只能是单行。