ORA-02287:此处不允许序号

来自ling
跳转至: 导航搜索
-- 获取序列下一个值
create or replace function get_seq_next (seq_name in varchar2) return number
is
  seq_val number ;
begin
  execute immediate 'select '|| seq_name|| '.nextval from dual' into seq_val ;
  return seq_val ;
end get_seq_next;


-- Create sequence 
create sequence SEQ_FINANCIAL_PAYABLES_EXPORT
minvalue 1
maxvalue 99999999999
start with 125181
increment by 1
cache 20
cycle;


-- Create table
create table FINANCIAL_PAYABLES_EXPORT
(
  batch_no                    CHAR(36),
  financial_payables_id       VARCHAR2(50) not null,
  id                          NUMBER,
  company_name                VARCHAR2(100),
  source_type                 VARCHAR2(50),
  payment_bank                VARCHAR2(100),
  source_numuber              VARCHAR2(50),
  pay_date                    TIMESTAMP(6),
  pay_status                  VARCHAR2(1),
  missing_ticket_amount       NUMBER(10,2),
  project_name                VARCHAR2(50),
  project_code                VARCHAR2(20),
  form_name                   VARCHAR2(100),
  business_code               VARCHAR2(100),
  cash_flow_account_name      VARCHAR2(50),
  cash_flow_account_code      VARCHAR2(30),
  applicant                   VARCHAR2(50),
  document_date               TIMESTAMP(6),
  posting_date                TIMESTAMP(6),
  synchronization_status      VARCHAR2(1),
  payment_amount              NUMBER(20,2),
  creator                     VARCHAR2(20),
  created_dept_cd             VARCHAR2(20),
  created_date                DATE,
  updator                     VARCHAR2(20),
  updated_dept_cd             VARCHAR2(20),
  updated_date                DATE,
  created_center_cd           VARCHAR2(20),
  created_position_cd         VARCHAR2(20),
  updated_center_cd           VARCHAR2(20),
  updated_position_cd         VARCHAR2(20),
  record_version              NUMBER(20) not null,
  relation_approve_id         VARCHAR2(200),
  synchronous_result          VARCHAR2(200),
  sap_code                    VARCHAR2(200),
  return_message              VARCHAR2(1000),
  payment_slip_type           VARCHAR2(2),
  synchronization_information VARCHAR2(200),
  actual_pay_account          VARCHAR2(150),
  exchange_rate_2             VARCHAR2(50),
  discounted_local_currency_2 VARCHAR2(50),
  pay_subject                 VARCHAR2(200),
  pay_subject_no              VARCHAR2(100),
  currency                    VARCHAR2(50),
  payer                       VARCHAR2(50),
  actual_payment_amount       NUMBER(20,2),
  receiving_unit              VARCHAR2(100),
  accounts_receivable         VARCHAR2(500),
  receivables_bank            VARCHAR2(500),
  document_type               VARCHAR2(1),
  bank_account_id             VARCHAR2(100),
  is_delete                   VARCHAR2(1) not null,
  bukrs                       VARCHAR2(20),
  remark                      VARCHAR2(1000),
  is_execute                  VARCHAR2(1),
  cancel_people               VARCHAR2(100),
  group_cd                    VARCHAR2(50),
  is_bind                     NUMBER(1),
  series_number               VARCHAR2(30),
  discounted_local_currency   NUMBER(18,4),
  exchange_rate               NUMBER(12,10),
  organization_name           VARCHAR2(100),
  organization_code           VARCHAR2(50),
  room_code                   VARCHAR2(100),
  room_info                   VARCHAR2(200),
  business_type               VARCHAR2(100),
  cont_no                     VARCHAR2(50)
);
-- Create/Recreate indexes 
create index IDX_PAYABLES_EXPORT on FINANCIAL_PAYABLES_EXPORT (BATCH_NO, ID);