[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference orarep::nomahs::sql

Title:SQL notes
Moderator:NOVA::SMITHI
Created:Wed Aug 27 1986
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3895
Total number of notes:17726

3887.0. "Converting DATE to BIGINT?" by ITVMS1::FALLOGGI (Sport is better than politics) Thu May 08 1997 07:56

Hi,
there is a customer that has the same problem like in 3511, where there are two
db in witch in one there is the table with a date vms formatted field, and 
there is a second with a bigint field.
Every cast attempt to cast the date VMS to the bigint give me the result:
%RDB-F-CONVERR, error

Is there a method to convert it by use an SQL function?

Regards,
Francesco
T.RTitleUserPersonal
Name
DateLines
3887.1NOVA::SMITHIDon't understate or underestimate Rdb!Thu May 08 1997 12:0125
~there is a customer that has the same problem like in 3511

Sorry this is not the same problem.  That customer at least had compatible
data types.

~where there are two db in witch in one there is the table with a date vms
~formatted field, and  there is a second with a bigint field. Every cast
~attempt to cast the date VMS to the bigint give me the result: %RDB-F-CONVERR,
~error

Ok that is expected, Rdb doesn't know the formats are compatible, certainly
the types are not.

~Is there a method to convert it by use an SQL function?

yes.  write a simple external function.

create function BIGINT_TO_DATE_VMS (in bigint)
    returns date vms;
external ...etc...;

Now write a routine which accepts the passed BIGINT and returns it.
You can use this to coerce the type.

Ian
3887.2THANKITVMS1::FALLOGGISport is better than politicsThu May 08 1997 12:485
Hi Ian,
Thank You for Your suggests and very precious example!

Cheers,
Francesco