SQLCode

SQLCode

SQLCode:資料庫操作的返回碼,其中0--成功;-1--失敗;100--沒有檢索到數據。

概述


例如,IF SQLCA.SQLCode<>0 then
MessgeBox("連接失敗","不能連接資料庫")
RETURN
END IF
另外 SQLCODE經常與 SQLERRM連用
例如:
DBMS_OUTPUT.PUT_LINE(SQLCODE||'----'||SQLERRM);

例子


create or replace procedure tes
as
sqlc integer;
begin
insert into t1 values (1);
sqlc:=sqlcode;
if sqlc=0 then
dbms_output.put_line('成功!');
else
dbms_output.put_line('失敗!');
end if;
end;