Reputation:
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?
Upvotes: 0
Views: 182
Reputation: 1
Check with lowercase only name, but not a password! The password should contain lowercase and uppercase letters, and probably special symbols to allow better protection.
SELECT customer_name, customer_id
FROM customer
WHERE lower(first_name) = lower('"+customer.getFirstname()+"')
AND password = '"+customer.getPassword()+"'
Upvotes: 1
Reputation: 1061
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()+"'
Upvotes: 0
Reputation: 14731
Try as
SELECT customer_name, customer_id
FROM customer
WHERE lower(first_name) = lower('"+customer.getFirstname()+"')
AND lower(password) = lower('"+customer.getPassword()+"')
Upvotes: 0