WHENEVER SQLERROR EXIT SQL.SQLCODE

CREATE TABLE dds_legacy_customers (
  customer_id    NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
  customer_name  VARCHAR2(100) NOT NULL,
  country        VARCHAR2(40) NOT NULL,
  region         VARCHAR2(30) NOT NULL,
  account_owner  VARCHAR2(60) NOT NULL,
  risk_rating    VARCHAR2(20) NOT NULL,
  revenue        NUMBER(12,2),
  margin         NUMBER(12,2),
  legal_hold     VARCHAR2(1) DEFAULT 'N' NOT NULL
);

CREATE TABLE dds_legacy_contracts (
  contract_id     NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
  customer_id     NUMBER NOT NULL REFERENCES dds_legacy_customers(customer_id),
  contract_status VARCHAR2(30) NOT NULL,
  renewal_date    DATE,
  legal_clause    VARCHAR2(400),
  contract_value  NUMBER(12,2)
);

CREATE TABLE dds_legacy_tickets (
  ticket_id      NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
  customer_id    NUMBER NOT NULL REFERENCES dds_legacy_customers(customer_id),
  assigned_group VARCHAR2(40) NOT NULL,
  severity       VARCHAR2(20) NOT NULL,
  summary        VARCHAR2(200) NOT NULL,
  private_note   VARCHAR2(400)
);

