Q:

Sequential constraints on table columns

Say I have a table with a created, uploaded, processed and archived columns, all of which accept a date. However, I want it so the fields have to be updated in chronological order and you can't skip a step, but the trailing steps don't have to be set until they're ready (i.e., created <= uploaded <= processed <= archived). I implemented this like so:
create table batch (
  id        number primary key,
  created   date   default sysdate not null,
  uploaded  date,
  processed date,
  archived  date,

  check (uploaded  is null or uploaded  >= created),
  check (processed is null or processed >= uploaded),
  check (archived  is null or archived  >= processed)
);

This works, but it allows you to skip steps. For example, I can insert an arbitrary value for processed if uploaded is still null. I presume this to be because the null comparison is always vacuous. Do I therefore have to do something like:
create table batch (
  id        number primary key,
  created   date   default sysdate not null,
  uploaded  date,
  processed date,
  archived  date,

  check (uploaded  is null or uploaded >= created),
  check (processed is null or (uploaded is not null and processed >= uploaded)),
  check (archived  is null or (processed is not null and archived >= processed))
);

Is there a neater way?

A:

In the end, I went for my own solution:
create table batch (
  id        number primary key,
  created   date   default sysdate not null,
  uploaded  date,
  processed date,
  archived  date,

  check (uploaded  is null or uploaded >= created),
  check (processed is null or (uploaded is not null and processed >= uploaded)),
  check (archived  is null or (processed is not null and archived >= processed))
);

Granted that this constrains the workflow to this static schema, as mentioned by Jorge, but that's a tradeoff I'm willing to accept!

