I have an audit table which keeps track of user updating the data.
There are 2 ways of updating the data, first via GUI where logged in user will be updated in audit table. Second is by executing sql queries, now in this case i want to populate logged in DB user in Audit table. I want to achieve this by setting default value for audit user column by executing the query Select user from dual
Is it possible in oracle to set default value of a column to result of a query output?
No need for a query, just use the keyword user
create table audit_table
(
... other columns ....
changed_when timestamp default current_timestamp not null,
changed_by varchar(30) default user not null
);