Scripts   Home

Informix SPL to return datetimes to Visual Basic

Here is some Informix SPL to return Informix datetime data type to VB format.

-- Example Informix SQL to create a stored procedure (SPL) to return 
-- datetimes to Visual Basic.
drop procedure timeconvert;
create procedure timeconvert()
returning smallint, smallint, smallint;

    define tmptime datetime hour to second;
    define vbhour smallint;
    define vbminute smallint;
    define vbsecond smallint;
    define timestring char(30);

    select current
    into tmptime
    from systables
    where tabname="systables";
    
    let timestring = extend( tmptime, hour to hour);
    let vbhour = timestring;
    let timestring = extend( tmptime, minute to minute);
    let vbminute = timestring;
    let timestring = extend( tmptime, second to second);
    let vbsecond = timestring;

return vbhour, vbminute, vbsecond;

end procedure;
execute procedure timeconvert ();
######################## cut here ######################