First, we'll build a test table by Sql/plus.
SQL statements:
Cteate TABLE TEST (
ID number,
NAME VARCHAR2 (20),
PRIMARY KEY (ID)
);
Create a sequence by sql/plus
SQL statements:
CREATE SEQUENCE Seq_test
INCREMENT by 1
START with 1
MINVALUE 1
MAXVALUE 9999
Nocycle;
Attention:
1.INCREMENT by: Sets the difference between adjacent two elements, that is, the step size, the default value is 1;
START with: Sets the initial value of the sequence, the default value is 1;
MAXVALUE: Sets the maximum value of the sequence;
MINVALUE: Sets the minimum value of the sequence;
Nocycle: Specifies that the generated value is not looped when the sequence reaches its maximum or minimum value.
2. The sequence has the following two properties
Currval: Returns the current value of the sequence;
Nextval: Returns the value of the current sequence value increment by one step.
You can use the Currval property only after you have issued at least one nextval.
I. Establishing a trigger trigger_test via PL/SQL developer
The steps are as follows:
trigger--Trigger
Right-click Triggers, which appears:
When you click New, it appears:
OK to appear later:
The statement in the red box was later played by itself.
After you lose the above content, click the button in the Red box to:
Two. Create a trigger trigger_test from the Sql/plus statement:
Problems encountered:
End Trigger;
or SQL line edit mode, how to exit Ah,
And this method trigger has not been built successfully. Ask for advice.
Thank you @ Back Tower:
method is input/return
The above content I have already practiced, such as reprint please indicate the source, thank you.
ORACLE11G steps and issues to create an ID self-growth listener