1.先写
/*===================================== ** PROCEDURE: DEFAULT_ROW() **=====================================*/ PROCEDURE DEFAULT_ROW IS BEGIN :LINES.HEADER_ID := :HEADERS.HEADER_ID; IF :LINES.LINE_ID IS NULL THEN SELECT CUX_HRSC_LINES_S.NEXTVAL INTO :LINES.LINE_ID FROM SYS.DUAL; END IF; END DEFAULT_ROW; END LINES_DATA;
2.在block的WHEN-CREATE-RECORD中
MEND_DATA.default_row;
3.blcok创建触发器KEY-DUPREC
begin duplicate_record; end;
结束.
-----------------------------------------------------------------
出现错误:app-fnd-10206 this record already exists.
错误原因:
1.表是通过生产环境复制过来的,但是只复制了table 并没有复制对应的sequence,导致line_id验证唯一值的时候出错 .
2.之后又发现当按F6的时候会将line_id一同复制过来,于是在代码中加入:
begin duplicate_record; SELECT CUX_HRSC_MEND_S.currval INTO :MEND.MEND_ID FROM SYS.DUAL; end;