简体   繁体   中英

Oracle error ORA-01036: illegal variable name/number

Why am I getting this error in Oracle DB?

cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

cur.execute("select jobid, jobname, technology, skillset, salary, minimumexp from job where technology=:technology or int(salary)>=:int(salary) or int(minimumexp)<=int(minimumexp)",{"technology":technology,"int(salary)":int(salary),"int(minimumexp)":int(minimumexp)})

I don't think that INT function is valid in this context; at least, it does nothing in Oracle. Unless I'm wrong, it converts float numbers into integers . If that's so, try with the TRUNC function instead, as Python's INT cuts off decimals.

Besides, it seems that you used the colon sign (which represents a parameter , right?) on the wrong place (should be in front of the parameter name, not the INT (or TRUNC ) function).

For example:

No : or int(salary)   >= :int(salary)
Yes: or trunc(salary) >= trunc(:salary)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM