坑爹的 ascii codec can't decode byte 0xc8

用cx_Oracle 写update 语句,为了给参数加上单引号,所以就直接在 :1 之类的两边加上了 单引号,

结果一直报错 ascii codec can't decode byte 0xc8 之类的,还以为是编码问题,可是用debug看,都是string类型,百思不得其解

后来发现把 :1 :2 :3 之类两边的单引号去掉就可以了。。。。


        currentTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        updateSql ="update entrust set opp_serial_no =:1, report_time = to_date(:2, 'YYYY-MM-DD hh24:mi:ss')," + \
                        " close_time = to_date(:3, 'YYYY-MM-DD hh24:mi:ss'), status = '2'" +\
                        " where serial_no=:4"     

        cursor.execute(updateSql, (serialNumTo,  currentTime,  currentTime,  serialNumFrom))
        cursor.execute(updateSql, (serialNumFrom,  currentTime,  currentTime,  serialNumTo))

囧。。原因就是其实是执行SQL语句错误,但是因为eric4的debug报错没有报最底层的错误,这个还有待研究

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值