Most portable method is to use $sth->{TYPE}

"Returns a reference to an array of integer values for each column. The
value indicates the data type of the corresponding column."

You would need to 'select * from table_name where 1=0' to get an open
statement handle first.

See perldoc DBI for more info.

There is a new meta-data method in the wings but I don't know how soon
all DBD's will support this:

$sth = $dbh->column_info( $catalog, $schema, $table, $column );

--
  Simon Oliver

"Example user SuSE Linux 6.2" wrote:
> 
> Is it possible to use DBI to get the type of a field in a table?
> If so, how?
> 
> The point is that I want to have a portable script along mysql and
> Oracle and
>  these may have different datatypes. So it might be best to query the
> database
>  what datatype fieldx is, then use it to say create an auxilliary table
> 
> Thanks,
> S.Alexiou

Reply via email to