SqlPlus,表空间参数,以及转义点字符。

问题描述 投票:1回答:1

我有一个Sqlplus脚本,我需要作为进程链的一部分来执行,其目的是摆脱两个用户定义的对象。

myscript.sql

def tablespaceName=&1

drop type &tablespaceName.my_user_tab;
commit;
drop type &tablespaceName\.my_user_type;
commit;
/

执行。Sqlplus myDbUsermyDbPassword@myDbSID @myscript.sql TESTTABLESPACE

Sqlplus引擎以某种方式丢失了将表空间与对象名称分开的点字符。

old   1: drop type &tablespaceName.my_user_tab
new   1: drop type TESTTABLESPACEmy_user_tab
drop type TESTTABLESPACEmy_user_tab
*
ERROR at line 1:
ORA-04043: object TESTTABLESPACEMY_USER_TAB does not exist

我怎样才能让Sqlplus尊重这个点并停止从脚本中删除它?

oracle oracle11g sqlplus
1个回答
4
投票

首先,对于DDL来说,你不需要commitrollback。

而要转义的点。只要使用双点。

drop type &tablespaceName..my_user_tab;

文件

如果你想在替换变量后立即追加字符,请使用句号将变量和字符分开。

© www.soinside.com 2019 - 2024. All rights reserved.