为什么会出现错误:“遇到符号"/" &quot ;? [英] Why is this an error : "Encountered the symbol "/" "?

查看:117
本文介绍了为什么会出现错误:“遇到符号"/" &quot ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Mac的SQL Developer中编译一组存储过程.代码如下:

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报告第一个斜杠遇到符号"/"的错误.如果我删除了第一个斜杠及其下的所有内容,它将成功编译:

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?

推荐答案

/在SQL * Plus中使用.由于您未使用SQL * Plus进行编译,因此请将其删除,一切都将正常.

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

更具体地说:/结束一个PL/SQL块,该块可以是匿名的,也可以引用程序包/过程/函数/etc的定义/声明.斜线告诉SQL * Plus将到目前为止输入的内容传输到服务器并进行编译.因此,它不是PL/SQL语言的一部分,因此不需要.

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.

我假设您已将文件的内容导入或复制粘贴到SQL Developer中.因此,将其分解为斜线之间的可编译部分,然后对其进行编译.

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.

也许(这是因为我不了解SQL Developer),或者也有可能运行在SQL Developer中考虑到使用SQL * Plus创建的此类文件.

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.

这篇关于为什么会出现错误:“遇到符号"/" &quot ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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