解析PL / SQL代码以检查语法和语义错误 [英] Parsing PL/SQL code to check against syntax and semantic errors

查看:819
本文介绍了解析PL / SQL代码以检查语法和语义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑以下情况:


  • 我有文字区按钮在UI上。

  • 用户将在文本区域中输入PL / SQL块。

  • 当用户将按按钮,我想在没有执行的情况下检查该块中的语法和语义错误。

  • I have a Text-Area and a Button on UI.
  • User will enter a PL/SQL block in Text-Area.
  • When user will press Button, I want to check for syntax and semantic errors in that block without executing it.

我真的想要一个解决方案,我不需要再安装任何东西。

I would really like a solution where I don't have to install anything more.

环境信息:


  1. Java 1.6.31

  2. Oracle数据库11g


推荐答案

SQL> explain plan for select from dual;
explain plan for select from dual
                        *
ERROR at line 1:
ORA-00936: missing expression


SQL> explain plan for select * from dual;

Explained.

declare
  c integer := dbms_sql.open_cursor();
begin
 dbms_sql.parse(c, 'select * emp', dbms_sql.native);
 dbms_sql.close_cursor(c);
end;
/
Error at line 1
ORA-00923: FROM keyword not found where expected
ORA-06512: at "SYS.DBMS_SQL", line 1053
ORA-06512: at line 4

或点击 http://www.softpedia.com/get/Internet/Servers/Database-Utils/EasySQL-Checker -for-Oracle.shtml

这篇关于解析PL / SQL代码以检查语法和语义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