DECLARE
TYPE TY_QUECUR IS REF CURSOR;
CUR_COLUMNS TY_QUECUR;
SQLCMD VARCHAR(500);
TABNAME VARCHAR(20);
COLNAME VARCHAR(50);
COLTYPE VARCHAR(20);
COLCOMMENT VARCHAR2(50);
COLLENGTH INTEGER;
COLPRECISION INTEGER;
I INTEGER;
COLLIST VARCHAR(1000);
VCOLLIST VARCHAR(1000);
DelphiDS VARCHAR2(20);
TMP1 VARCHAR2(1000);
TMP2 VARCHAR2(1000);
BEGIN
DBMS_OUTPUT.ENABLE(200000);
TABNAME:= 'DIC_STATION';
DelphiDS:= '__DS';
I:= 0;
COLLIST:= '';
VCOLLIST:= '';
SQLCMD:= 'SELECT A.COLUMN_NAME, A.DATA_TYPE,B.COMMENTS,A.DATA_LENGTH,A.DATA_PRECISION '
||'FROM USER_TAB_COLUMNS A LEFT JOIN USER_COL_COMMENTS B '
||'ON A.COLUMN_NAME=B.COLUMN_NAME AND A.TABLE_NAME=B.TABLE_NAME WHERE A.TABLE_NAME= '''|| TABNAME || '''';
DBMS_OUTPUT.PUT_LINE('//==============================================================');
DBMS_OUTPUT.PUT_LINE('//生成Delphi对象');
DBMS_OUTPUT.PUT_LINE('//==============================================================');
DBMS_OUTPUT.PUT_LINE('unit u'|| INITCAP(TABNAME)||';');
DBMS_OUTPUT.PUT_LINE('interface');
DBMS_OUTPUT.PUT_LINE('uses Windows, Messages, SysUtils, Variants, Classes, DB, DBClient;');
DBMS_OUTPUT.PUT_LINE('Type');
Dbms_Output.PUT_LINE(' TEditMode=(emAppend, emEdit, emDelete);');
DBMS_OUTPUT.PUT_LINE(' T'||TABNAME||'= Class');
DBMS_OUTPUT.PUT_LINE('private');
DBMS_OUTPUT.PUT_LINE(' fCdsDatas: TClientDataSet;');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
IF I = 0 THEN
COLLIST:= COLNAME;
ELSE
COLLIST:= COLLIST || ', '|| COLNAME;
END IF;
I:= I+ 1;
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||': Boolean;//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||': Integer;//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||': Currency;//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||': Double;//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||': string;//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||': TDateTime;//'||COLCOMMENT);
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' procedure Set'||INITCAP(COLNAME)||'(Value: Boolean);//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' procedure Set'||INITCAP(COLNAME)||'(Value: Integer);//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' procedure Set'||INITCAP(COLNAME)||'(Value: Currency);//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE(' procedure Set'||INITCAP(COLNAME)||'(Value: Double);//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' procedure Set'||INITCAP(COLNAME)||'(Value: string);//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' procedure Set'||INITCAP(COLNAME)||'(Value: TDateTime);//'||COLCOMMENT);
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.PUT_LINE(' public');
DBMS_OUTPUT.PUT_LINE(' property CdsDatas: TClientDataSet read fCdsDatas write fCdsDatas;');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' property '||INITCAP(COLNAME)||': Boolean read f'||INITCAP(COLNAME)||' write Set'||INITCAP(COLNAME)||';//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' property '||INITCAP(COLNAME)||': Integer read f'||INITCAP(COLNAME)||' write Set'||INITCAP(COLNAME)||';//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' property '||INITCAP(COLNAME)||': Currency read f'||INITCAP(COLNAME)||' write Set'||INITCAP(COLNAME)||';//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE(' property '||INITCAP(COLNAME)||': Double read f'||INITCAP(COLNAME)||' write Set'||INITCAP(COLNAME)||';//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' property '||INITCAP(COLNAME)||': string read f'||INITCAP(COLNAME)||' write Set'||INITCAP(COLNAME)||';//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' property '||INITCAP(COLNAME)||': TDateTime read f'||INITCAP(COLNAME)||' write Set'||INITCAP(COLNAME)||';//'||COLCOMMENT);
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.put_line(' procedure LoadDataFromDataBase;//加载数据集到ClintDataSet中');
DBMS_OUTPUT.PUT_LINE(' constructor Create(pCds: TClientDataSet);//构造函数');
DBMS_OUTPUT.PUT_LINE(' destructor Destroy; override;//析构函数');
DBMS_OUTPUT.PUT_LINE(' procedure LoadDataFromCdsData;//从数据集中加载当前行数据到类的成员中');
DBMS_OUTPUT.put_line(' procedure NextDataFromCdsData;//加载数据集下一行数据到类的成员中');
DBMS_OUTPUT.put_line(' procedure PriorDataFromCdsData;//加载数据集上一行数据到类的成员中');
DBMS_OUTPUT.PUT_LINE(' procedure SaveDataToCdsData(pEditMode: TEditMode);//将类数据保存到数据集中');
DBMS_OUTPUT.PUT_LINE(' class procedure GetDataFromForm(pFrm: TFrm'||INITCAP(TABNAME)||'; pObj: T'||INITCAP(TABNAME)||');');
DBMS_OUTPUT.PUT_LINE(' class procedure SetDataToForm(pFrm: TFrm'||INITCAP(TABNAME)||'; pObj: T'||INITCAP(TABNAME)||');');
DBMS_OUTPUT.PUT_LINE(' END;');
DBMS_OUTPUT.PUT_LINE('implementation');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.Set'||INITCAP(COLNAME)||'(Value: Boolean);//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.Set'||INITCAP(COLNAME)||'(Value: Integer);//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.Set'||INITCAP(COLNAME)||'(Value: Currency);//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.Set'||INITCAP(COLNAME)||'(Value: Double);//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.Set'||INITCAP(COLNAME)||'(Value: string);//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.Set'||INITCAP(COLNAME)||'(Value: TDateTime);//'||COLCOMMENT);
END CASE;
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' if f'||INITCAP(COLNAME)||'<> Value then');
DBMS_OUTPUT.PUT_LINE(' begin');
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= Value;');
DBMS_OUTPUT.PUT_LINE(' end;');
DBMS_OUTPUT.PUT_LINE('end;');
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.LoadDataFromDataBase;');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' //SELECT ');
TMP1:= COLLIST;
--instr(c1,[c2,<i>[,<j>]])
--c1,c2均为字符串,i,j为整数。函数返回c2在c1中第j次出现的位置,搜索从c1的第i个字符开始。
--当没有发现需要的字符时返回0,如果i为负数,那么搜索将从右到左进行,
--但是位置的计算还是从左到右,i和j的缺省值为1.
I:= INSTR(TMP1, ',', 1, 9);
IF I= 0 THEN
TMP2:= TMP1;
DBMS_OUTPUT.PUT_LINE(' //'||TMP2);
END IF;
WHILE I> 0
LOOP
TMP2:= SUBSTR(TMP1, 1, I- 1);
TMP1:= SUBSTR(TMP1, I, LENGTH(TMP1)- I);
DBMS_OUTPUT.PUT_LINE(' //'||TMP2);
I:= INSTR(TMP1, ',', 1, 9);
END LOOP;
DBMS_OUTPUT.PUT_LINE(' //FROM '||TABNAME||' WHERE 1=1');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('constructor T'||INITCAP(TABNAME)||'.Create(pCds: TClientDataSet);');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' fCdsDatas:= pCds;');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('destructor T'||INITCAP(TABNAME)||'.Destroy;');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' //析构函数');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.LoadDataFromCdsData;');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' if (not fCdsDatas.Active) or (fCdsDatas.RecordCount= 0) then');
DBMS_OUTPUT.PUT_LINE(' Raise Exception.Create(''数据集没有打开或没有数据!'');');
DBMS_OUTPUT.PUT_LINE(' with fCdsDatas do');
DBMS_OUTPUT.PUT_LINE(' begin');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= FieldByName('''||COLNAME||''').AsBoolean;');
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= FieldByName('''||COLNAME||''').AsInteger;');
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= FieldByName('''||COLNAME||''').AsCurrency;');
ELSE
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= FieldByName('''||COLNAME||''').AsFloat;');
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= FieldByName('''||COLNAME||''').AsString;');
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' f'||INITCAP(COLNAME)||':= FieldByName('''||COLNAME||''').AsDateTime;');
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.PUT_LINE(' end;');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.put_line('procedure T'||INITCAP(TABNAME)||'.NextDataFromCdsData;//加载数据集下一行数据到类的成员中');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' fCdsDatas.Next;');
DBMS_OUTPUT.PUT_LINE(' LoadDataFromCdsData;');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.put_line('procedure T'||INITCAP(TABNAME)||'.PriorDataFromCdsData;//加载数据集上一行数据到类的成员中');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' fCdsDatas.Prior;');
DBMS_OUTPUT.PUT_LINE(' LoadDataFromCdsData;');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('procedure T'||INITCAP(TABNAME)||'.SaveDataToCdsData(pEditMode: TEditMode);//将类数据保存到数据集中');
DBMS_OUTPUT.PUT_LINE('begin');
DBMS_OUTPUT.PUT_LINE(' with fCdsDatas do');
DBMS_OUTPUT.PUT_LINE(' begin');
DBMS_OUTPUT.PUT_LINE(' if pEditMode= emDelete then');
DBMS_OUTPUT.PUT_LINE(' Delete');
DBMS_OUTPUT.PUT_LINE(' else');
DBMS_OUTPUT.PUT_LINE(' begin');
DBMS_OUTPUT.PUT_LINE(' case pEditMode of');
DBMS_OUTPUT.PUT_LINE(' emAppend: Append;');
DBMS_OUTPUT.PUT_LINE(' emEdit: Edit;');
DBMS_OUTPUT.PUT_LINE(' end;');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' FieldByName('''||COLNAME||''').AsBoolean:= f'||INITCAP(COLNAME)||';//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' FieldByName('''||COLNAME||''').AsInteger:= f'||INITCAP(COLNAME)||';//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' FieldByName('''||COLNAME||''').AsCurrency:= f'||INITCAP(COLNAME)||';//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE(' FieldByName('''||COLNAME||''').AsFloat:= f'||INITCAP(COLNAME)||';//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' FieldByName('''||COLNAME||''').AsString:= f'||INITCAP(COLNAME)||';//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' FieldByName('''||COLNAME||''').AsDateTime:= f'||INITCAP(COLNAME)||';//'||COLCOMMENT);
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.PUT_LINE(' post;');
DBMS_OUTPUT.PUT_LINE(' end;');
DBMS_OUTPUT.PUT_LINE(' end;');
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('class procedure T'||INITCAP(TABNAME)||'.GetDataFromForm(pFrm: TFrm'||INITCAP(TABNAME)||'; pObj: T'||INITCAP(TABNAME)||');');
DBMS_OUTPUT.PUT_LINE('begin');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' pObj.'||COLNAME||':= pFrm.Chk'||INITCAP(COLNAME)||'.Checked;//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' pObj.'||COLNAME||':= StrToInt(pFrm.Edt'||INITCAP(COLNAME)||'.Text);//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' pObj.'||COLNAME||':= StrToCurr(pFrm.Edt'||INITCAP(COLNAME)||'.Text);//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE(' pObj.'||COLNAME||':= StrToFloat(pFrm.Edt'||INITCAP(COLNAME)||'.Text);//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' pObj.'||COLNAME||':= pFrm.Edt'||INITCAP(COLNAME)||'.Text;//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' pObj.'||COLNAME||':= pFrm.Dtp'||INITCAP(COLNAME)||'.DateTime;//'||COLCOMMENT);
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('class procedure T'||INITCAP(TABNAME)||'.SetDataToForm(pFrm: TFrm'||INITCAP(TABNAME)||'; pObj: T'||INITCAP(TABNAME)||');');
DBMS_OUTPUT.PUT_LINE('begin');
OPEN CUR_COLUMNS FOR SQLCMD;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
WHILE CUR_COLUMNS%FOUND LOOP
CASE WHEN COLTYPE = 'NUMBER' THEN
BEGIN
IF COLLENGTH= 1 AND COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' pFrm.Chk'||INITCAP(COLNAME)||'.Checked:= pObj.'||COLNAME||';//'||COLCOMMENT);
ELSIF COLPRECISION IS NULL OR COLPRECISION = 0 THEN
DBMS_OUTPUT.PUT_LINE(' pFrm.Edt'||INITCAP(COLNAME)||'.Text:= IntToStr(pObj.'||COLNAME||');//'||COLCOMMENT);
ELSIF COLPRECISION< 4 THEN
DBMS_OUTPUT.PUT_LINE(' pFrm.Edt'||INITCAP(COLNAME)||'.Text:= CurrToStr(pObj.'||COLNAME||');//'||COLCOMMENT);
ELSE
DBMS_OUTPUT.PUT_LINE(' pFrm.Edt'||INITCAP(COLNAME)||'.Text:= FloatToStr(pObj.'||COLNAME||');//'||COLCOMMENT);
END IF;
END;
WHEN COLTYPE IN ('VARCHAR', 'VARCHAR2', 'NVARCHAR', 'NVARCHAR2') THEN
DBMS_OUTPUT.PUT_LINE(' pFrm.Edt'||INITCAP(COLNAME)||'.Text:= pObj.'||COLNAME||';//'||COLCOMMENT);
WHEN COLTYPE IN ('TIME', 'DATE') THEN
DBMS_OUTPUT.PUT_LINE(' pFrm.Dtp'||INITCAP(COLNAME)||'.DateTime:= pObj.'||COLNAME||';//'||COLCOMMENT);
END CASE;
FETCH CUR_COLUMNS INTO COLNAME, COLTYPE, COLCOMMENT, COLLENGTH, COLPRECISION;
END LOOP;
DBMS_OUTPUT.PUT_LINE('end;');
DBMS_OUTPUT.PUT_LINE('end.');
CLOSE CUR_COLUMNS;
END;
用PLSQL自动生成数据库表的Delphi对象
最新推荐文章于 2021-01-28 14:11:33 发布