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

第一次写Oracle触发器,不太会写,请帮忙啊。
在触发器里,如何把一个表的最大ID取出来,赋给另一个变量?  
Create   Or   Replace   Trigger   After_insert_Receive
    after   insert   on   TB_SMS_RECEIVE    
    REFERENCING   OLD   AS   old_v   NEW   AS   new_v   FOR   EACH   ROW  
declare
    ID   Number;
begin
    select   ID:=max(ID)   from   TB_SMS_SURVEY;
end   ;
不行啊

------解决方案--------------------
select ID:=max(ID) from TB_SMS_SURVEY;
是不是应该写成select max(ID) into ID from TB_SMS_SURVEY;
------解决方案--------------------
begin
select max(ID) into ID from TB_SMS_SURVEY;
end;
------解决方案--------------------
begin
select max(ID) into ID from TB_SMS_SURVEY;
end;