如何根据字段的名称查到字段的类型?谢谢!

解决方案 »

  1.   

    orale
    select columns_type from user_tab_columns where table_name='table1' and colunm_name='field1';
    具体你看
    desc user_tab_columns 的表结构吧
      

  2.   

    RDBMS都有系统表,你可以到系统表中查,如MSSQL的系统表是sysobjects如果你要的不是太准确的话,可以这样query1.close;
    query1.sql.text := 'select * from table1 where 0>1';
    query1.open;
    if query1.fields[0].DataType = ftString then
    begin
      Showmessage(query1.fields[0].fieldname +'的数据类型是string,长度是' + 
       inttostr(query1.fields[0].DataSize) ; 
    end;