-1

I have to change an Oracle SQL DDL to use it in zOS/DB2. Now I'm stuck in this part:

 ... ATTRIBUTE1 char check (IS_FINISHED in (0,1)),
     ATTRIBUTE2 char check (HAS_ERROR in (0,1)),...

I have never used a 'check' in oracle, neither in DB2. Can someone please help me out here? Thank You.

dandelion
  • 3
  • 2

1 Answers1

2

These are inline check constraints. Normally, the column names and types would match. In either database, I would expect:

 IS_FINISHED char(1) check (IS_FINISHED in ('0', '1')),
 HAS_ERROR char(1) check (HAS_ERROR in ('0', '1')),

If inline check constraints are not allowed in a database, then you can add them as you would other constraints:

alter table t
    add constraint chk_t_is_finished check (IS_FINISHED in ('0', '1'),
    add constraint chk_t_has_error check (HAS_ERROR in ('0', '1');
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786