Home > database >  Cx_oracle solution of save the children
Cx_oracle solution of save the children

Time:09-16

The import OS
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 behind
To solve the fundamental problem should be the space data standardization
Temporary solution is the where sno=qSno to trim (sno)=qSno

CodePudding user response:

reference 1st floor yaiger response:
015 there's a pile of space behind the data inside the
To solve the fundamental problem should be the space data standardization
Temporary solution is the where sno=qSno to trim (sno)=qSno


I changed my finished I solved the problem and a
I now curs. Execute (" select * from sc ") res=curs. Fetchall () print (res) outputs [(' 2019307030107 ', '1', '85'), (' 2019307030108 ', '2', '80')]
Then I put the program into a
QSno=input (" ")
Curs. Execute (" 'select * from sc
Where the trim (sno)=: sno
"', sno=qSno
)
Res=curs. Fetchall ()
Print (res)
For I in res:
Print (I)
The results or empty just why ah

CodePudding user response:

QSno=input (" ")
Sno=qSno

It can get the result?
  • Related