Kunal Roy
Kunal Roy

Reputation: 787

SQLSTATE and SQLCODE usage in SQLRPGLE

In SQLRPGLE programming I have seen that the SQLSTATE and SQLCODE being used in several areas in order to catch an error in the sql statement. My query is what is the difference between SQLSTATE and SQLCODE because I see them to be used for similar purpose. Is there any special scenario where SQLSTATE or SQLCODE is used or are they the same?

Upvotes: 1

Views: 1463

Answers (1)

nfgl
nfgl

Reputation: 3212

Short version, SQLCODE is DB2 for IBM i specific, SQLSTATE is standard

See here

SQLSTATE is the preferred standard return code. It provides application programs with return codes for common error conditions found among the DB2® products.

SQLSTATE values are consistent with the SQLSTATE specifications that are contained in the SQL 1999 standard.

Upvotes: 4

Related Questions