I'm new to Oracle, and new to Oracle Application Express.
I'm working through a manual and I'm trying to create a table with 3 fields:
USER_ID: Number, Primary Key, Autonumber
USER_NAME: VARCHAR2, Unique
PASSWORD: VARCHAR2
I used the APEX SQL Workshop wizard to create the table, but when I try to do something like the following:
INSERT INTO Schema.USERS (USER_NAME,PASSWORD) VALUES ('planet','password');
...I get told that a unique constraint on the Primary Key is violated.
A trigger was automatically created by the Table Creation wizard. It looks like this:
create or replace trigger "BI_USERS"
before insert on "USERS"
for each row
begin
if :NEW."USER_ID" is null then
select "USERS_SEQ".nextval into :NEW."USER_ID" from sys.dual;
end if;
end;
I was under the impression this would automatically find the highest numeric value in the USER_ID field of USERS and automatically assign an incremented value to each new INSERT, but this doesn't appear to be happening.
Can anyone suggest what I might be doing wrong?
Many thanks
pt