台灣最大程式設計社群網站
線上人數
1389
 
會員總數:246092
討論主題:189665
歡迎您免費加入會員
討論區列表 >> Oracle >> trigger問題
[]  
[我要回覆]
1
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
trigger問題
價值 : 100 QP  點閱數:1271 回應數:1
樓主

真的有點難
高級專家
11127 36
6857 1436
發送站內信

請教一下各位大大

create table aa (vid number(11,0),a varchar2(10));

create table logaa(cc number(11,0));

我在AA上面的trigger運作是ok的

create or replace
TRIGGER aa123
after update ON aa
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
insert into logaa (cc) values(:new.vid);
END;

但我有另一個table

我要建立
CREATE OR REPLACE TRIGGER df2123
after update ON df2
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
insert into logaa (cc) values(:new.id);
END;

編譯是錯的 是不能用ID這個欄位名稱嗎? 那如果硬要用 那要該如何
下面是我從mssql轉過來的df2 table

CREATE TABLE "SYSTEM"."DF2"
( "id" NUMBER(11,0),
"alias" NVARCHAR2(500),
"classField" NVARCHAR2(500),
"cntPtrPage" NUMBER(11,0),
"cntPtrRegion" NUMBER(11,0),
"computeOrder" NVARCHAR2(500),
"connMasterId" NUMBER(11,0),
"defaultCurrency" NVARCHAR2(500),
"defaultPrivilege" NUMBER(11,0),
"df3Db" NVARCHAR2(500),
"fieldPk" NVARCHAR2(500),
"groupField" NVARCHAR2(500),
"hiddenPage" NUMBER(5,0),
"isDfClass" NUMBER(5,0),
"name" NVARCHAR2(500),
"p1" NVARCHAR2(500),
"p2" NVARCHAR2(500),
"p3" NVARCHAR2(500),
"p4" NVARCHAR2(500),
"p5" NVARCHAR2(500),
"p6" NVARCHAR2(500),
"remark" NVARCHAR2(500),
"reportGroupId" NUMBER(11,0),
"sort2Dir" NVARCHAR2(500),
"sort2Field" NVARCHAR2(500),
"sortDir" NVARCHAR2(500),
"sortField" NVARCHAR2(500),
"sortOrder" NUMBER(11,0),
"status" NUMBER(11,0),
"tblName" NVARCHAR2(500),
"version" NVARCHAR2(500),
"recordTime" DATE,
"creator_id" NVARCHAR2(20),
"type" NUMBER(11,0),
"icon" NVARCHAR2(200),
"DF3_QUERY" NUMBER(11,0),
"head_size" NVARCHAR2(10),
"head_color" NVARCHAR2(10),
"head_bgcolor" NVARCHAR2(10),
"sort3Field" NVARCHAR2(500),
"sort3Dir" NVARCHAR2(500),
"compute_field" CLOB,
"compute2_field" CLOB,
"compute3_field" CLOB,
"compute2Field" NVARCHAR2(500),
"compute3Field" NVARCHAR2(500),
"computr_field" NVARCHAR2(500)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM"
LOB ("compute_field") STORE AS BASICFILE (
TABLESPACE "SYSTEM" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT))
LOB ("compute2_field") STORE AS BASICFILE (
TABLESPACE "SYSTEM" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT))
LOB ("compute3_field") STORE AS BASICFILE (
TABLESPACE "SYSTEM" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
NOCACHE LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) ;







本篇文章發表於2013-03-15 11:31
1樓
最有價值解答

花旗蔘
檢舉此回應
try ~

---trigger 裡的id 加上 識別符號""
ex:
insert into logaa (cc) values(:new."id");

本篇文章回覆於2013-03-15 12:29
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
   
1

回覆
如要回應,請先登入.