问题描述
注意:使用Oracle SQL Developer时,我没有此问题:-但这不是标准.因此,我必须在PL/SQL Developer中找到一种方法来做到这一点
Note: I do not have this problem when using Oracle SQL Developer:: - But it is not the Standard here. So i must find a way to do this in PL/SQL Developer
当尝试使用PL/SQL Developer(PL/SQL Developer-程序)动态删除表,然后使用create语句创建新表时,我始终遇到错误:
PLS-00103:遇到符号"/"符号"/"被忽略了PLSQL
When attempting to use PL/SQL developer (PL/SQL Developer - the program) to dynamically drop tables then create new ones using a create statement I consistently run into the error:
PLS-00103: ENCOUNTERED THE SYMBOL "/" THE SYMBOL "/" WAS IGNORED PLSQL
这是由于动态sql末尾的"/"引起的.
This is due to the "/" at the end of the dynamic sql.
如果从末尾删除"/",则会收到错误消息: 遇到了创建"符号
If I remove the "/" from the end I receive an error:ENCOUNTERED THE SYMBOL "CREATE"
在PL/SQL Developer中解决此错误的最佳方法是什么?
What is the best method to get around this error inside PL/SQL Developer?
谢谢:
DECLARE
VE_TABLENOTEXISTS EXCEPTION;
PRAGMA EXCEPTION_INIT(VE_TABLENOTEXISTS, -942);
PROCEDURE DROPTABLE(PIS_TABLENAME IN VARCHAR2) IS
VS_DYNAMICDROPTABLESQL VARCHAR2(1024);
BEGIN
VS_DYNAMICDROPTABLESQL := 'DROP TABLE ' || PIS_TABLENAME;
EXECUTE IMMEDIATE VS_DYNAMICDROPTABLESQL;
EXCEPTION
WHEN VE_TABLENOTEXISTS THEN
DBMS_OUTPUT.PUT_LINE(PIS_TABLENAME || ' NOT EXIST, SKIPPING....');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
RAISE;
END DROPTABLE;
BEGIN
DROPTABLE('foo.foo_table');
END DROPTABLE;
/
CREATE TABLE foo.foo_table AS
(
SELECT STUFF, MORE_STUFF FROM not_foo_table
)
;
SELECT * FROM foo.foo_table
;
推荐答案
我也有PLSQL Developer.我尝试用发布它的方式来编译您的过程,但遇到同样的错误,但是如果我在"/"之前删除空格,它将很好地工作;就像它无法识别"/".
I have too PLSQL Developer.I try to compile your procedure the way you post it and I get the same error, but if I remove the blank spaces before the "/" it works fine; like it don't recognize the "/".
所以,我建议您更改此设置:
So, I recommend you to change this:
END DROPTABLE;
/
为此:
END DROPTABLE;
/
这篇关于PL/SQL Developer中的PLS-00103错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!