编程技术


编程技术13 Oct 2006 10:43 am

asp.net调用bat和ctl文件实现sql*loader的功能

1  后台调用bat文件

            Dim proc As System.Diagnostics.Process
            proc = System.Diagnostics.Process.Start("cmd.exe", " /c " & "D:\execise\SE004.bat")
            proc.WaitForExit()
  或者

        Shell("cmd.exe /c D:\execise\SE004.bat", AppWinStyle.NormalFocus)

 或者

             Dim p As New System.Diagnostics.Process
            ‘p.StartInfo.FileName = "cmd.exe"
            ‘p.StartInfo.Arguments = " /c " & "D:\execise\SE004.bat"
            ‘p.StartInfo.UseShellExecute = False
            ‘p.StartInfo.RedirectStandardInput = True
            ‘p.StartInfo.RedirectStandardOutput = True
            ‘p.StartInfo.RedirectStandardError = True
            ‘p.StartInfo.CreateNoWindow = False
            ‘p.Start()

            ‘Dim strValue As String = p.StandardOutput.ReadToEnd()

2  然后调用ctl文件,bat文件的

    SQLLDR USERID=spv3/paper@san CONTROL=d:\execise\SE004.CTL log=D:\execise\LOG\SE004.log

3, ctl文件的内容如下

   

LOAD DATA
INFILE ‘D:\execise\SE004.CSV’
TRUNCATE
INTO TABLE TEMP_tableName
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
(
id

,age

,num

,sum

)

4. 数据文件以 逗号分割

编程技术13 Oct 2006 10:32 am

Oracle数据库中跨库查询的连接语句

就是目前程序操作的是db1数据库,但由于某种原因,需要访问db2数据库里的表,连接如下

create database link dbLink
connect to USERID identified by PASSWORD
using ‘SID’;
/
select * from SID.tableName@dbLink;
/
drop database link dbLink;

编程技术08 Oct 2006 02:38 pm

            Dim objFileInfo As System.IO.FileInfo = New System.IO.FileInfo(strWinPath & strFileNm)

            If System.IO.File.Exists(strWinPath & strFileNm) Then
                Response.Clear()
                Response.ContentType = "application/octet-stream"
                Response.AddHeader("Content-Disposition", "attachment;  filename=" + objFileInfo.Name)
                Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
                Response.WriteFile(objFileInfo.FullName)
                Response.Flush()
                Response.End()
            End If

编程技术15 Aug 2006 01:58 pm

DROP PACKAGE NAIS.NAIS_IMPORT_REPAIR
/

CREATE OR REPLACE PACKAGE NAIS.NAIS_IMPORT_REPAIR
IS

FUNCTION NAIS_SP_IMPORT_REPAIR
RETURN VARCHAR2;

END;
/

CREATE OR REPLACE PACKAGE BODY NAIS.NAIS_IMPORT_REPAIR
IS
FUNCTION NAIS_SP_IMPORT_REPAIR

RETURN VARCHAR2 IS

