基于DB2及PHP的应用系统跨平台迁移详细步骤(一)
2010-07-07 15:01:19 来源:WEB开发网srcdb1_foriegnkeys.ddl :包含创建外键约束的 ddl 语句。
清单3. srcdb1_foriegnkeys.ddl 语句
ALTER TABLE " SRCDB1"."SAMPLE_FK_1"
ADD CONSTRAINT "SQL030903143850120" FOREIGN KEY
("FK_COL1")
REFERENCES " SRCDB1"."SAMPLE_TABLE"
("COL1");
ALTER TABLE " SRCDB1"."SAMPLE_FK_2" ADD ……;
……
ALTER TABLE " SRCDB1"."SAMPLE_FK_N" ADD ……;
srcdb1_triggers.ddl :包含创建触发器的 ddl 语句。
清单 4. srcdb1_triggers.ddl 语句
CREATE TRIGGER SRCDB1.SAMPLE_TRIG_1 AFTER UPDATE OF col1 ON SRCDB1.SAMPLE_TAB
REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL WHEN ( n.col1 > 3)
BEGIN ATOMIC
update SAMPLE_TAB
set(col2) = 'anotherValue' where col1 = n.col1 ;--
END;
CREATE TRIGGER SRCDB1. SAMPLE_TRIG_2 ……;
……
CREATE TRIGGER SRCDB1. SAMPLE_TRIG_N ……;
srcdb1_procedures.ddl :包含创建 SQL 存储过程以及 java 存储过程的 ddl 语句。
清单 5. srcdb1_procedures.ddl语句
CREATE PROCEDURE " SRCDB1"." JAVA_PROCEDURE_1" (
OUT SQLSTATE CHARACTER(5),
OUT ROWS_SUBMITED INTEGER,
IN BATCH_ID INTEGER,
IN LEVEL VARCHAR(4000)
)
DYNAMIC RESULT SETS 0
SPECIFIC SUBMIT_BATCH
EXTERNAL NAME 'Submit_batch!submit_batch'
LANGUAGE JAVA
PARAMETER STYLE JAVA
NOT DETERMINISTIC
FENCED THREADSAFE
MODIFIES SQL DATA
NO DBINFO;
CREATE PROCEDURE " SRCDB1"."JAVA_PROCEDURE_2" ……;
……
CREATE PROCEDURE " SRCDB1"."JAVA_PROCEDURE_N" ……;
SET CURRENT SCHEMA = " SRCDB1";
SET CURRENT PATH = "SYSIBM","SYSFUN"," SRCDB1";
CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_1 (
IN hostname varchar(4000),
IN username varchar(4000),
OUT SQLCODE_OUT int )
SPECIFIC SRCDB1.SQL_PROCEDURE_1
LANGUAGE SQL
-------------------------------------------------
-- SQL Stored Procedure
-------------------------------------------------
P1: BEGIN
……
END P1 ;
CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_2 ……;
……
CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_N ……;
更多精彩
赞助商链接