问题
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