• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do lower/upper work in SQL?

 
Mallika Kumar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to execute the following select statement in Oracle 8i.
SELECT EMPNO,LOWER(EMPNAME) FROM EMPLOYEE WHERE EMPNAME LIKE ?
What actually happens here ? My understanding was that EMPNAME column values are first lower-cased, and then SELECT statement is executed.
If I have EMPNAME column value as 'Mallika', and I pass 'mallika' to the above query, I expected the column value to be 'mallika' in the database temporarily. But I'm not getting the row containing 'Mallika'. If I pass 'Mallika', I get the row. So, is the execution of the query in the following order ?
1. First query is executed and rows are obtained.
2. Next, EMPNAME column values are converted into lowercase and then shown.
Have I interpreted in correctly ? Any clarifications will be helpful.
Thanks.
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you almost had it. You set the return values to lower.
If you want to do it during the compare, you use the lower in the where clause
ex : select empname, empno from emp where lower(empname) like 'mi%'
Dan
[This message has been edited by Daniel Dunleavy (edited June 05, 2001).]
 
Mallika Kumar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Daniel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic