Why is this an error : “Encountered the symbol ”/“ ”?

孤街醉人 提交于 2020-01-16 10:48:29

问题


I'm compiling a collection of store procedures in SQL Developer for the Mac. The code looks like this:

// ... some other code ....

END procedureX;

END thePackageBodyName;

/

show error

grant execute on thePackageBodyName to anotherName;

/

show error

SQLDev is reporting an error "Encountered the symbol "/" for the first slash. If I remove the first slash, and everything below it, it compiles successfully:

// ... some other code ....

END procedureX;

END thePackageBodyName;

Why does the first slash cause an error?


回答1:


The / is used in SQL*Plus. Since you're not compiling in SQL*Plus, remove these, and all should be fine.

More specifically: an / ends a PL/SQL block which can be anonymous or refer to a package/procedure/function/etc definition/declaration. The slash tells SQL*Plus to transmit what has been entered so far to the server and have it compiled. So, it's not part of the PL/SQL language and therefore not needed.

I assume that you have imported or copy-pasted the content of a file into SQL Developer. So break it up into the compilable pieces between the slashes and compile these.

Maybe (and this because I don't know about SQL Developer) there is an option or a possibility to run such files that were created with SQL*Plus in mind in SQL Developer as well.



来源:https://stackoverflow.com/questions/4964294/why-is-this-an-error-encountered-the-symbol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!