Page 1 of 1

scalar function usage

PostPosted: Thu Aug 12, 2010 10:33 am
by Anitha_S
is it possible to use scalar function in the where and order by clause?
If not which one will be the appropriate place to use the function?

eg: select acct-num
where (substr(location-code,6,1)=2)

Re: scalar function usage

PostPosted: Thu Aug 12, 2010 12:22 pm
by NicC
From DB2 Developers Guide by Craig S. Mullins...
Scalar functions can be executed in the select list of the SQL SELECT statement or as part of a WHERE or HAVING clause.

Re: scalar function usage

PostPosted: Fri Aug 13, 2010 2:33 pm
by Anitha_S
ya i verified using some query.
We can used it in the order by clause too.


for eg order by bigint(acct_num)