Re: Sorting integer field
Posted in 1993
In <1lue5nINN9mh@emory.mathcs.emory.edu> alan@effluvia.den.mmc.com (Alan Popiel) writes: >->Date: Wed, 17 Feb 93 15:25:07 EST >->From: RUCHI@CFRVM.CFR.USF.EDU >->To: informix-list@rmy.emory.edu >->Subject: Sorting integer field >->Sender: informix-list-owner@rmy.emory.edu >-> >->I have an integer field that I like to sort using the LAST 2 NUMBERS on >->integer field. For example: [stuff deleted] >I know that the above works, since I have done similar things. I am not >aware of any way to do this in straight ISQL. ISQL does not provide an >int() or trunc() function. Unfortunately, NOT TRUE. Both TRUNC and ROUND functions are documented (and I'm fairly sure are therefore present) at both 4.10 and 5.00 releases of the database engines. > SELECT (intvar - intvar/100*100) FROM tbl ORDER BY 1 >does not work, since Informix evaluates the expression in floating point, >and it always evaluates to 0.00. IF we could do > SELECT (intvar - TRUNC(intvar/100)*100) FROM tbl ORDER BY 1 >then it would work. I believe the latter does work, but I suppose it is possible that the isql front end screws up, I can't check as I don't have it installed. It is a common Informix habit to put new features (and keywords) into a previous release without documenting them. It seems extremely likely that TRUNC and ROUND were implemented at the same time as the third conversion function: HEX. And if my memory serves me correctly, HEX was present but undocumented in (at least the later ports of) 4.00. Extra disclaimer: It's a _LONG_ time since I used 4.00, my memory could be faulty.