一张表中两个字段需同时要默认获取当时时间(红色字那字段),如何创建触发器 create table pmt_detail_dm(
DMId Varchar(4) not null, /*DM促销期数*/
SupId integer not null, /*供应商代码*/
ProId integer not null, /*商品代码*/
OrigInPrice dec(10,2) not null, /*原进价*/
InPrice dec(10,2) not null, /*促销进价*/
OrigSalePrice dec(10,2) not null, /*原售价*/
SalePrice dec(10,2) not null, /*促销售价*/
OrigMemPrice dec(10,2) null, /*原会员价*/
SpecialPrice dec(10,2) null, /*印花价*/
PrePurQty integer null, /*预订进数*/
PreSaleQty integer null, /*预定销量*/
GiftOne Integer null, /*搭赠比1*/
GiftTwo Integer null, /*搭赠比2*/
LimitTimes Integer null, /*限购次数*/
LimitQty integer null, /*限购数量*/
OperatorId char(10) null, /*操作员*/
CreateDate timestamp default current_timestamp(),
UpdateDate timestamp ,Re varchar(40) null,
SpecBegindate timestamp null,
SpecEndDate timestamp null, constraint p_pmt_detail_dm primary key(DMId,SupId,ProId)
DMId Varchar(4) not null, /*DM促销期数*/
SupId integer not null, /*供应商代码*/
ProId integer not null, /*商品代码*/
OrigInPrice dec(10,2) not null, /*原进价*/
InPrice dec(10,2) not null, /*促销进价*/
OrigSalePrice dec(10,2) not null, /*原售价*/
SalePrice dec(10,2) not null, /*促销售价*/
OrigMemPrice dec(10,2) null, /*原会员价*/
SpecialPrice dec(10,2) null, /*印花价*/
PrePurQty integer null, /*预订进数*/
PreSaleQty integer null, /*预定销量*/
GiftOne Integer null, /*搭赠比1*/
GiftTwo Integer null, /*搭赠比2*/
LimitTimes Integer null, /*限购次数*/
LimitQty integer null, /*限购数量*/
OperatorId char(10) null, /*操作员*/
CreateDate timestamp default current_timestamp(),
UpdateDate timestamp ,Re varchar(40) null,
SpecBegindate timestamp null,
SpecEndDate timestamp null, constraint p_pmt_detail_dm primary key(DMId,SupId,ProId)
set new.UpdateDate=current_timestamp
on pmt_detail_dm
for each row
insert into pmt_detail_dm set new.UpdateDate = current_timestamp;
是不是这样写
create trigger trg_pmt_detail_dm_before_insert before insert
on pmt_detail_dm
for each row
set new.UpdateDate = current_timestamp;
是不是这样写
IF new.xxxx is null then