IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MATERIALSTAGE') 
create table T_POM_MATERIALSTAGE
(
  FID           BIGINT DEFAULT 0 NOT NULL,
  FNUMBER       NVARCHAR(30) DEFAULT ' ' NOT NULL,
  FSTATUS       NVARCHAR(30) DEFAULT ' ' NOT NULL,
  FCREATORID    BIGINT DEFAULT 0 NOT NULL,
  FMODIFIERID   BIGINT DEFAULT 0 NOT NULL,
  FENABLE       NVARCHAR(30) DEFAULT ' ' NOT NULL,
  FCREATETIME   DATETIME,
  FMODIFYTIME   DATETIME,
  FMASTERID     BIGINT DEFAULT 0 NOT NULL,
  FCREATEORGID  BIGINT DEFAULT 0 NOT NULL,
  FORGID        BIGINT DEFAULT 0 NOT NULL,
  FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL,
  FMATERIAL     BIGINT DEFAULT 0 NOT NULL,
  FAUDITOR      BIGINT DEFAULT 0 NOT NULL,
  FAUDITTIME    DATETIME,
  FMATERIALUNIT BIGINT DEFAULT 0 NOT NULL,
  FMINQTY     	DECIMAL(23,10) DEFAULT 0 NOT NULL,
  FMAXQTY       DECIMAL(23,10) DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MATERIALSTAGE_L') 
create table T_POM_MATERIALSTAGE_L
(
  fpkid     	NVARCHAR(18) DEFAULT ' ' NOT NULL,
  fid       	BIGINT DEFAULT 0 NOT NULL,
  flocaleid 	NVARCHAR(10) DEFAULT ' ' NOT NULL,
  fname   		NVARCHAR(50) DEFAULT ' ' NOT NULL
);