Thursday 10 December 2009

back to basics – string comparison

so, here are some questions…

is string “ XXXX” > “*    “ ?  NO, “*    “ is bigger

is string “ XXXX” > “*****” ? NO, “*****” is bigger

simple test in oracle is:

select 1 from dual where ' XXXX' > '*    '

if you see 1, it’s true.  If you see “no rows selected”, it’s false.

* has a ascii value of 42

<space> has a value of 32

a has a value of 97

You can tell the ascii value with ‘SELECT ASCII(‘*’) from DUAL ;  (note that those funny quotes will not work).

All of the above will help you with row security.

No comments: