# settings = {"pk":"GUID"}
students /insert 2
name
Output:
create table students (
id number default on null to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
constraint students_id_pk primary key,
name varchar2(255 char)
);
-- triggers
create or replace trigger students_biu
before insert or update
on students
for each row
begin
if :new.id is null then
:new.id := to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
end if;
end students_biu;
/
-- load data
insert into students (
id,
name
) values (
1,
'Dean Stephens'
);
insert into students (
id,
name
) values (
2,
'Brett Matthews'
);
commit;
alter table students
modify id generated always as identity restart start with 3;
Expected:
create table students (
id number default on null to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
constraint students_id_pk primary key,
name varchar2(255 char)
)
;
-- load data
insert into students (
name
) values (
'Mark'
);
insert into students (
name
) values (
'Words'
);
Input:
Output:
Expected: