注释
本文档介绍 MatrixOne 支持的注释语法。
MatrixOne 支持以下注释格式:
- 使用
#注释:
1. mysql> select 100-99; # 注释内容
2. +----------+
3. | 100 - 99 |
4. +----------+
5. | 1 |
6. +----------+
7. 1 row in set (0.01 sec)
- 使用
--来注释一行。--(双破折号)注释样式要求第二个破折号后跟至少一个空格或控制字符(例如空格、制表符、换行符等)。
1. mysql> select 100-99; -- 注释内容
2. +----------+
3. | 100 - 99 |
4. +----------+
5. | 1 |
6. +----------+
7. 1 row in set (0.01 sec)
- 注释内容使用
/*开头,以*/结束,与 C 语言中使用方式一样。此语法使注释可以扩展到多行。
1. mysql> select 100 /* 注释内容 */ -99;
2. +----------+
3. | 100 - 99 |
4. +----------+
5. | 1 |
6. +----------+
7. 1 row in set (0.01 sec)
或:
1. mysql> select 100
2. /*
3. 注释内容
4. */
5. -99;
6. +----------+
7. | 100 - 99 |
8. +----------+
9. | 1 |
10. +----------+
11. 1 row in set (0.01 sec)
MatrixOne 可执行的注释语法
- MatrixOne 支持 C 语言注释格式:
1. mysql> select 100-99; // This comment continues to the end of line
2. +----------+
3. | 100 - 99 |
4. +----------+
5. | 1 |
6. +----------+
7. 1 row in set (0.03 sec)
或:
1. mysql> // This comment continues to the line
2. -> select 100-99;
3. +----------+
4. | 100 - 99 |
5. +----------+
6. | 1 |
7. +----------+
- MatrixOne 不支持的 C 语言注释格式:
1. mysql> select 100 /*! Specific code */ -99;
2. ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 28 near " code */ -99";
或:
1. mysql> select 100 /*!50110 Specific code */ -99;
2. ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 33 near " code */ -99";
限制
- MatrixOne 暂不支持嵌套注释。
