我在甲骨文中存储clob。为了加快找到相同的clob,我想引入clob的散列值。到目前为止我尝试的是插入CLOB
根据存储的clob更新哈希值。在
如何能在一次手术而不是两次手术中完成?在#!/usr/local/bin/python3
import cx_Oracle
con = cx_Oracle.connect('scott/tiger@localhost:1512/ORCLPDB1', encoding="UTF-8")
cursor = con.cursor()
cursor.execute("CREATE TABLE t (id NUMBER, script CLOB, script_hash RAW(32))")
my_text = '$'*2**10
statement = "INSERT INTO t (id, script) VALUES (:my_id, :my_clob)"
cursor.execute(statement, (1, my_text))
statement = """
UPDATE t
SET script_hash = DBMS_CRYPTO.HASH(script, 2)
WHERE id = :my_id"""
cursor.execute(statement, {'my_id': 1})
con.commit()
con.close()
这不起作用:
^{pr2}$
(使用Python和cx的Oracle 12.2和Oracle 6.3)