cx_Oracle 中插入blob、date類型資料

#blob

import cx_Oracle

db = cx_Oracle.connect('delphitest/delphitestpass@yyora85')
cursor = db.cursor()
f1 = open(r'd:/img.jpg','rb')
data = f1.read()
pic_data = cx_Oracle.Binary(data)
cursor.execute("insert into pnl_pic values(:1, :2)", ('004', pic_data))
db.commit()

 

#date

import cx_Oracle
import datetime

db = cx_Oracle.connect('delphitest/delphitestpass@yyora85')
cursor = db.cursor()
d1 = datetime.datetime.now()
cursor.execute("insert into employees values(10, 'lk', 'yy3', :1)", (d1,))
#data = rs.fetchall()
db.commit()

你可能感兴趣的:(oracle,Date,insert)