Propably not exactly what you are after, but this has helped me a lot:

        =====================================
        select
                *
        from 
                all_tab_columns 
        where
                OWNER='PUT_YOUR_DBASE_NAME_HERE'
        and
                TABLE_NAME='PUT_YOUR_TABLE_NAME_HERE'
        order by 
                column_id
        =====================================

or the most intersting part to me:

        =====================================
        select
                TABLE_NAME, 
                COLUMN_ID, 
                COLUMN_NAME, 
                DATA_TYPE,
                DATA_LENGTH, 
                NULLABLE 
        from
                all_tab_columns 
        where
                ...
        =====================================

(to look like DESCRIBE in mySQL ;) The Date fields in the tables I'm looking
seem to arrive as VARCHAR2 (seemingly in 'YYYY-MM-DD'-format), yet I trust
them actually to be DATE -- reason for this missmatch is not clear but
propably I use wrong version of Oracle Client Library or being in different
country than the actual database (I refuse to / cannot change the enviroment
settings of the client) or whatnot. Hence I must convert the date fields
into strings and then to date to enable date calculations:

        ====================================================
        select
                (
                        TO_DATE(TO_CHAR(date_1), 'YYYY-MM-DD') -
                        TO_DATE(TO_CHAR(date_2), 'YYYY-MM-DD')
                ) "date_diff",
                ...
        =====================================================

Pekka Siiskonen

> -----Original Message-----
> From: fachinet [mailto:[EMAIL PROTECTED]]
> Sent: 21. marraskuuta 2001 5:41
> To: dbi-users
> Subject: How to retrieve NLS_DATE_FORMAT
> 
> 
> Hello dbi users,
> I'm using dbi to connect to an Oracle 8i database.
> 
> I'm trying to retrieve the size of a date datatype column for a table.
> 
> First I tried with $query->{TYPE}, and $query->{PRECISION} functions
> but I got weird result (75 for the precision ???).
> 
> So, I am now trying to get the current NLS_DATE_FORMAT value.
> I know how to set it ('ALTER SESSION SET NLS_DATE_FORMAT = 
> '$nls_date_format')
> but is there any way to retrieve it directly ?
> 
> Thanks in advance for your help.
> 
> Frederic Fachinetti
> [EMAIL PROTECTED]
> 
> 
> 
> **********************************************************************
> O.S.B
> Oceanienne de Services Bancaires
> 
> BP 9178 Motu Uta
> 98715 Papeete
> Tahiti   -   Polynesie Francaise
> 
> Site : http://www.osb.pf
> Tel : (689) 54 08 00
> Fax : (689) 41 34 08
> **********************************************************************
> Ce message et toutes les pieces jointes (ci-apres le "message") sont
> etablis a l'intention exclusive de ses destinataires et sont 
> confidentiels.
> Si vous recevez ce message par erreur, merci de le detruire et d'en 
> avertir immediatement l'expediteur.
> Toute utilisation de ce message non conforme a sa destination,
> toute diffusion ou toute publication, totale ou partielle, 
> est interdite, 
> sauf autorisation expresse.  
> L'Internet ne permettant pas d'assurer l'integrite de ce message, 
> l'OSB decline toute responsabilite au titre de ce message, dans 
> l'hypothese ou il aurait ete modifie ou infeste par un virus.
> 

Reply via email to