외부 파일을 읽은 후에 BEMDM2라는 테이블에 읽은 내용을
insert 시키는 건데여...
자꾸 'missing right quote'라는 에러메시지가 뜨네여...
무엇이 문제인지 고수님들의 자세한 답변 부탁드립니다.
소스는 아래와 같습니다.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, Grids, DBGrids, Db, DBTables;
type
TForm1 = class(TForm)
Query1: TQuery;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
BitBtn1: TBitBtn;
Database1: TDatabase;
BitBtn2: TBitBtn;
Query2: TQuery;
procedure BitBtn1Click(Sender: TObject);
procedure insert;
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
CNT: Integer;
FILE_NAME: String;
MYFILE: TextFile;
BUF: String;
C1 : String; //mst_key
C2 : String; //우편번호1
C3 : String; //우편번호2
C4 : String; //오류
C5 : String; //주소1
C6 : String; //주소2
imsi: String;
i: Integer;
{$R *.DFM}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
FILE_NAME:='d:xyz1.tot';
AssignFile(MYFILE,FILE_NAME);
try
Reset(MYFILE);
cnt:=0;
repeat
Readln(MYFILE,BUF);
inc(cnt);
until
Eof(MYFILE);
CloseFile(MYFILE);
Reset(MYFILE);
Readln(MYFILE,BUF);
cnt:=0;
OLD:='';
repeat
Readln(MYFILE,BUF);
inc(cnt);
i:=0;
imsi:='';
repeat if BUF[i]<>Chr(9) then C1:=C1+BUF[i] else begin break; end; inc(i); until BUF[i]=Chr(9);inc(i);C1:=Trim(C1);
repeat if BUF[i]<>Chr(9) then C2:=C2+BUF[i] else begin break; end; inc(i); until BUF[i]=Chr(9);inc(i);C2:=Trim(C2);
repeat if BUF[i]<>Chr(9) then C3:=C3+BUF[i] else begin break; end; inc(i); until BUF[i]=Chr(9);inc(i);C3:=Trim(C3);
repeat if BUF[i]<>Chr(9) then C4:=C4+BUF[i] else begin break; end; inc(i); until BUF[i]=Chr(9);inc(i);C4:=Trim(C4);
repeat if BUF[i]<>Chr(9) then C5:=C5+BUF[i] else begin break; end; inc(i); until BUF[i]=Chr(9);inc(i);C5:=Trim(C5);
repeat if BUF[i]<>Chr(9) then C6:=C6+BUF[i] else begin break; end; inc(i); until BUF[i]=Chr(0);inc(i);C6:=Trim(C6);
until
Eof(MYFILE);
CloseFile(MYFILE);
insert;
except
Application.MessageBox('변환자료에 오류가 존재합니다','변환자료오류',mb_OK);
end;
end;
procedure TForm1.insert;
begin
if Query2.Active then Query2.Close;
Query2.SQL.Clear;
Query2.SQL.Add('begin tran');
Query2.SQL.Add('insert bemdm2');
Query2.SQL.Add('(mst_key)');
Query2.SQL.Add('values');
Query2.SQL.Add('(');
Query2.SQL.Add(''''+c1+'''');
Query2.SQL.Add(')');
Query2.SQL.Add('commit tran');
Query2.ExecSQL;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Close;
end;
end.
Query2.SQL.Add('insert bemdm2');
INSERT INTO Table_Name
(....)
VALUES
(.....)
이렇게 알고 있는데.... ORACLE에서는....
.
.
.
.
.
.