If a table is created using /auditcols through Quick SQL, then Update Date and Update By not null are suggested and also triggers without any conditions, Update_By, Update_Date are suggested. If someone creates a table by default, then during data insertion, auto data is inserted in the Update_By, Update_Date columns. I think this is a mistake.
Below is the suggested Query and ****screenshot:
-- create tables
create table item_test (
id number generated by default on null as identity
constraint item_test_id_pk primary key,
item_name varchar2(200 char),
created date not null,
created_by varchar2(255 char) not null,
updated date not null,
updated_by varchar2(255 char) not null
)
;
-- triggers
create or replace trigger item_test_biu
before insert or update
on item_test
for each row
begin
if inserting then
:new.created := sysdate;
:new.created_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
end if;
:new.updated := sysdate;
:new.updated_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
end item_test_biu;
/
-- load data
-- Generated by Quick SQL Tuesday December 17, 2024 12:22:49
/*
ITEM_TEST /auditcols
ID num /pk
ITEM_NAME VC200
# settings = { semantics: "CHAR", language: "EN", APEX: true }
*/