Re: how to get datatype of columns of a table in perl script



Quoting Vamsi_Doddapaneni <Vamsi_Doddapaneni@xxxxxxxxxx>:

> I am new to perl just (1 1/2 month experience.). I am developing perl script
> which connects to oracle database and selects rows from a (x) table and then
> inserts them into its corresponding table in db2. So, while inserting i need
> to find what is the datatype of columns , since we need to use quotes for
> varchar,date etc.....

You don't need to worry about number or varchar types if you use placeholders.
Both DBD::Oracle and DBD::DB2 support them. Dates will need some special
handling to convert the strings you get from Oracle (use TO_CHAR() to make sure
you get what you want), but even with them placeholders will minimize problems.

http://search.cpan.org/~timb/DBI/DBI.pm

The CPAN site is the first place to look for modules and the search site makes
it easy to find them and their documentation.

You may want to get some books as well. Nearly anything from O'Reilly is worth
the cost: http://www.oreilly.com/ . I particularly recommend the following
titles.

Programming Perl, 3rd Edition
Programming the Perl DBI: Database programming with Perl

Once you've gotten further, these titles may be useful too.

Perl Cookbook, 2nd Edition
Advanced Perl Programming

--
Mac :})
.



Relevant Pages