一个简单的触发器,可是它在报错。。。
CREATE OR REPLACE TRIGGER mds_temperature_log_trgAFTER INSERTON mds_temperature_logREFERENCING NEW AS NEW OLD AS OLDFOR EACH ROWdeclarev_description varchar2(10);v_areaid varchar2(10);v_temperature number;v_humidity number;v_time date;beginif 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;
---int 改为into试试select DESCRIPTION into v_description from mds_temperature_parameters where AREA_ID =v_areaid;--
[解决办法]
select into 返回只能是单行。