BEGIN
    DECLARE
        /* 修理品注文基本IFワークに検索処理 検索用 */
        CURSOR CUR1 IS
            SELECT
            ORD_DATA_CLS,
            ORD_ORDER_NO_1,
            ORD_ORDER_NO_2,
            ORD_ORDER_NO_3,
            ORD_ORDER_CLS,
            ORD_REQUEST_CLS,
            ORD_DEPT_CLS,
            ORD_OWNER_CD,
            VENDER_CD,
            ORD_DLV_SITE_CD,
            ORD_DLV_SITE_NM,
            ORD_USAGE_MODEL_CD,
            ORD_CURRENCY_CLS,
            ORD_CLAIM_NO,
            ORD_DIRECTIVE_NO,
            ORD_ESTM_NO,
            ORD_DEMANDER_CD,
            ORD_SUPPLIER_CD,
            ORD_PURVEYOR_CD,
            ORD_DEMAND_DATE,
            ORD_ORDER_DATE,
            ORD_ORDER_RAIT,
            ORD_DATA_ENTRY_DATE,
            ORD_DATA_ENTRY_TIME,
            ORD_DATA_DELETE_DATE,
            ORD_DATA_DELETE_TIME,
            ORD_AAC_OR_OTHER_CLS,
            ORD_FOREIGN_ORDER_NO_1,
            ORD_FOREIGN_ORDER_NO_2,
            ORD_VENDER_DPT,
            ORD_VENDER_PERSON,
            ORD_HD_TREATMENT_CLS,
            ORD_ISSURANCE_CLS,
            ORD_FIX_CLS,
            ORD_TOTAL_AMT,
            ORD_FOREIGN_TOTAL_AMT,
            ORD_ITEM_QTY,
            ORD_PAGE_QTY,
            ORD_ORDER_NOTE1,
            ORD_ORDER_NOTE2,
            ORD_ORDER_NOTE3,
            ORD_ORDER_NOTE4,
            ORD_DEMAND_NOTE1,
            ORD_DEMAND_NOTE2,
            ORD_DEMAND_NOTE3,
            ORD_DEMAND_NOTE4,
            INS_FUNCTION_ID,
            INS_USER_CD,
            INS_DATETIME,
            UPD_FUNCTION_ID,
            UPD_USER_CD,
            UPD_DATETIME
            FROM
            NAIS_I_REPAIR_ORDER_HD;
        /* 修理品注文に検索処理 検索用 */
        CURSOR CUR2 IS
            SELECT
            ORD_ORDER_NO_1,
            ORD_ORDER_NO_2,
            ORD_ORDER_NO_3,
            ORD_DATA_CLS,
            ORD_ORDER_CLS,
            ORD_REQUEST_CLS,
            ORD_DEPT_CLS,
            ORD_OWNER_CD,
            VENDER_CD,
            ORD_DLV_SITE_CD,
            ORD_DLV_SITE_NM,
            ORD_USAGE_MODEL_CD,
            ORD_CURRENCY_CLS,
            ORD_CLAIM_NO,
            ORD_DIRECTIVE_NO,
            ORD_ESTM_NO,
            ORD_DEMANDER_CD,
            ORD_SUPPLIER_CD,
            ORD_PURVEYOR_CD,
            ORD_DEMAND_DATE,
            ORD_ORDER_DATE,
            ORD_ORDER_RAIT,
            ORD_DATA_ENTRY_DATE,
            ORD_DATA_ENTRY_TIME,
            ORD_DATA_DELETE_DATE,
            ORD_DATA_DELETE_TIME,
            ORD_AAC_OR_OTHER_CLS,
            ORD_FOREIGN_ORDER_NO_1,
            ORD_FOREIGN_ORDER_NO_2,
            ORD_VENDER_DPT,
            ORD_VENDER_PERSON,
            ORD_HD_TREATMENT_CLS,
            ORD_ISSURANCE_CLS,
            ORD_FIX_CLS,
            ORD_TOTAL_AMT,
            ORD_FOREIGN_TOTAL_AMT,
            ORD_ITEM_QTY,
            ORD_PAGE_QTY,
            ORD_ORDER_NOTE1,
            ORD_ORDER_NOTE2,
            ORD_ORDER_NOTE3,
            ORD_ORDER_NOTE4,
            ORD_DEMAND_NOTE1,
            ORD_DEMAND_NOTE2,
            ORD_DEMAND_NOTE3,
            ORD_DEMAND_NOTE4,
            ORD_ORDER_REMARKS,
            BAT_UPD_DATETIME,
            BAT_UPD_USER_CD,
            INS_FUNCTION_ID,
            INS_USER_CD,
            INS_DATETIME,
            UPD_FUNCTION_ID,
            UPD_USER_CD,
            UPD_DATETIME
            FROM
            NAIS_T_REPAIR_ORDER_HD;
        /* 修理品注文明細I/Fワークに検索処理 検索用 */
        CURSOR CUR3 IS
            SELECT
            ORD_DATA_CLS,
            ORD_ORDER_NO_1,
            ORD_ORDER_NO_2,
            ORD_ORDER_NO_3,
            ORD_ITEM_NO,
            AA_JANO,
            ORD_JANO_REG_CLS,
            ORD_DEMAND_ITEM_NO,
            ORD_ORDER_PARTS_NO,
            ORD_ARRIVAL_PARTS_NO,
            ORD_ORDER_PARTS_NM,
            ORD_ARRIVAL_PARTS_NM,
            ORD_ORDER_SERIAL_NO,
            ORD_ARRIVAL_SERIAL_NO,
            ORD_TAG1,
            ORD_TAG2,
            ORD_WORK_CLS,
            ORD_TROUBLE_FIND_CD,
            ORD_TROUBLE_FIND_NM,
            ORD_TROUBLE_CONDITION_CD,
            ORD_TROUBLE_CONDITION_NM,
            ORD_TT,
            ORD_TT_PRINT_CLS,
            ORD_TSO_HOURS,
            ORD_TSO_PRINT_CLS,
            ORD_TSI_HOURS,
            ORD_TSI_PRINT_CLS,
            ORD_TAKE_OFF_AIRF_NO,
            ORD_TAKE_OFF_SERIAL_NO,
            ORD_MEMO,
            ORD_DESIRED_DLV_DATE,
            ORD_DLV_DATE,
            ORD_USE_AIRF_NM,
            ATA_CD,
            ORD_MODEL_ATA,
            ORD_DEMAND_QTY,
            ORD_ORDER_QTY,
            ORD_ORDER_UNIT_COST,
            ORD_ORDER_FOREIGN_UNIT_COST,
            ORD_ORDER_AMT,
            ORD_ORDER_FOREIGN_AMT,
            ORD_ARRIVAL_DATE,
            ORD_ARRIVAL_FIXED_QTY,
            ORD_ARRIVAL_QTY,
            ORD_ARRIVAL_AMT,
            ORD_ARRIVAL_FOREIGN_AMT,
            ORD_ARRIVAL_RAIT,
            ORD_PARTITIAL_DLV_CNT,
            ORD_PAYMENT_DATE,
            ORD_PAYMENT_QTY,
            ORD_PAYMENT_YEN_AMT,
            ORD_PAYMENT_FOREIGN_AMT,
            ORD_PAYMENT_ACTUAL_DATE,
            ORD_DT_TREATMENT_CLS,
            ORD_ISSURANCE_CLS,
            ORD_FIX_CLS,
            ORD_ABSENCE_CLS,
            ORD_STS_CLS,
            ORD_DATA_ENTRY_DATE,
            ORD_DATA_ENTRY_TIME,
            ORD_DATA_DELETE_DATE,
            ORD_DATA_DELETE_TIME,
            ORD_REFERENCE_KEY,
            INS_FUNCTION_ID,
            INS_USER_CD,
            INS_DATETIME,
            UPD_FUNCTION_ID,
            UPD_USER_CD,
            UPD_DATETIME
            FROM
            NAIS_I_REPAIR_ORDER_DT;
        /* 修理品注文明細に検索処理 検索用 */
        CURSOR CUR4 IS
            SELECT
            ORD_ORDER_NO_1,
            ORD_ORDER_NO_2,
            ORD_ORDER_NO_3,
            ORD_ITEM_NO,
            ORD_DATA_CLS,
            AA_JANO,
            ORD_JANO_REG_CLS,
            ORD_DEMAND_ITEM_NO,
            ORD_ORDER_PARTS_NO,
            ORD_ARRIVAL_PARTS_NO,
            ORD_ORDER_PARTS_NM,
            ORD_ARRIVAL_PARTS_NM,
            ORD_ORDER_SERIAL_NO,
            ORD_ARRIVAL_SERIAL_NO,
            ORD_TAG1,
            ORD_TAG2,
            ORD_WORK_CLS,
            ORD_TROUBLE_FIND_CD,
            ORD_TROUBLE_FIND_NM,
            ORD_TROUBLE_CONDITION_CD,
            ORD_TROUBLE_CONDITION_NM,
            ORD_TT,
            ORD_TT_PRINT_CLS,
            ORD_TSO_HOURS,
            ORD_TSO_PRINT_CLS,
            ORD_TSI_HOURS,
            ORD_TSI_PRINT_CLS,
            ORD_TAKE_OFF_AIRF_NO,
            ORD_TAKE_OFF_SERIAL_NO,
            ORD_MEMO,
            ORD_DESIRED_DLV_DATE,
            ORD_DLV_DATE,
            ORD_USE_AIRF_NM,
            ATA_CD,
            ORD_MODEL_ATA,
            ORD_DEMAND_QTY,
            ORD_ORDER_QTY,
            ORD_ORDER_UNIT_COST,
            ORD_ORDER_FOREIGN_UNIT_COST,
            ORD_ORDER_AMT,
            ORD_ORDER_FOREIGN_AMT,
            ORD_ARRIVAL_DATE,
            ORD_ARRIVAL_FIXED_QTY,
            ORD_ARRIVAL_QTY,
            ORD_ARRIVAL_AMT,
            ORD_ARRIVAL_FOREIGN_AMT,
            ORD_ARRIVAL_RAIT,
            ORD_PARTITIAL_DLV_CNT,
            ORD_PAYMENT_DATE,
            ORD_PAYMENT_QTY,
            ORD_PAYMENT_YEN_AMT,
            ORD_PAYMENT_FOREIGN_AMT,
            ORD_PAYMENT_ACTUAL_DATE,
            ORD_DT_TREATMENT_CLS,
            ORD_ISSURANCE_CLS,
            ORD_FIX_CLS,
            ORD_ABSENCE_CLS,
            ORD_STS_CLS,
            ORD_DATA_ENTRY_DATE,
            ORD_DATA_ENTRY_TIME,
            ORD_DATA_DELETE_DATE,
            ORD_DATA_DELETE_TIME,
            ORD_REFERENCE_KEY,
            ORD_WORK_CLS_NM,
            ORD_OANO,
            ORD_VENDER_PARTS_NO,
            ORD_QUOTE_NO,
            ORD_WORK_APPROVAL_DATE,
            ORD_TURN_AROUND_TIME_SCHDL,
            ORD_DMRNO,
            ORD_UNREPAIRABLE_AMT,
            ORD_RPR_REMARKS,
            ORD_RESERVE_COMMENT,
            ORD_TROUBLE_COMMENT_CLS,
            ORD_DLV_INVOICE_NO,
            ORD_SEND_DATE,
            ORD_SEND_POINT_CLS,
            ORD_DLV_AWB_NO,
            ORD_INPUT_FILE_NO,
            DOCUMENT_CD,
            ORD_ESTM_FIXED_AMT,
            ORD_ESTM_YEN_AMT,
            ORD_FACTORY_SHIPMENT_DATE,
            ORD_ARRIVAL_INVOICE_NO,
            ORD_RETURN_SITE_CLS,
            ORD_ARRIVAL_AWB_NO,
            ORD_ENTRY_FILE_NO,
            ORD_RPR_ARRIVAL_REMARKS,
            BAT_UPD_DATETIME,
            BAT_UPD_USER_CD,
            INS_FUNCTION_ID,
            INS_USER_CD,
            INS_DATETIME,
            UPD_FUNCTION_ID,
            UPD_USER_CD,
            UPD_DATETIME
            FROM
            NAIS_T_REPAIR_ORDER_DT;
        ICOUNT NUMBER;
        /* 注文品見積確定金額 */
        T_ORD_ESTM_FIXED_AMT NUMBER(12, 2);
        /* 注文品作業承認日 */
        T_ORD_WORK_APPROVAL_DATE VARCHAR2(10);
        /* 注文品注文時レート */
        I_ORD_ORDER_RAIT NUMBER(6, 2);
        /* 注文品見積金額(邦貨) */
        T_ORD_ESTM_YEN_AMT_1 NUMBER(14, 0);
        T_ORD_ESTM_YEN_AMT_2 NUMBER(14, 0);

    BEGIN
        FOR EACHROW IN CUR1 LOOP
            SELECT
            COUNT(*) INTO ICOUNT
            FROM
            NAIS_T_REPAIR_ORDER_HD
            WHERE
            ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
            AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
            AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3;

            /*
              以下の場合は、修理品注文のデータを更新する。

              検索条件
              修理品注文基本IFワーク.注文品注文番号1 = 修理品注文.注文品注文番号1 AND
              修理品注文基本IFワーク.注文品注文番号2 = 修理品注文.注文品注文番号2 AND
              修理品注文基本IFワーク.注文品注文番号3 = 修理品注文.注文品注文番号3

            */
            IF ICOUNT > 0 THEN
                UPDATE NAIS_T_REPAIR_ORDER_HD SET
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1,
                ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2,
                ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3,
                ORD_DATA_CLS = EACHROW.ORD_DATA_CLS,
                ORD_ORDER_CLS = EACHROW.ORD_ORDER_CLS,
                ORD_REQUEST_CLS = EACHROW.ORD_REQUEST_CLS,
                ORD_DEPT_CLS = EACHROW.ORD_DEPT_CLS,
                ORD_OWNER_CD = EACHROW.ORD_OWNER_CD,
                VENDER_CD = EACHROW.VENDER_CD,
                ORD_DLV_SITE_CD = EACHROW.ORD_DLV_SITE_CD,
                ORD_DLV_SITE_NM = EACHROW.ORD_DLV_SITE_NM,
                ORD_USAGE_MODEL_CD = EACHROW.ORD_USAGE_MODEL_CD,
                ORD_CURRENCY_CLS = EACHROW.ORD_CURRENCY_CLS,
                ORD_CLAIM_NO = EACHROW.ORD_CLAIM_NO,
                ORD_DIRECTIVE_NO = EACHROW.ORD_DIRECTIVE_NO,
                ORD_ESTM_NO = EACHROW.ORD_ESTM_NO,
                ORD_DEMANDER_CD = EACHROW.ORD_DEMANDER_CD,
                ORD_SUPPLIER_CD = EACHROW.ORD_SUPPLIER_CD,
                ORD_PURVEYOR_CD = EACHROW.ORD_PURVEYOR_CD,
                ORD_DEMAND_DATE = EACHROW.ORD_DEMAND_DATE,
                ORD_ORDER_DATE = EACHROW.ORD_ORDER_DATE,
                ORD_ORDER_RAIT = EACHROW.ORD_ORDER_RAIT,
                ORD_DATA_ENTRY_DATE = EACHROW.ORD_DATA_ENTRY_DATE,
                ORD_DATA_ENTRY_TIME = EACHROW.ORD_DATA_ENTRY_TIME,
                ORD_DATA_DELETE_DATE = EACHROW.ORD_DATA_DELETE_DATE,
                ORD_DATA_DELETE_TIME = EACHROW.ORD_DATA_DELETE_TIME,
                ORD_AAC_OR_OTHER_CLS = EACHROW.ORD_AAC_OR_OTHER_CLS,
                ORD_FOREIGN_ORDER_NO_1 = EACHROW.ORD_FOREIGN_ORDER_NO_1,
                ORD_FOREIGN_ORDER_NO_2 = EACHROW.ORD_FOREIGN_ORDER_NO_2,
                ORD_VENDER_DPT = EACHROW.ORD_VENDER_DPT,
                ORD_VENDER_PERSON = EACHROW.ORD_VENDER_PERSON,
                ORD_HD_TREATMENT_CLS = EACHROW.ORD_HD_TREATMENT_CLS,
                ORD_ISSURANCE_CLS = EACHROW.ORD_ISSURANCE_CLS,
                ORD_FIX_CLS = EACHROW.ORD_FIX_CLS,
                ORD_TOTAL_AMT = EACHROW.ORD_TOTAL_AMT,
                ORD_FOREIGN_TOTAL_AMT = EACHROW.ORD_FOREIGN_TOTAL_AMT,
                ORD_ITEM_QTY = EACHROW.ORD_ITEM_QTY,
                ORD_PAGE_QTY = EACHROW.ORD_PAGE_QTY,
                ORD_ORDER_NOTE1 = EACHROW.ORD_ORDER_NOTE1,
                ORD_ORDER_NOTE2 = EACHROW.ORD_ORDER_NOTE2,
                ORD_ORDER_NOTE3 = EACHROW.ORD_ORDER_NOTE3,
                ORD_ORDER_NOTE4 = EACHROW.ORD_ORDER_NOTE4,
                ORD_DEMAND_NOTE1 = EACHROW.ORD_DEMAND_NOTE1,
                ORD_DEMAND_NOTE2 = EACHROW.ORD_DEMAND_NOTE2,
                ORD_DEMAND_NOTE3 = EACHROW.ORD_DEMAND_NOTE3,
                ORD_DEMAND_NOTE4 = EACHROW.ORD_DEMAND_NOTE4,
                BAT_UPD_DATETIME = SYSDATE,
                BAT_UPD_USER_CD = EACHROW.UPD_USER_CD,
                UPD_FUNCTION_ID = EACHROW.UPD_FUNCTION_ID
                WHERE
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
                AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
                AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3;
            ELSE
                /*
                  注文品注文番号1~3が
                  修理品注文基本IFワークにのみ存在する場合は、

                  修理品注文にデータを作成する
                */
                INSERT INTO NAIS_T_REPAIR_ORDER_HD(
                ORD_ORDER_NO_1,
                ORD_ORDER_NO_2,
                ORD_ORDER_NO_3,
                ORD_DATA_CLS,
                ORD_ORDER_CLS,
                ORD_REQUEST_CLS,
                ORD_DEPT_CLS,
                ORD_OWNER_CD,
                VENDER_CD,
                ORD_DLV_SITE_CD,
                ORD_DLV_SITE_NM,
                ORD_USAGE_MODEL_CD,
                ORD_CURRENCY_CLS,
                ORD_CLAIM_NO,
                ORD_DIRECTIVE_NO,
                ORD_ESTM_NO,
                ORD_DEMANDER_CD,
                ORD_SUPPLIER_CD,
                ORD_PURVEYOR_CD,
                ORD_DEMAND_DATE,
                ORD_ORDER_DATE,
                ORD_ORDER_RAIT,
                ORD_DATA_ENTRY_DATE,
                ORD_DATA_ENTRY_TIME,
                ORD_DATA_DELETE_DATE,
                ORD_DATA_DELETE_TIME,
                ORD_AAC_OR_OTHER_CLS,
                ORD_FOREIGN_ORDER_NO_1,
                ORD_FOREIGN_ORDER_NO_2,
                ORD_VENDER_DPT,
                ORD_VENDER_PERSON,
                ORD_HD_TREATMENT_CLS,
                ORD_ISSURANCE_CLS,
                ORD_FIX_CLS,
                ORD_TOTAL_AMT,
                ORD_FOREIGN_TOTAL_AMT,
                ORD_ITEM_QTY,
                ORD_PAGE_QTY,
                ORD_ORDER_NOTE1,
                ORD_ORDER_NOTE2,
                ORD_ORDER_NOTE3,
                ORD_ORDER_NOTE4,
                ORD_DEMAND_NOTE1,
                ORD_DEMAND_NOTE2,
                ORD_DEMAND_NOTE3,
                ORD_DEMAND_NOTE4,
                ORD_ORDER_REMARKS,
                BAT_UPD_DATETIME,
                BAT_UPD_USER_CD,
                INS_FUNCTION_ID,
                INS_USER_CD,
                INS_DATETIME,
                UPD_FUNCTION_ID,
                UPD_USER_CD,
                UPD_DATETIME)
                VALUES(
                EACHROW.ORD_ORDER_NO_1,
                EACHROW.ORD_ORDER_NO_2,
                EACHROW.ORD_ORDER_NO_3,
                EACHROW.ORD_DATA_CLS,
                EACHROW.ORD_ORDER_CLS,
                EACHROW.ORD_REQUEST_CLS,
                EACHROW.ORD_DEPT_CLS,
                EACHROW.ORD_OWNER_CD,
                EACHROW.VENDER_CD,
                EACHROW.ORD_DLV_SITE_CD,
                EACHROW.ORD_DLV_SITE_NM,
                EACHROW.ORD_USAGE_MODEL_CD,
                EACHROW.ORD_CURRENCY_CLS,
                EACHROW.ORD_CLAIM_NO,
                EACHROW.ORD_DIRECTIVE_NO,
                EACHROW.ORD_ESTM_NO,
                EACHROW.ORD_DEMANDER_CD,
                EACHROW.ORD_SUPPLIER_CD,
                EACHROW.ORD_PURVEYOR_CD,
                EACHROW.ORD_DEMAND_DATE,
                EACHROW.ORD_ORDER_DATE,
                EACHROW.ORD_ORDER_RAIT,
                EACHROW.ORD_DATA_ENTRY_DATE,
                EACHROW.ORD_DATA_ENTRY_TIME,
                EACHROW.ORD_DATA_DELETE_DATE,
                EACHROW.ORD_DATA_DELETE_TIME,
                EACHROW.ORD_AAC_OR_OTHER_CLS,
                EACHROW.ORD_FOREIGN_ORDER_NO_1,
                EACHROW.ORD_FOREIGN_ORDER_NO_2,
                EACHROW.ORD_VENDER_DPT,
                EACHROW.ORD_VENDER_PERSON,
                EACHROW.ORD_HD_TREATMENT_CLS,
                EACHROW.ORD_ISSURANCE_CLS,
                EACHROW.ORD_FIX_CLS,
                EACHROW.ORD_TOTAL_AMT,
                EACHROW.ORD_FOREIGN_TOTAL_AMT,
                EACHROW.ORD_ITEM_QTY,
                EACHROW.ORD_PAGE_QTY,
                EACHROW.ORD_ORDER_NOTE1,
                EACHROW.ORD_ORDER_NOTE2,
                EACHROW.ORD_ORDER_NOTE3,
                EACHROW.ORD_ORDER_NOTE4,
                EACHROW.ORD_DEMAND_NOTE1,
                EACHROW.ORD_DEMAND_NOTE2,
                EACHROW.ORD_DEMAND_NOTE3,
                EACHROW.ORD_DEMAND_NOTE4,
                NULL,
                SYSDATE,
                EACHROW.UPD_USER_CD,
                EACHROW.INS_FUNCTION_ID,
                EACHROW.INS_USER_CD,
                SYSDATE,
                EACHROW.UPD_FUNCTION_ID,
                EACHROW.UPD_USER_CD,
                SYSDATE
                );
            END IF;
        END LOOP;

        FOR EACHROW IN CUR2 LOOP
            SELECT
            COUNT(*) INTO ICOUNT
            FROM NAIS_I_REPAIR_ORDER_HD
            WHERE
            ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
            AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
            AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3;

            /*
              注文品注文番号1~3が修理品注文にのみ存在する場合は、

              修理品注文とそれに紐づく修理品注文明細のデータを削除する。

              削除データ抽出条件(修理品注文明細)

              修理品注文.注文品注文番号1 = 修理品注文明細.注文品注文番号1 AND
              修理品注文.注文品注文番号2 = 修理品注文明細.注文品注文番号2 AND
              修理品注文.注文品注文番号3 = 修理品注文明細.注文品注文番号3

            */
            IF ICOUNT < 1 THEN
                /* 修理品注文のデータを削除する */
                DELETE FROM NAIS_T_REPAIR_ORDER_HD
                WHERE
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
                AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
                AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3;

                /* 修理品注文明細のデータを削除する */
                DELETE FROM NAIS_T_REPAIR_ORDER_DT
                WHERE
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
                AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
                AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3;
            END IF;
        END LOOP;

        FOR EACHROW IN CUR3 LOOP
            SELECT
            COUNT(*) INTO ICOUNT
            FROM
            NAIS_T_REPAIR_ORDER_DT
            WHERE
            ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
            AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
            AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3
            AND ORD_ITEM_NO = EACHROW.ORD_ITEM_NO;

            /*
              修理品注文基本IFワーク.注文品注文時レート検索処理

              修理品注文明細IFワーク.注文品注文番号1 = 修理品注文基本IFワーク.注文品注文番号1 AND
              修理品注文明細IFワーク.注文品注文番号2 = 修理品注文基本IFワーク.注文品注文番号2 AND
              修理品注文明細IFワーク.注文品注文番号3 = 修理品注文基本IFワーク.注文品注文番号3

            */
            SELECT
            ORD_ORDER_RAIT INTO I_ORD_ORDER_RAIT
            FROM
            NAIS_I_REPAIR_ORDER_HD
            WHERE
            ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
            AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
            AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3;

            /* 注文品見積金額(邦貨) */
            T_ORD_ESTM_YEN_AMT_1 := NULL;
            T_ORD_ESTM_YEN_AMT_2 := NULL;

            /*
              以下の場合は、修理品注文明細のデータを更新する。

              検索条件
              修理品注文明細IFワーク.注文品注文番号1 = 修理品注文明細.注文品注文番号1 AND
              修理品注文明細IFワーク.注文品注文番号2 = 修理品注文明細.注文品注文番号2 AND
              修理品注文明細IFワーク.注文品注文番号3 = 修理品注文明細.注文品注文番号3 AND
              修理品注文明細IFワーク.注文品項目番号 = 修理品注文明細.注文品項目番号
            */
            IF ICOUNT > 0 THEN
                SELECT
                /* 注文品作業承認日 */
                ORD_WORK_APPROVAL_DATE,
                /* 注文品見積確定金額 */
                ORD_ESTM_FIXED_AMT
                INTO
                T_ORD_WORK_APPROVAL_DATE,
                T_ORD_ESTM_FIXED_AMT
                FROM
                NAIS_T_REPAIR_ORDER_DT
                WHERE
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
                AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
                AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3
                AND ORD_ITEM_NO = EACHROW.ORD_ITEM_NO;

                /* 修理品注文明細.注文品作業承認日 IS NULL
                   修理品注文明細.注文品見積確定金額 ← 修理品注文明細IFワーク.注文品注文外貨金額

                */
                IF T_ORD_WORK_APPROVAL_DATE IS NULL THEN
                    /* 注文品見積確定金額 */
                    T_ORD_ESTM_FIXED_AMT := EACHROW.ORD_ORDER_FOREIGN_AMT;
                END IF;
                IF T_ORD_ESTM_FIXED_AMT IS NOT NULL AND I_ORD_ORDER_RAIT IS NOT NULL THEN
                    /* 注文品見積金額(邦貨) */
                    T_ORD_ESTM_YEN_AMT_1 := ROUND(T_ORD_ESTM_FIXED_AMT * I_ORD_ORDER_RAIT);
                END IF;

                /* 修理品注文明細のデータを更新する */
                UPDATE NAIS_T_REPAIR_ORDER_DT SET
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1,
                ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2,
                ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3,
                ORD_ITEM_NO = EACHROW.ORD_ITEM_NO,
                ORD_DATA_CLS = EACHROW.ORD_DATA_CLS,
                AA_JANO = EACHROW.AA_JANO,
                ORD_JANO_REG_CLS = EACHROW.ORD_JANO_REG_CLS,
                ORD_DEMAND_ITEM_NO = EACHROW.ORD_DEMAND_ITEM_NO,
                ORD_ORDER_PARTS_NO = EACHROW.ORD_ORDER_PARTS_NO,
                ORD_ARRIVAL_PARTS_NO = EACHROW.ORD_ARRIVAL_PARTS_NO,
                ORD_ORDER_PARTS_NM = EACHROW.ORD_ORDER_PARTS_NM,
                ORD_ARRIVAL_PARTS_NM = EACHROW.ORD_ARRIVAL_PARTS_NM,
                ORD_ORDER_SERIAL_NO = EACHROW.ORD_ORDER_SERIAL_NO,
                ORD_ARRIVAL_SERIAL_NO = EACHROW.ORD_ARRIVAL_SERIAL_NO,
                ORD_TAG1 = EACHROW.ORD_TAG1,
                ORD_TAG2 = EACHROW.ORD_TAG2,
                ORD_WORK_CLS = EACHROW.ORD_WORK_CLS,
                ORD_TROUBLE_FIND_CD = EACHROW.ORD_TROUBLE_FIND_CD,
                ORD_TROUBLE_FIND_NM = EACHROW.ORD_TROUBLE_FIND_NM,
                ORD_TROUBLE_CONDITION_CD = EACHROW.ORD_TROUBLE_CONDITION_CD,
                ORD_TROUBLE_CONDITION_NM = EACHROW.ORD_TROUBLE_CONDITION_NM,
                ORD_TT = EACHROW.ORD_TT,
                ORD_TT_PRINT_CLS = EACHROW.ORD_TT_PRINT_CLS,
                ORD_TSO_HOURS = EACHROW.ORD_TSO_HOURS,
                ORD_TSO_PRINT_CLS = EACHROW.ORD_TSO_PRINT_CLS,
                ORD_TSI_HOURS = EACHROW.ORD_TSI_HOURS,
                ORD_TSI_PRINT_CLS = EACHROW.ORD_TSI_PRINT_CLS,
                ORD_TAKE_OFF_AIRF_NO = EACHROW.ORD_TAKE_OFF_AIRF_NO,
                ORD_TAKE_OFF_SERIAL_NO = EACHROW.ORD_TAKE_OFF_SERIAL_NO,
                ORD_MEMO = EACHROW.ORD_MEMO,
                ORD_DESIRED_DLV_DATE = EACHROW.ORD_DESIRED_DLV_DATE,
                ORD_DLV_DATE = EACHROW.ORD_DLV_DATE,
                ORD_USE_AIRF_NM = EACHROW.ORD_USE_AIRF_NM,
                ATA_CD = EACHROW.ATA_CD,
                ORD_MODEL_ATA = EACHROW.ORD_MODEL_ATA,
                ORD_DEMAND_QTY = EACHROW.ORD_DEMAND_QTY,
                ORD_ORDER_QTY = EACHROW.ORD_ORDER_QTY,
                ORD_ORDER_UNIT_COST = EACHROW.ORD_ORDER_UNIT_COST,
                ORD_ORDER_FOREIGN_UNIT_COST = EACHROW.ORD_ORDER_FOREIGN_UNIT_COST,
                ORD_ORDER_AMT = EACHROW.ORD_ORDER_AMT,
                ORD_ORDER_FOREIGN_AMT = EACHROW.ORD_ORDER_FOREIGN_AMT,
                ORD_ARRIVAL_DATE = EACHROW.ORD_ARRIVAL_DATE,
                ORD_ARRIVAL_FIXED_QTY = EACHROW.ORD_ARRIVAL_FIXED_QTY,
                ORD_ARRIVAL_QTY = EACHROW.ORD_ARRIVAL_QTY,
                ORD_ARRIVAL_AMT = EACHROW.ORD_ARRIVAL_AMT,
                ORD_ARRIVAL_FOREIGN_AMT = EACHROW.ORD_ARRIVAL_FOREIGN_AMT,
                ORD_ARRIVAL_RAIT = EACHROW.ORD_ARRIVAL_RAIT,
                ORD_PARTITIAL_DLV_CNT = EACHROW.ORD_PARTITIAL_DLV_CNT,
                ORD_PAYMENT_DATE = EACHROW.ORD_PAYMENT_DATE,
                ORD_PAYMENT_QTY = EACHROW.ORD_PAYMENT_QTY,
                ORD_PAYMENT_YEN_AMT = EACHROW.ORD_PAYMENT_YEN_AMT,
                ORD_PAYMENT_FOREIGN_AMT = EACHROW.ORD_PAYMENT_FOREIGN_AMT,
                ORD_PAYMENT_ACTUAL_DATE = EACHROW.ORD_PAYMENT_ACTUAL_DATE,
                ORD_DT_TREATMENT_CLS = EACHROW.ORD_DT_TREATMENT_CLS,
                ORD_ISSURANCE_CLS = EACHROW.ORD_ISSURANCE_CLS,
                ORD_FIX_CLS = EACHROW.ORD_FIX_CLS,
                ORD_ABSENCE_CLS = EACHROW.ORD_ABSENCE_CLS,
                ORD_STS_CLS = EACHROW.ORD_STS_CLS,
                ORD_DATA_ENTRY_DATE = EACHROW.ORD_DATA_ENTRY_DATE,
                ORD_DATA_ENTRY_TIME = EACHROW.ORD_DATA_ENTRY_TIME,
                ORD_DATA_DELETE_DATE = EACHROW.ORD_DATA_DELETE_DATE,
                ORD_DATA_DELETE_TIME = EACHROW.ORD_DATA_DELETE_TIME,
                ORD_REFERENCE_KEY = EACHROW.ORD_REFERENCE_KEY,
                ORD_ESTM_FIXED_AMT = T_ORD_ESTM_FIXED_AMT,
                ORD_ESTM_YEN_AMT = T_ORD_ESTM_YEN_AMT_1,
                BAT_UPD_DATETIME = SYSDATE,
                BAT_UPD_USER_CD = EACHROW.UPD_USER_CD,
                UPD_FUNCTION_ID = EACHROW.UPD_FUNCTION_ID
                WHERE
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
                AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
                AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3
                AND ORD_ITEM_NO = EACHROW.ORD_ITEM_NO;
            ELSE
                IF EACHROW.ORD_ORDER_FOREIGN_AMT IS NOT NULL AND I_ORD_ORDER_RAIT IS NOT NULL THEN
                    /* 注文品見積金額(邦貨) */
                    T_ORD_ESTM_YEN_AMT_2 := ROUND(EACHROW.ORD_ORDER_FOREIGN_AMT * I_ORD_ORDER_RAIT);
                END IF;

                /*
                  注文品注文番号1~3,注文品項目番号が

                  修理品注文明細IFワークにのみ存在する場合は、

                  修理品注文明細にデータを作成する。

                */
                INSERT INTO NAIS_T_REPAIR_ORDER_DT(
                ORD_ORDER_NO_1,
                ORD_ORDER_NO_2,
                ORD_ORDER_NO_3,
                ORD_ITEM_NO,
                ORD_DATA_CLS,
                AA_JANO,
                ORD_JANO_REG_CLS,
                ORD_DEMAND_ITEM_NO,
                ORD_ORDER_PARTS_NO,
                ORD_ARRIVAL_PARTS_NO,
                ORD_ORDER_PARTS_NM,
                ORD_ARRIVAL_PARTS_NM,
                ORD_ORDER_SERIAL_NO,
                ORD_ARRIVAL_SERIAL_NO,
                ORD_TAG1,
                ORD_TAG2,
                ORD_WORK_CLS,
                ORD_TROUBLE_FIND_CD,
                ORD_TROUBLE_FIND_NM,
                ORD_TROUBLE_CONDITION_CD,
                ORD_TROUBLE_CONDITION_NM,
                ORD_TT,
                ORD_TT_PRINT_CLS,
                ORD_TSO_HOURS,
                ORD_TSO_PRINT_CLS,
                ORD_TSI_HOURS,
                ORD_TSI_PRINT_CLS,
                ORD_TAKE_OFF_AIRF_NO,
                ORD_TAKE_OFF_SERIAL_NO,
                ORD_MEMO,
                ORD_DESIRED_DLV_DATE,
                ORD_DLV_DATE,
                ORD_USE_AIRF_NM,
                ATA_CD,
                ORD_MODEL_ATA,
                ORD_DEMAND_QTY,
                ORD_ORDER_QTY,
                ORD_ORDER_UNIT_COST,
                ORD_ORDER_FOREIGN_UNIT_COST,
                ORD_ORDER_AMT,
                ORD_ORDER_FOREIGN_AMT,
                ORD_ARRIVAL_DATE,
                ORD_ARRIVAL_FIXED_QTY,
                ORD_ARRIVAL_QTY,
                ORD_ARRIVAL_AMT,
                ORD_ARRIVAL_FOREIGN_AMT,
                ORD_ARRIVAL_RAIT,
                ORD_PARTITIAL_DLV_CNT,
                ORD_PAYMENT_DATE,
                ORD_PAYMENT_QTY,
                ORD_PAYMENT_YEN_AMT,
                ORD_PAYMENT_FOREIGN_AMT,
                ORD_PAYMENT_ACTUAL_DATE,
                ORD_DT_TREATMENT_CLS,
                ORD_ISSURANCE_CLS,
                ORD_FIX_CLS,
                ORD_ABSENCE_CLS,
                ORD_STS_CLS,
                ORD_DATA_ENTRY_DATE,
                ORD_DATA_ENTRY_TIME,
                ORD_DATA_DELETE_DATE,
                ORD_DATA_DELETE_TIME,
                ORD_REFERENCE_KEY,
                ORD_WORK_CLS_NM,
                ORD_OANO,
                ORD_VENDER_PARTS_NO,
                ORD_QUOTE_NO,
                ORD_WORK_APPROVAL_DATE,
                ORD_TURN_AROUND_TIME_SCHDL,
                ORD_DMRNO,
                ORD_UNREPAIRABLE_AMT,
                ORD_RPR_REMARKS,
                ORD_RESERVE_COMMENT,
                ORD_TROUBLE_COMMENT_CLS,
                ORD_DLV_INVOICE_NO,
                ORD_SEND_DATE,
                ORD_SEND_POINT_CLS,
                ORD_DLV_AWB_NO,
                ORD_INPUT_FILE_NO,
                DOCUMENT_CD,
                ORD_ESTM_FIXED_AMT,
                ORD_ESTM_YEN_AMT,
                ORD_FACTORY_SHIPMENT_DATE,
                ORD_ARRIVAL_INVOICE_NO,
                ORD_RETURN_SITE_CLS,
                ORD_ARRIVAL_AWB_NO,
                ORD_ENTRY_FILE_NO,
                ORD_RPR_ARRIVAL_REMARKS,
                BAT_UPD_DATETIME,
                BAT_UPD_USER_CD,
                INS_FUNCTION_ID,
                INS_USER_CD,
                INS_DATETIME,
                UPD_FUNCTION_ID,
                UPD_USER_CD,
                UPD_DATETIME
                ) VALUES (
                EACHROW.ORD_ORDER_NO_1,
                EACHROW.ORD_ORDER_NO_2,
                EACHROW.ORD_ORDER_NO_3,
                EACHROW.ORD_ITEM_NO,
                EACHROW.ORD_DATA_CLS,
                EACHROW.AA_JANO,
                EACHROW.ORD_JANO_REG_CLS,
                EACHROW.ORD_DEMAND_ITEM_NO,
                EACHROW.ORD_ORDER_PARTS_NO,
                EACHROW.ORD_ARRIVAL_PARTS_NO,
                EACHROW.ORD_ORDER_PARTS_NM,
                EACHROW.ORD_ARRIVAL_PARTS_NM,
                EACHROW.ORD_ORDER_SERIAL_NO,
                EACHROW.ORD_ARRIVAL_SERIAL_NO,
                EACHROW.ORD_TAG1,
                EACHROW.ORD_TAG2,
                EACHROW.ORD_WORK_CLS,
                EACHROW.ORD_TROUBLE_FIND_CD,
                EACHROW.ORD_TROUBLE_FIND_NM,
                EACHROW.ORD_TROUBLE_CONDITION_CD,
                EACHROW.ORD_TROUBLE_CONDITION_NM,
                EACHROW.ORD_TT,
                EACHROW.ORD_TT_PRINT_CLS,
                EACHROW.ORD_TSO_HOURS,
                EACHROW.ORD_TSO_PRINT_CLS,
                EACHROW.ORD_TSI_HOURS,
                EACHROW.ORD_TSI_PRINT_CLS,
                EACHROW.ORD_TAKE_OFF_AIRF_NO,
                EACHROW.ORD_TAKE_OFF_SERIAL_NO,
                EACHROW.ORD_MEMO,
                EACHROW.ORD_DESIRED_DLV_DATE,
                EACHROW.ORD_DLV_DATE,
                EACHROW.ORD_USE_AIRF_NM,
                EACHROW.ATA_CD,
                EACHROW.ORD_MODEL_ATA,
                EACHROW.ORD_DEMAND_QTY,
                EACHROW.ORD_ORDER_QTY,
                EACHROW.ORD_ORDER_UNIT_COST,
                EACHROW.ORD_ORDER_FOREIGN_UNIT_COST,
                EACHROW.ORD_ORDER_AMT,
                EACHROW.ORD_ORDER_FOREIGN_AMT,
                EACHROW.ORD_ARRIVAL_DATE,
                EACHROW.ORD_ARRIVAL_FIXED_QTY,
                EACHROW.ORD_ARRIVAL_QTY,
                EACHROW.ORD_ARRIVAL_AMT,
                EACHROW.ORD_ARRIVAL_FOREIGN_AMT,
                EACHROW.ORD_ARRIVAL_RAIT,
                EACHROW.ORD_PARTITIAL_DLV_CNT,
                EACHROW.ORD_PAYMENT_DATE,
                EACHROW.ORD_PAYMENT_QTY,
                EACHROW.ORD_PAYMENT_YEN_AMT,
                EACHROW.ORD_PAYMENT_FOREIGN_AMT,
                EACHROW.ORD_PAYMENT_ACTUAL_DATE,
                EACHROW.ORD_DT_TREATMENT_CLS,
                EACHROW.ORD_ISSURANCE_CLS,
                EACHROW.ORD_FIX_CLS,
                EACHROW.ORD_ABSENCE_CLS,
                EACHROW.ORD_STS_CLS,
                EACHROW.ORD_DATA_ENTRY_DATE,
                EACHROW.ORD_DATA_ENTRY_TIME,
                EACHROW.ORD_DATA_DELETE_DATE,
                EACHROW.ORD_DATA_DELETE_TIME,
                EACHROW.ORD_REFERENCE_KEY,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                EACHROW.ORD_ORDER_FOREIGN_AMT,
                T_ORD_ESTM_YEN_AMT_2,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                SYSDATE,
                EACHROW.UPD_USER_CD,
                EACHROW.INS_FUNCTION_ID,
                EACHROW.INS_USER_CD,
                SYSDATE,
                EACHROW.UPD_FUNCTION_ID,
                EACHROW.UPD_USER_CD,
                SYSDATE
                );
            END IF;
        END LOOP;

        FOR EACHROW IN CUR4 LOOP
            SELECT
            COUNT(*) INTO ICOUNT
            FROM NAIS_I_REPAIR_ORDER_DT
            WHERE
            ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
            AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
            AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3
            AND ORD_ITEM_NO = EACHROW.ORD_ITEM_NO;

            /*
              注文品注文番号1~3,注文品項目番号が

              修理品注文明細にのみ存在する場合は、

              修理品注文明細のデータを削除する。

            */
            IF ICOUNT < 1 THEN
                /* 修理品注文明細のデータを削除する */
                DELETE FROM NAIS_T_REPAIR_ORDER_DT
                WHERE
                ORD_ORDER_NO_1 = EACHROW.ORD_ORDER_NO_1
                AND ORD_ORDER_NO_2 = EACHROW.ORD_ORDER_NO_2
                AND ORD_ORDER_NO_3 = EACHROW.ORD_ORDER_NO_3
                AND ORD_ITEM_NO = EACHROW.ORD_ITEM_NO;
            END IF;
        END LOOP;
    END;

    /* 正常終了 */
    RETURN(0);

    EXCEPTION
        WHEN NO_DATA_FOUND
        THEN
            RETURN( -1403 );
        WHEN OTHERS
        THEN
            DECLARE
            err_code NUMBER:= SQLCODE;
            err_msg VARCHAR2(300) := SQLERRM;
            BEGIN
                RETURN( err_code );
            END;
    END;
