Q&A

  • 무슨 문제인지를 알 수가 없군요...
VQuery := TQuery.Create(Nil);
    VQuery.DatabaseName := Form1.DB_NAME;
    with vQuery do begin try
        Close;
        SQL.Clear;

                   SQL.Add(' SELECT MIN(ZONE_CD||RACK_CD||SELF_CD||COLUMN_CD)                      TO_LOCATION                        ');
                SQL.Add('   FROM C0103M                                                                                            ');
                SQL.Add('  WHERE ZONE_CD||RACK_CD||SELF_CD = :ToLocation                                                           ');
                SQL.Add('    AND ZONE_CD||RACK_CD||SELF_CD||COLUMN_CD > ( SELECT MAX(X.ZONE_CD||X.RACK_CD||X.SELF_CD||X.COLUMN_CD) ');
                SQL.Add('                                                                                                             FROM U5M010 X                                          ');
                SQL.Add('                                                                                        WHERE X.ZONE_CD||X.RACK_CD||X.SELF_CD = :ToLocation )   ');

        ParambyName('ToLocation').AsString := ToLocation;

        Open;
        if Eof then begin //Not Found
            Close;
            VQuery.Free;
            MsgStr := '미등록 로케이션';
            result := (#2 + Form1.NG + format('%-45s', [MsgStr]) + #3);
            exit;
        end;

        ToLocation := FieldByName('TO_LOCATION').AsString;

//입고라벨테이블 업데이트
        try
        Close;
        SQL.Clear;
                SQL.Add(' UPDATE S60210T                   ');
                SQL.Add('          SET ZONE_CD   = :ToZoneCd        ,  ');
                SQL.Add('        RACK_CD   = :ToRackCd        ,  ');
                SQL.Add('        SELF_CD   = :ToSelfCd  ,  ');
                SQL.Add('        COLUMN_CD = :ToColumnCd,  ');
                SQL.Add('        UPT_TIME  = SYSDATE    ,  ');
                SQL.Add('        UPT_ID    = :UID          ');
                SQL.Add('  WHERE CENTER_CD = :CenterCd     ');
                SQL.Add('    AND ITEM_CD   = :ItemCd       ');
                SQL.Add('    AND ZONE_CD   = :FromZoneCd   ');
                SQL.Add('    AND RACK_CD   = :FromRackCd   ');
                SQL.Add('    AND SELF_CD   = :FromSelfCd   ');
                SQL.Add('    AND COLUMN_CD = :FromColumnCd ');
        
        {*********************************************************
          아래부분에서 파라매터가 없다고 나옵니다.
          'Parameter ToZoneCd not Found'
          라고 나옵니다.
          이유를 알 수 가 없습니다. 이거 혹시 버그가 안닌가 십군요.
          오라클 8i를 사용합니다.
         ***********************************************************}
        

        ParambyName('ToZoneCd'  ).AsString := Copy(ToLocation, 1, 2);
//      ParambyName('ToZoneCd'  ).AsString := 'CA';
        ParambyName('ToRackCd'  ).AsString := Copy(ToLocation, 3, 2);
        ParambyName('ToSelfCd'  ).AsString := Copy(ToLocation, 5, 1);
        ParambyName('ToColumnCd').AsString := Copy(ToLocation, 6, 2);
        ParambyName('UID'       ).AsString := UID;
        ParambyName('CenterCd'  ).AsString := CenterCd;
        ParambyName('ItemCd'    ).AsString := ItemCd;
        ParambyName('FromZoneCd'  ).AsString := Copy(FromLocation, 1, 2);
        ParambyName('FromRackCd'  ).AsString := Copy(FromLocation, 3, 2);
        ParambyName('FromSelfCd'  ).AsString := Copy(FromLocation, 5, 1);
        ParambyName('FromColumnCd').AsString := Copy(FromLocation, 6, 2);

        StartTransaction;
        if Not ExecQry(vQuery, '142') then begin
            MsgStr := '저장실패.';
            result := (#2 + Form1.NG + format('%-45s', [MsgStr]) + #3);
            exit;
        end;

        except
            if DM1.database1.InTransaction then begin
                dm1.Database1.Rollback;
            end;
            close;
            free;
            MsgStr := 'DB 에러[저장:입고라벨]';
            result := (#2 + Form1.NG + format('%-45s', [MsgStr]) + #3);
            exit;
        end;
-------------------------------------------------------------
ParambyName('ToZoneCd'  ).AsString := Copy(ToLocation, 1, 2);
2  COMMENTS
  • Profile
    김경록 2002.05.15 18:45
    일단은 문제가 없을듯 싶군여..
    근데..
    Try
         Try

         Except

         End;
    Except

    End;

    구문을 사용하셨군여..
    같은 Query가 다른 Try절안에 들어있는게 약간 의심스럽긴 하지만..
    그것보다도..
    먼저..
    Query.SQL.Text를 보셔서..
    정확한 질의 내용이 들어 있는지 확인후에..
    Params에 등록된 Param리스트를 확인해 보시는게 좋을듯 하네여..
    param확인 방법은..

    for ll_cnt := 0 To query.params.Count - 1 Do
        showmessage(query.params.Items[ll_cnt]);





  • Profile
    성낙균 2002.05.15 06:28
       SQL.Add('        UPT_TIME  = SYSDATE    ,  ');
    이라인에  ': ' 빠졌네요...