Page 1 of 1

Can a scalar function, for example MAX, be used in WHERE...

Posted: Tue Nov 19, 2013 2:16 pm
by Anjali Chopra
Hi,

The question is - can a scalar function, for example MAX, be used in WHERE clause for SELECT? Could anypone please guide on this.

Any help is appreciated.

Re: Can a scalar function, for example MAX, be used in WHERE

Posted: Wed Nov 20, 2013 12:49 pm
by Anuj Dhawan
Hi,

The answer is Yes, but there is a "but" to consder here - one should limit the usage of Scalar functions such as SUBSTR, CHAR, INT etc. in the WHERE clause. This is advised because if any scalar function is used for a column in the WHERE clause, the DB2 optimizer will not use a matching index column for the retrieval of the records from the table - and it turn, the response time of your LUW gets slow.

Re: Can a scalar function, for example MAX, be used in WHERE

Posted: Wed Nov 20, 2013 6:06 pm
by Anjali Chopra
Thanks Anuj - this helps a lot! :)

Re: Can a scalar function, for example MAX, be used in WHERE

Posted: Sat Apr 12, 2014 5:14 am
by maidy
Hello Anuj,

What do you mean by:
the response time of your LUW gets slow.
Linux, Unix and Windows?

Thanks!
Maidy

Re: Can a scalar function, for example MAX, be used in WHERE

Posted: Sat Apr 12, 2014 7:40 am
by Robert Sample
Logical Unit of Work