END;
/

编程技术22 Aug 2005 09:09 am

Rational rose 2003 下载和安装步骤见以下文档

http://mse.ecs.fullerton.edu/docs/how2install-Eval-Rational%20Rose.doc

Rational rose 2003下载地址:

http://www-128.ibm.com/developerworks/views/subscription/enterprise.jsp

编程技术22 Aug 2005 09:05 am

提起建模,每一位软件开发人员都不会陌生,但我们还是要给它一个明确的定义:建模是人类对客观世界和抽象事物之间联系的具体描述.在过去的软件开发中,程序员利用手工建模,既耗费了大量的时间和精力又无法对整个复杂系统全面准确的描述,以至于直接影响应用系统的开发质量和速度.而今,我们不再为建模苦恼.

Rational公司曾以Ada语言享誉世界,今天以面向对象的可视化建模工具Rational ROSE博得了业界一片好评.正如美国《应用程序开发战略》Yourdou教授所评价的:“Rational Rose 将对面向对象应用程序开发技术产生巨大影响;使大型开发项目的分析,建模、设计规范化了,——rational公司已成为OO CASE界的Microsoft。”

Rational ROSE包括了一体化建模语言(UML),OOSE及OMT。其中一体化建模语言(UML)由Rational 公司三位世界级面向对象技术专家Grady Booch,Ivar Jacobson和Jim Rumbaugh通过对早期面向对象研究的设计方法的进一步扩展而得来的,为可视化建模软件奠定了坚实的理论基础。

