oracle库更新数据和类型转换

更新oracle

sql6 = "UPDATE 表名 set (value)=(:value) where coeffs_id=(:coeffs_id)"
cur_36.prepare(sql6)
cur_36.execute(None, {'value': value, 'coeffs_id': coeffs_id})
 conn_36.commit()`

sql语句中常见类型转换

    sql2 = "select  cast(community_id as varchar) community_id,sale_count,ppe from 表名 where is_defalt=true "
   

整数转换成字符串 :cast(community_id as varchar) 别名
字符串转换成整数 :cast(community_id as int) 别名

TO_TIMESTAMP_TZ(‘2018-11-11 10:47:16’,‘YYYY-MM-DD HH24:MI:SS’)
to_char(属性名,格式) 常用于时间转字符串
to_date(属性名,格式) 常用于字符串转日期

参考:https://blog.csdn.net/xiuxiuzhuanshu/article/details/78731075

你可能感兴趣的:(oracle库更新数据和类型转换)