因此,存在一个将数据插入名为xml_hours_load_2的表的存储过程。插入很好并且正在插入数据;当我的触发器被触发时,它似乎在所有“新”引用列中加载空值。我知道这一点,因为当我打开我的触发器并尝试将数据加载到xml_hours_load_2时,我收到一个无法插入NULL(VALUE。“VALUE_TX”)'错误。我究竟做错了什么?我已经尝试过对VALUE_Tx的值进行硬编码,然后我得到了与HR相同的错误。我的代码在下面,并提前感谢!
我的xml_hours_load_2表格包含以下列:
row_id
utc_offset
processed
data_date
hr_utc
value_Tx
hr
hr_num
data_code
data_type
create or replace TRIGGER xml_load_trigger_value
AFTER INSERT
ON xml_hours_load_2
FOR EACH ROW
WHEN (
NEW.processed = 'N'
) DECLARE
Value_ID Number;
pValue_ID Number;
Hr_Utc Varchar2(4);
p_Entity_Address_ID Varchar2(50);
New_Value_ID Number;
New_Value_Tx varchar2(50);
NEW_UTC_Offset varchar2(50);
BEGIN
Value_ID := value_value_id_seq.NEXTVAL;
New_Value_ID := Value_id;
Calculation_Value_ID :=CALCULATION_VALUE_CALCULATI329.NEXTVAL;
calculation_id := Calculation_Calculation_ID_SEQ.NEXTVAL;
Insert into Value
(VALUE_ID, PRODUCT_ID, DATA_SOURCE_ID, UNIT_CD, VALUE_TX, UTC_OFFSET, DATA_DATE, HR_UTC, HR, HR_NUM, DATA_CODE, CREATE_DT, CREATE_USER_ID)
VALUES
(Value_ID, '109' , '269', 'NA', :NEW.Value_Tx, :NEW.UTC_Offset, :NEW.Data_Date, :NEW.hr_utc, :NEW.hr, :NEW.hr_num, :NEW.data_code, SYSDATE, '15');
答案 0 :(得分:0)
您可以直接在INSERT语句中引用序列:
insert into t (x) values(myseq.nextval);