<  —-

今天,Rational Rose 作为Rational公司的又一个旗舰产品,由太平洋软件(中国)有限公司和美国Rational Software公司连手引入中国,通过共同建立的Rational(中国)有限公司向中国广大用户推荐,我们希望它能为提高中国计算机应用水平作出应有的贡献!—-  >

1。可视化:设计的关键所在

计算机技术的飞速发展创造了人类历史上新的奇迹,但是,随着现代软件工程的复杂程度不断提高,项目失败的可能性也相应的境加了。信息系统的专家们发现当他们面对越来越多的源代码的时候,脑海中系统模型及其内部的联系也越发混沌和模糊了。面对现代社会庞大而繁杂的信息事务,专家们渴望使信息变得简单易懂。

无论何种复杂程度的工程项目,设计者都是从建模开始的,设计者通过创建模型和设计蓝图来描述系统的结构。比如说,电子工程设计人员使用惯用标记和示意图进行复杂的系统的最初设计,会计总是在表格上规划公司的财务蓝图,而行政管理人员则常使用组织流图这种可视化的方式来描述所管理的部门。

正是因为感到无法对整个复杂的系统全面地把握,所以我需要建模。人对复杂性的认识是有局限性的,对程序员来说,仅仅几行源代码是不能对整个开发项目提供一个全面认识的,而模型则可以使设计者从全局上把握系统及其内部的联系,而不至于陷入每个模块的细节之中。

建模的意义重大,“分而治之”,这是一个古老而有效的概念。可以想象,当我们把特别复杂而困难的问题细化分解之后,一次只是设法解决其中一个的时候,事情就容易解决多了。模型的作用就是便复杂的信息关联简单易懂得,它使我们容易洞察复杂堆砌而成的原始数据背后的规律,并能有效地使我们将系统需求映射到软件结构上去。

1.1设计的三层结构

Rose支持三层结构方案。

客户机/服务器体系结构的广泛使用预示了系统复杂化的发展趋势,为了解决这一问题,与之相应的三层结构方案(three-tiered)越来越得到了广泛的应用。

传统的两层结构不是“胖客户机”就是“胖服务器”,胖客户机结构将事务处理原则在用户端处理,胖服务器则将之集成在数据库中,大量的数据流动为维护和编程带来了极大的困难,而且,其中包含的事务处理原则不能与其它应用共享。

三层结构方案是指由用户接口层、事务处理原则层和数据层的应用模型。与传统的两层结构相比,它有着更多的优点: 

对应用结构任意一层做出修改时,只对其它层产生极小的影响。 
固有的可塑性,三层既可共存于单机之中,也可根据需要相互分开。 
公用代码数据库使事务处理规则在系统中共享。 

1.2 新的挑战

