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



At 7:38 PM +0530 4/14/05, Vamsi_Doddapaneni wrote:
Hi all
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.....
Could anybody help me out to find an approach .
Thanks in advance
Regards
Vamsi

A simple generic solution is to just quote all literal values, regardless of the data type. Any database should be able to handle this regardless of the data type.


As for finding out data types, you should be able to use Oracle's support of the INFORMATION_SCHEMA feature to look it up. Eg, look for special built-in views whose names I think are 'USER_TABLES'/'ALL_TABLES', 'USER_TAB_COLS', etc, as these describe all the normal tables. A great introspection feature.

-- Darren Duncan
.



Relevant Pages

  • date_format
    ... I have some data in an oracle database which has a data type of DATE and the ... work with an Oracle thin client. ... there a standard date setting you can change so everything outputs with the ...
    (alt.php)
  • Re: how to get datatype of columns of a table in perl script
    ... >>which connects to oracle database and selects rows from a table and then ... > A simple generic solution is to just quote all literal values, ... > this regardless of the data type. ...
    (perl.dbi.users)
  • MS Access to Oracle via ODBC
    ... All is fine until I access a particular field whose data type is described in the linked Oracle table as Memo. ... My query includes other Memo fields but they are extracted correctly. ... When the problem memo field is queried I get an error message: ... Any idea if there is a problem with the data or is it my means of accessing the Oracle Database? ...
    (microsoft.public.data.odbc)
  • RE: Errors while inserting into long data type
    ... > Hi Friends, ... > I am using oracle database and I have column of long data type. ... Ronald ...
    (perl.dbi.users)
  • Acess & Oracle Unicode Problem
    ... All is fine until I access a particular field whose data type is described in the linked Oracle table as Memo. ... My query includes other Memo fields but they are extracted correctly. ... When the problem memo field is queried I get an error message: ... Any idea if there is a problem with the data or is it my means of accessing the Oracle Database? ...
    (microsoft.public.access.externaldata)