SQL-92定义的errorcode 通过PDO什么的返回的值~
2011-12-26 17:43
176 查看
from: http://docstore.mik.ua/orelly/java-ent/jenut/ch08_06.htm
就平常我们经常遇到的返回码比如42000
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
可以看到是大分类42 Syntax error or access rule violation 子分类无
如果需要根据errorcode进行捕获,那么。。。就参考下面这张表就ok了
The SQL-92 standard defines a set of SQLSTATE return codes.
SQLSTATE is defined as a five-character string, where the leftmost two characters define the error class, and the remaining three characters define the error subclass. Some database vendors may extend these return codes; classes beginning
with the numbers 5 through 9 and letters I through Z are reserved for such implementation-specific extensions. The
SQLSTATE code for a particular JDBC action can be retrieved via the
getSQLState() method of SQLException.
Table 8-3 lists the SQLSTATE return codes defined in SQL-92.
就平常我们经常遇到的返回码比如42000
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
可以看到是大分类42 Syntax error or access rule violation 子分类无
如果需要根据errorcode进行捕获,那么。。。就参考下面这张表就ok了
The SQL-92 standard defines a set of SQLSTATE return codes.
SQLSTATE is defined as a five-character string, where the leftmost two characters define the error class, and the remaining three characters define the error subclass. Some database vendors may extend these return codes; classes beginning
with the numbers 5 through 9 and letters I through Z are reserved for such implementation-specific extensions. The
SQLSTATE code for a particular JDBC action can be retrieved via the
getSQLState() method of SQLException.
Table 8-3 lists the SQLSTATE return codes defined in SQL-92.
Table 8-3. SQL-92 SQLSTATE Return Codes
Class | Class Definition | Subclass | Subclass Definition |
---|---|---|---|
00 | Successful completion | 000 | None |
01 | Warning | 000 | None |
001 | Cursor operation conflict | ||
002 | Disconnect error | ||
003 | Null value eliminated in set function | ||
004 | String data, right truncation | ||
005 | Insufficient item descriptor areas | ||
006 | Privilege not revoked | ||
007 | Privilege not granted | ||
008 | Implicit zero-bit padding | ||
009 | Search expression too long for information schema | ||
00A | Query expression too long for information schema | ||
02 | No data | 000 | None |
07 | Dynamic SQL error | 000 | None |
001 | Using clause doesn't match dynamic parameters | ||
002 | Using clause doesn't match target specifications | ||
003 | Cursor specification can't be executed | ||
004 | Using clause required for dynamic parameters | ||
005 | Prepared statement not a cursor specification | ||
006 | Restricted data type attribute violation | ||
007 | Using clause required for result fields | ||
008 | Invalid descriptor count | ||
009 | Invalid descriptor index | ||
08 | Connection Exception | 000 | None |
001 | SQL-client unable to establish SQL-connection | ||
002 | Connection name in use | ||
003 | Connection doesn't exist | ||
004 | SQL-server rejected establishment of SQL-connection | ||
006 | Connection failure | ||
007 | Transaction resolution unknown | ||
0A | Feature not supported | 000 | None |
001 | Multiple server transactions | ||
21 | Cardinality violation | 000 | None |
22 | Data exception | 000 | None |
001 | String data, right truncation | ||
002 | Null value, no indicator | ||
003 | Numeric value out of range | ||
005 | Error in assignment | ||
007 | Invalid date-time format | ||
008 | Date-time field overflow | ||
009 | Invalid time zone displacement value | ||
011 | Substring error | ||
012 | Division by zero | ||
015 | Internal field overflow | ||
018 | Invalid character value for cast | ||
019 | Invalid escape character | ||
021 | Character not in repertoire | ||
022 | Indicator overflow | ||
023 | Invalid parameter value | ||
024 | Unterminated C string | ||
025 | Invalid escape sequence | ||
026 | String data, length mismatch | ||
027 | Trim error | ||
23 | Integrity constraint violation | 000 | None |
24 | Invalid cursor state | 000 | None |
25 | Invalid transaction state | 000 | None |
26 | Invalid SQL statement name | 000 | None |
27 | Triggered data change violation | 000 | None |
28 | Invalid authorization specification | 000 | None |
2A | Syntax error or access rule violation in direct SQL statement | 000 | None |
2B | Dependent privilege descriptors still exist | 000 | None |
2C | Invalid character set name | 000 | None |
2D | Invalid transaction termination | 000 | None |
2E | Invalid connection name | 000 | None |
33 | Invalid SQL descriptor name | 000 | None |
34 | Invalid cursor name | 000 | None |
35 | Invalid condition number | 000 | None |
37 | Syntax error or access rule violation in dynamic SQL statement | 000 | None |
3C | Ambiguous cursor name | 000 | None |
3F | Invalid schema name | 000 | None |
40 | Transaction rollback | 000 | None |
001 | Serialization failure | ||
002 | Integrity constraint violation | ||
003 | Statement completion unknown | ||
42 | Syntax error or access rule violation | 000 | None |
44 | With check option violation | 000 | None |
相关文章推荐
- Hibernate通过SQL查询常量时只返回第一个字符解决方法
- SQL 数据库 学习 007 通过一个示例简单介绍什么是字段、属性、列、元组、记录、表、主键、外键 (上)
- PDO 提供错误处理策略以及SQLSTATE各种errorCode状态码
- Hibernate通过什么方法可以把私有成员变量赋值成数据库查询到的值然后返回POJO对象呢?
- Hibernate通过SQL查询常量时只能返回第一个字符的解决方法
- Hibernate中用纯SQL查询,并通过hibernate分页返回List<对象>
- Hibernate通过SQL查询常量时只能返回第一个字符的解决方法
- SQL-92标准 中文翻译——定义、记号和约定 (定义)
- Hibernate通过SQL查询常量时只能返回第一个字符的解决方法
- hibernate通过sql查询返回一个key value对应的map对象型集合
- Hibernate通过SQL查询常量时只能返回第一个字符的解决方法
- NHibernate-通过SQL-Query返回DataSet
- 创建一个包,其中定义一个过程,可以查询得到编号为7900的员工的姓名ename、薪水sal、佣金comm、上司编号mgr (通过OUT类型的参数将结果返回并打印) (注意包有包头部分的声明和包体部分的
- c测试最后一题(改进:通过定义结构体返回多个值)
- 为什么在函数中不能通过指针返回本地定义的变量
- 如何通过动态sql远程调用包里面的函数,并返回值。
- 对于SQL的Join,在学习起来可能是比较乱的。我们知道,SQL的Join语法有很多inner的,有outer的,有left的,有时候,对于Select出来的结果集是什么样子有点不是很清楚。Coding Horror上有一篇文章,通过文氏图 Venn diagrams 解释了SQL的Join。我觉得清楚易懂,转过来。 交差集" cross join 《Linux命令行与shell脚本编程大全
- 通过jquery获取元素宽高时,此元素必须明确定义了宽高或已经被追加到页面中,否则返回的宽高都是0
- CI框架,select 查询sql,没有结果是返回false还是空数组? 什么情况下返回false?
- hibernate 通过sql返回list遍历