新的解决方案也相应带来了新的挑战: 

开发者必须采用新的思维方式划分和实现应用系统。 
可重用的对象必须能被辩识和精炼。 
必须决定如何把对象分配给组件和组件在网络(包括Internet)上如何分布。 
应用程序必须不断地跟上业务需求的变化。 
开发团体必须紧密配合开发应用程序。 
基于组件的开发方式正在改变着应用项目的特性。 
随着应用系统的开发变得不断复杂,即便是小的应用系统也包括多个分系统和多种组件,如何处理好复杂性的问题是关系到是否能够正确建立系统的关键。

好的软件结构和流程能够帮助开发者正确地解决这一问题,一个完好的结构可使开发过程飒爽流畅,并方便地随着需求的变化而改变。

2.什么是建模?

建模是使你逐层深入解决问题的方法: 

确认应用系统的功能需求并为事务处理原则建模 
对抽象的对象映射需求,辩认和提供设计模版并创建惯用的模版 
分辨和设计对象或划分三层模型的服务 
对软件的组成部分映射成对象并设计组件在网络上如何分布 
以上工作写入白版文档,建模允许处理发生变化,通过建立抽象概念,设计者就可以有效地处理大型工程和复杂结构。建模建立起应用程序的客户和编程人员之间生动的联系。

3. 用Ratioal ROSE 实现建模

创建模型是帮助设计者实现任何复杂的工程项目的有力工具,在软件工程中,它能够把模型与实际应用紧密地联系起来。通过模型与代码之间的映射,可以直接为不同的程序开发环境生成系统结构的框架,通过建立模型和代码间的映射,可以确保代码改进时模型也随之更新了,而且通过模型与代码间自动连接,建模工具可以确保良好的设计实施。

3.1 何时需要建模

在应用开发的任何阶段进入建模工作都是有意义的,无可否认的是,在设计最初阶段,应将精力主要用于处理有关应用系统用途、为实现用途应采用何种编程环境,而不是考虑程序的细节,如在屏幕上的什么位置放置按钮等。

在项目开发的中期引入建模也是非常有意义的,Ratioal Rose既支持正向建模,同时也支持反向建模。Rose通过建立模型使开发人员把握程序开发的方向,准确完成需求分析中所要求的任务。

3.2 Rational ROSE的解决方案

Ratioal Rose产品为大型软件工程提供了可塑性和柔韧性极强的解决方案: 

强有力的浏览器,用于查看模型和查找可重用的组件 
可定制的目标库或编码指南的代码生成机制 
既支持目标语言中的标准类型又支持用户自定义的数据类型 
保证模型与代码之间转化的一致性 
通过OLE连接,Ratioal Rose图表可动态连接到Microsoft Word中 
能够与Rational Visual Test,SQA Suite和SoDA文档工具无缝集成,完成软件生命周期中的全部辅助软件工程工作 
强有力的正/反向建模工作 
缩短开发周期 
降低维护成本 

3.3 一体化建模语言

如果没有一个被普遍认可的国际标准,事情就会陷入混乱之中。Rational Rose提供对工业标准标记的独家支持,其中包括一体化建模(UML),这一即将在工业界成为标准的面向对象建模语言。一体化建模语言(UML)是早期面向对象研究和设计方法的进一步扩展,由世界级面向对象技术知名专家Grady Booch,Ivar Jacobson和Jim Rumbaugh对Booch,OOSE和OMT理论的研究基础上提出的,为可视化建模软件奠定了坚实的理论基础。一体化建模语言对建模语言提供了以下支持 

使用事件模型 
类和对象模型 
组件模型 
分布处理模型 
Rational Rose产品在支持UML的同时,也支持OOSE及OMT。

3.4 Rationa Rose 对大型复杂项目的支持

Rational Rose支持绝大多数软件工程常见的个人/公共工作平台。直到所编制软件共享之前,软件工程师都可以在个人工作平台修改自己的源代码和已建立的模型。

在公共平台,通过在配置管理和版本控制系统(CMVC),模型改变可以共享,换句话说,其他开发可以观察和利用这些改变。

Rational ROSE能够与主要的CMVC工具集成。

Rational Rose也可支持企业级数据库。

4. Rational Rose系列产品

Rational Rose可视化开发工具与多种开发环境无缝集成,目前所支持的开发语言包括:Visual Basic,Java,PowerBuilder,C++,Ada,Smalltalk,Fort等。

Rational Rose的所有产品支持关系型数据库逻辑模型的生成,包括:Oracle 7,Sybase,SQL Server,Watcom SQL和ANSI SQL,其结果可用于数据库建模工具生成逻辑模型和概念模型,如:LogicWorks Erwin 和Powersoft和S-Designor。

Rational Rose系列产品可以支持: 

工业级的功用分析 
存储库和个人工作平台 
CORBA-2/IDL的正向工程 
用户自由选择Booch 93,OMT和UML标记 
扩充的接口允许Rational Rose既充当OLE服务器又充当OLE控制器 
ROSE脚本是一种与VBA兼容的脚本语言并且兼容Rose API,允许你创建GUI,功能单元和全定制的报告以及控制其他应用。 
支持的平台 
Windows 9X,NT ,Alpha NT, SGI,Solaris,AIX,Digital UNIX和HP-UX