Oracle兼容-存储过程-匿名块


1. 语法

  1. SET sql_mode = ORACLE;
  2. 1. DECLARE
  3. ...
  4. BEGIN
  5. ...
  6. END;
  7. 2. BEGIN
  8. ...
  9. END;

2. 定义和用法

在GreatSQL中支持类似Oracle风格的匿名块用法。

3. 示例

  1. greatsql> SET sql_mode = ORACLE;
  2. greatsql> DELIMITER //
  3. greatsql> BEGIN
  4. SELECT 'Hi GreatSQL';
  5. END; //
  6. +-------------+
  7. | Hi GreatSQL |
  8. +-------------+
  9. | Hi GreatSQL |
  10. +-------------+
  11. 1 row in set (0.00 sec)
  12. greatsql> DECLARE
  13. a INT;
  14. b INT;
  15. BEGIN
  16. a := 3306;
  17. SELECT CONCAT('GreatSQL default port is:' , a);
  18. END; //
  19. +-----------------------------------------+
  20. | CONCAT('GreatSQL default port is:' , a) |
  21. +-----------------------------------------+
  22. | GreatSQL default port is:3306 |
  23. +-----------------------------------------+
  24. 1 row in set (0.00 sec)
  25. Query OK, 0 rows affected (0.00 sec)

问题反馈

联系我们

扫码关注微信公众号

greatsql-wx