我一整天都在努力嘗試使用 cx_Oracle 從 PL/SQL 函數(shù)獲取布爾值。我看過(guò)一些帖子討論使用其他一些數(shù)據(jù)類(lèi)型(如 char 或整數(shù))來(lái)存儲(chǔ)返回值,但是當(dāng)我嘗試使用此類(lèi)解決方案時(shí),我收到錯(cuò)誤的數(shù)據(jù)類(lèi)型錯(cuò)誤。首先,讓我展示代碼。def lives_on_campus(self): cursor = conn.cursor() ret = cursor.callfunc('students_api.lives_on_campus', bool, [self.pidm]) return ret如果我使用 11.2.0.4 數(shù)據(jù)庫(kù)客戶(hù)端,則會(huì)出現(xiàn)以下錯(cuò)誤。File "student-extracts.py", line 134, in <module> if student.lives_on_campus(): File "student-extracts.py", line 58, in lives_on_campus ret = cursor.callfunc('students_api.lives_on_campus', bool, [self.pidm])cx_Oracle.DatabaseError: DPI-1050: Oracle Client library is at version 11.2 but version 12.1 or higher is needed如果我使用 12.1.0.2 數(shù)據(jù)庫(kù)客戶(hù)端或更高版本,則會(huì)收到此錯(cuò)誤。Traceback (most recent call last): File "student-extracts.py", line 134, in <module> if student.lives_on_campus(): File "student-extracts.py", line 58, in lives_on_campus ret = cursor.callfunc('students_api.lives_on_campus', bool, [self.pidm])cx_Oracle.DatabaseError: ORA-03115: unsupported network datatype or representation基本上,無(wú)論我使用哪個(gè)版本的 SQL 客戶(hù)端,它都會(huì)出錯(cuò)?,F(xiàn)在,我知道如果數(shù)據(jù)庫(kù)版本是 12c R2,上面的代碼將會(huì)工作。不幸的是,我們的測(cè)試環(huán)境中只有該版本,并且 PROD 僅使用 11g 數(shù)據(jù)庫(kù)。有什么可以使該功能與 11g 數(shù)據(jù)庫(kù)一起使用嗎?必須有一個(gè)解決方法。
cx_Oracle 獲取布爾返回值
繁星點(diǎn)點(diǎn)滴滴
2023-10-06 18:51:47