Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 2.34 KB | None | 0 0
  1. -- Create table
  2. CREATE TABLE NTS_RD.SERVICE_GROUP
  3. (
  4.   service_group_id             NUMBER NOT NULL,
  5.   service_group_code           VARCHAR2(30) NOT NULL,
  6.   service_group_name           VARCHAR2(127) NOT NULL,
  7.   service_group_name2          NVARCHAR2(127),
  8.   service_group_type           VARCHAR2(5) NOT NULL,
  9.   description                  VARCHAR2(255),
  10.   is_calculated_by_destination NUMBER,
  11.   is_iskljucenje               NUMBER,
  12.   service_group_customer_type  VARCHAR2(2),
  13.   active                       NUMBER(1) DEFAULT 1,
  14.   portal_visible               NUMBER(1) DEFAULT 1
  15. )
  16. tablespace NTS_RD
  17.   PCTFREE 10
  18.   initrans 1
  19.   maxtrans 255
  20.   storage
  21.   (
  22.     initial 64K
  23.     next 1M
  24.     minextents 1
  25.     maxextents unlimited
  26.   );
  27. -- Add comments to the table
  28. COMMENT ON TABLE NTS_RD.SERVICE_GROUP
  29.   IS 'Group of services';
  30. -- Add comments to the columns
  31. COMMENT ON column NTS_RD.SERVICE_GROUP.service_group_id
  32.   IS 'Service group identifier';
  33. COMMENT ON column NTS_RD.SERVICE_GROUP.service_group_code
  34.   IS 'Code of service group (organization scope).';
  35. COMMENT ON column NTS_RD.SERVICE_GROUP.service_group_name
  36.   IS 'The name of service group';
  37. COMMENT ON column NTS_RD.SERVICE_GROUP.service_group_name2
  38.   IS 'The name of service group in another language';
  39. COMMENT ON column NTS_RD.SERVICE_GROUP.service_group_type
  40.   IS 'Service group type identifier';
  41. COMMENT ON column NTS_RD.SERVICE_GROUP.description
  42.   IS 'Service group type identifier';
  43. -- Create/Recreate primary, unique and foreign key constraints
  44. ALTER TABLE NTS_RD.SERVICE_GROUP
  45.   add constraint PK_SERVICE_GROUP primary key (SERVICE_GROUP_ID)
  46.   using INDEX
  47.   tablespace NTS_RD
  48.   PCTFREE 10
  49.   initrans 2
  50.   maxtrans 255
  51.   storage
  52.   (
  53.     initial 64K
  54.     next 1M
  55.     minextents 1
  56.     maxextents unlimited
  57.   );
  58. ALTER TABLE NTS_RD.SERVICE_GROUP
  59.   add constraint UK_SERVICE_GROUP_CODE UNIQUE (SERVICE_GROUP_CODE)
  60.   using INDEX
  61.   tablespace NTS_RD
  62.   PCTFREE 10
  63.   initrans 2
  64.   maxtrans 255
  65.   storage
  66.   (
  67.     initial 64K
  68.     next 1M
  69.     minextents 1
  70.     maxextents unlimited
  71.   );
  72. ALTER TABLE NTS_RD.SERVICE_GROUP
  73.   add constraint FK_SVC_GRP_SVC_GRP_TYPE foreign key (SERVICE_GROUP_TYPE)
  74.   references NTS_RD.SERVICE_GROUP_TYPE (SERVICE_GROUP_TYPE);
  75. -- Grant/Revoke object privileges
  76. grant SELECT, INSERT, UPDATE, DELETE, references ON NTS_RD.SERVICE_GROUP TO NTS_INT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement