Re: Convert Long to Date

From: Tim Gorman <>
Date: Thu, 26 Jun 2008 14:15:46 -0600
Message-ID: <>



This is embedded deep within a couple thousand lines of PL/SQL package code posted on the internet.  The package is named EXCHPART, the procedure is called ADD_NEWER_THAN, and its URL is  Here it is excerpted into pseudo-PL/SQL...
procedure add_newer_than ...
    v_errcontext      varchar2(500);
    v_high_value      varchar2(100);
    v_day             date;
    type cType        is ref cursor;
    c                 cType;
    cursor get_partition_info ...
    select            ...,
    from              all_tab_partitions
for p in get_partition_info ... loop
    v_high_value := substr(p.high_value, 1, p.high_value_length);
    v_errcontext := 'select ' || v_high_value || ' from dual';
    open c for v_errcontext;
    fetch c into v_day;
    close c;
end loop;
So the end result is that the variable "v_day" has the value from HIGH_VALUE...

Hope this helps...
Tim Gorman
consultant - Evergreen Database Technologies, Inc.
P.O. Box 1802, Evergreen CO  80437-1802
website   =
email     =
mobile    = +1-303-885-4526
fax       = +1-303-484-3608
Yahoo IM  = tim_evdbt

Brady, Mark wrote:
Convert Long to Date

Oracle stores the High Value of a Partition in a Long column. I swear Ive searched the friendly web, and I just cant figure out how to get this long column converted back to a date or char I can take a char to a date.

If it exists on the web, please tell me. I dont know why this is so hard to find.

>>> This e-mail and any attachments are confidential, may contain legal,
professional or other privileged information, and are intended solely for the
addressee.  If you are not the intended recipient, do not use the information
in this e-mail in any way, delete this e-mail and notify the sender. CEG-IP2
-- Received on Thu Jun 26 2008 - 15:15:46 CDT

Original text of this message