How is SQL injection possible when using bind variables?
My database administrator says that using bind variables does not completely protect one from SQL injection, but I can’t figure out how it could be, since bind variables, especially for strings, usually force the entered SQL to be a string in WHERE.
Example:
SELECT CUST_ID
FROM CUST.CUSTOMER
WHERE FIRST_NAME=:FNAME;
If FNAME="SELECT FNMAME WHERE CUST_ID=10040", in the database the following query will be launched
SELECT CUST_ID
FROM CUST.CUSTOMER
WHERE FIRST_NAME="SELECT FNMAME WHERE CUST_ID=10040";
which will return 0 rows.
I browsed the Internet to answer this question and even on this site, but I could not find it.
Thanks again.
source
share