New answers tagged

0

If you know which row represents the "above" or "previous" row, you could use LAG analytic function along with NVL. Something like this: SQL> with test (document, value, value2, corder) as 2 (select 1234567, 4, 7, 45678 from dual union all 3 select 1234567, 2, 0, null from dual 4 ) 5 select document, value, value2, ...


2

Why? Because you can't have NULL values in a primary key. Why? Because the SQL standard says so: If the <unique specification> specifies PRIMARY KEY, then for each <column name> in the explicit or implicit <unique column list> for which NOT NULL is not specified, NOT NULL is implicit in the <column definition>. This is also ...


1

Per your comment: There will be around 300 inserts per second and around 200-250 updates on this table (sometimes update which is also updating Option column (for example add new value). This leaves us with two options: Store the optional columns in their own table(s) and create a view to stick everything together. In this the PK of the optional table(s) ...


Top 50 recent answers are included