Am looking for a way to get the maximum value of an integer data type in a function. Since FB doesn't have an unsigned type, casting from -1 doesn't work. Nor can I find any built-in constant or function to get it. Any other ideas? (Am not looking to hardcode any value.)

Member Avatar for diafol

Not sure if I quite follow p,

I got this info:

INTEGER is a signed 32-bit integer (range –/+ 2,147,483,648)

From http://www.janus-software.com/fbmanual/manual.php?book=psql&topic=29

So I'm assuming you're looking for a function to return that (or whatever any new value in newer versions would be)?

Would range of integer change though?

So I'm assuming you're looking for a function to return that (or whatever any new value in newer versions would be)?

Correct.

Would range of integer change though?

No, but I'd like it to work on the different data types (int, smallint, decimal etc.), so that my query keeps working even if the data type is changed.

Member Avatar for diafol

OK, that makes sense. I had a quick scan and couldn't find one either. So something like an int.MAX type thingy - no - failed :(

I'm assuming it's to prevent an error in queries by validating input against field datatypes?

I'm assuming it's to prevent an error in queries by validating input against field datatypes?

In my case to help order results, null being the highest available number.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.