Sample Header Ad - 728x90

Oracle random number as default column value

4 votes
1 answer
1927 views
I'm trying to create a table in OracleDB and assign random number to one of the columns as a default. I have this setup working in postgresql create table table_name ( column integer NOT NULL DEFAULT (random()) ) how can I do something similar in oracle (preferably without triggers)? I've tried this create table table_name ( column integer generated always as (dbms_random.random) virtual ) but oracle doesn't like it since the function is non deterministic.
Asked by KianTern (41 rep)
Dec 24, 2015, 12:32 PM
Last activity: Dec 24, 2015, 03:03 PM