scalar function usage



IBM's flagship relational database management system

scalar function usage

Postby Anitha_S » Thu Aug 12, 2010 10:33 am

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)
Anitha_S
 
Posts: 5
Joined: Thu Aug 12, 2010 10:26 am
Has thanked: 0 time
Been thanked: 0 time

Re: scalar function usage

Postby NicC » Thu Aug 12, 2010 12:22 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: scalar function usage

Postby Anitha_S » Fri Aug 13, 2010 2:33 pm

ya i verified using some query.
We can used it in the order by clause too.


for eg order by bigint(acct_num)
Anitha_S
 
Posts: 5
Joined: Thu Aug 12, 2010 10:26 am
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post