SQL中sqlca sqlcode返回值的含義

2021-05-22 22:35:50 字數 2517 閱讀 8854

如果乙個

sql

語句發生了錯誤,那麼

sqlca.sqlcode

將是非零值。

如果sqlca.sqlcode 小於0

那麼就是發生了某種嚴重的錯誤,如:資料庫定義與查詢定義不一致等.

如果大於

0 則是通常的錯誤,如:表不包括所要求的行等.

sqlca.sqlcode == 0

,成功sqlca.sqlcode == -1

失敗(獲取具體失敗資訊:

messagebox('',"

出錯資訊

:"+sqlca.sqlerrtext)

)--pb

裡的操作方法

可能發生的錯誤列表:

-12, out of memory in line %d. 

通常不出現這個錯誤。這是你的虛擬記憶體耗盡的標誌。

-200, unsupported type %s on line %d. 

通常不出現這個錯誤.這表明預編譯器生成了一些庫(函式)不認得的東西.可能你執行的預編譯器和當前庫不相容.

-201, too many arguments line %d. 

這意味著

postgres

返回了比我們的匹配變數更多的引數.可能你漏了幾個

into :var1,:var2-

列表裡的宿主變數.

-202, too few arguments line %d. 

這意味著

postgres

返回了比我們的對應宿主變數要少的引數.可能你多輸入了幾個

into :var1,:var2-

列表裡的宿主變數.

-203, too many matches line %d. 

著意味著查詢返回了多個行,但你宣告的變數不是陣列.你執行的

select

可能不是唯一的.

-204, not correctly formatted int type: %s line %d. 

著意味著宿主變數是乙個

int型別並且

postgres

資料庫裡的字段是另一種型別,包含著乙個不能轉換成乙個

int

型別的數值.庫(函式)使用

strtol

做此類轉換.

-205, not correctly formatted unsigned type: %s line %d. 

著意味著宿主變數是乙個

unsigned int

(無符號整數)型別而

postgres

資料庫裡的字段是另外一種型別並且包含乙個不能轉換成

unsigned int

的數值.庫(函式)使用

strtoul

做這類轉換.

-206, not correctly formatted floating point type: %s line %d. 

著意味著宿主變數是乙個

float

(浮點)型別而

postgres

資料庫裡的字段是另外一種型別並且包含乙個不能轉換成

float

的數值.庫(函式)使用

strtod

做這類轉換.

-207, unable to convert %s to bool on line %d. 

這意味著宿主變數是乙個

bool

(布林)型別,而

postgres

資料庫裡的字段值既不是

't'

也不是'f'

。-208, empty query line %d. 

postgres

返回pgres_empty_query

,可能的原因是該查詢實際上是空的。

-220, no such connection %s in line %d. 

程式試圖訪問乙個不存在的聯接。

-221, not connected in line %d. 

程式試圖訪問乙個存在的,但是沒有開啟的聯接。

-230, invalid statement name %s in line %d. 

你試圖使用的語句還沒準備好。

-400, postgres error: %s line %d. 

某種postgres

錯誤。該訊息包含來自

postgres

後端的資訊。

-401, error in transaction processing line %d. 

postgres

給我們的訊號,表明我們無法開始,提交或者回卷該事務。

-402, connect: could not open database %s. 

與資料庫的聯接無法工作。

sqlca.sqlcode == 100, data not found line %d. 

這是乙個

"正常的

"錯誤,告訴你你正在查詢的東西找不到或者我們已經越過了游標的範圍。

SQL中的作業

這幾天,一直都在做有關於 使用者的管,原本同事不想對使用者的資料進行物理刪除,但是有關聯的表有三張,查詢出來的時候會出現記錄重複的現向,所以只能對附表進行物理刪除,對主表中的資料進行暫時性的保留,但時間長了對資料的冗餘量那真是不太可觀,所以想辦法要對資料進行定期的清楚.在csdn中找到的方法,收到這...

SQL中的事務

sql中的事務 事務 begin transaction 開始事務 commit transaction 提交事務 rollboack transaction 回滾事務 set implicit ransaction on 隱式事務 update customer set nickname nick...

sql中的連線

一般基於 ansi 標準的 sql 列出了五種 join 方式 內連線 inner join 全外連線 full outer join full join 左外連線 left outer join left join 右外連線 right outer join right join 交叉連線 cro...