The import cx_Oracle
OS. Environ [' NLS_LANG]='SIMPLIFIED CHINESE_CHINA. UTF8'
Conn=cx_Oracle. Connect (' system/Pzm971003 @ localhost: 1521/T_S_C ')
Curs=conn. Cursor ()
QSno="015"
Curs. Execute (" 'select * from sc
Where sno=: sno
"', sno=qSno
)
Res=curs. Fetchall ()
Print (res)
MIT ()
conn.comCurs. Close ()
Conn. Close ()
This output is an empty list
But instead of curs. Execute (" select * from sc ")
Outputs [(' 015 ', '5', '55'), (' 001 ', '1', '80'), (' 002 ', '2', '80'), (' 201912121 ', '3', '80')]
On the above statement in SQL server performs no problem
Ask for help
CodePudding user response:
Data in 015 there's a pile of space behindTo solve the fundamental problem should be the space data standardization
Temporary solution is the where sno=qSno to trim (sno)=qSno
CodePudding user response: