sqloracle-databaseoracle10guppercaselowercase

Getting lowercase letters from Oracle 10g columns


The following query shows a validation of the user's login credentials with the frist name and password from Oracle 10g database.

In my database the first name contains uppercase and lowercase letters, but from the front end side, I always get lowercase letters.

SELECT customer_name, CUSTOMER_ID
  FROM customer
 WHERE     first_name = '"+customer.getFirstname()+"'
       AND password = '"+customer.getPassword()+"'

I want to check the db with lowercase only. Any possible way to do it in Oracle query?


Solution

  • In query itself you can do.

    For Lower

    lower(first_name)
    

    For Upper

    upper(first_name)
    

    Here you can change your query as shown below.

    SELECT customer_name, CUSTOMER_ID from customer where lower(first_name)='"+customer.getFirstname()+"' AND password='"+customer.getPassword()+"'