The function is very simple. If a field has more points, one more parameter will cause problems.
For example:
Too partition columns.
Recently I have read the web js optimization. js conventions for internal variables start with _, for example, _ name, _ age.
Trigger writes are relatively small, and temporary variables do not support _ myVar. Unfortunately.
1. Compilation errors
Error: PLS-00103: Encountered the symbol "_" when expecting one of the following:
Text: _ TMP_PROJECT_ID NUMBER (16, 0 );
ORA-00947: not enough values
Multiple column names with less inserted VALUES. For example, (A, B, C) VALUES (A, B)
3. ORA-00913: How is too struct values opposite?
For example, (A, B, C) VALUES (A, B, C, D)
Reference
Create or replace trigger TRI_AAA
Before update or delete
On AAA
For each row
Declare
ERR VARCHAR2 (100 );
-- Original table Field
TMP_PROJECT_ID NUMBER (16, 0 );
TMP_COMPANY_ID NUMBER (16, 0 );
TMP_CREATE_DATETIME DATE;
...
TMP_GROUP_ID NUMBER (16, 0 );
-- Add a field
-- TMP_USER_OPT VARCHAR2 (64 );
-- TMP_USER_OPT_DATETIME DATE;
PRAGMA AUTONOMOUS_TRANSACTION;
Begin
TMP_PROJECT_ID: =: OLD. PROJECT_ID;
TMP_COMPANY_ID: =: OLD. COMPANY_ID;
TMP_CREATE_DATETIME: =: OLD. CREATE_DATETIME;
...
TMP_GROUP_ID: =: OLD. GROUP_ID;
If updating then
Insert into AAA_LOG (PROJECT_ID, COMPANY_ID, CREATE_DATETIME,..., TMP_GROUP_ID, 'update', SYSDATE );
Commit;
Elsif deleting then
Insert into AAA_LOG (PROJECT_ID, COMPANY_ID, CREATE_DATETIME,..., TMP_GROUP_ID, 'update', SYSDATE );
Commit;
End if;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
Insert into TAB_PUB_ERROR (userid, error, triname, tabfountain, tabend, edate)
VALUES (0, 'too _ MANY_ROWS ', 'tri _ aaa', 'aaa', 'aaa', sysdate );
COMMIT;
WHEN NO_DATA_FOUND THEN
Insert into TAB_PUB_ERROR (userid, error, triname, tabfountain, tabend, edate)
VALUES (0, 'no _ DATA_FOUND ', 'tri _ aaa', 'aaa', 'aaa', sysdate );
COMMIT;
WHEN OTHERS THEN
Err: = SUBSTR (SQLERRM (SQLCODE), 1,100 );
Insert into TAB_PUB_ERROR (userid, error, triname, tabfountain, tabend, edate)
VALUES (0, err, 'tri _ aaa', 'aaa', 'aaa', sysdate );
COMMIT;
End;
Author: "westsince2001"