creating new clobs in DCOracle2
Scherer, Bill
Bill.Scherer at verizonwireless.com
Wed Apr 9 07:01:40 EDT 2003
[P&M]
On Tue, 8 Apr 2003, Daniel wrote:
> I'm using DCOracle2 to access oracle and want to insert data into a clob
> column. The DCOracle2 docs say that you need to first insert an empty clob
> using EMPTY_CLOB() and then query the table to grab it, and finally, write
> to it using the write method.
> In JDBC you can do this:
>
> tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
>
> and then you can write data into the tempClob, and then insert that into the
> table. Can't you do something like this in DCOracle2?
Yes. It goes something like this (untested):
cursor.execute("""
insert into
mytable (foo, bar, clob)
values (1, 2, EMPTY_CLOB())
""")
cursor.execute("""
select clob
from mytable
where foo = 1
and bar = 1
for update
""")
clob = cursor.fetchone()[0]
clob.write(clobData)
db.commit()
>
> Thanks,
Your welcome!
> Daniel
>
>
>
--
Bill.Scherer at Verizon Wireless
RHCE 807101044903581
More information about the Python-list
mailing list