日期:2014-05-17  浏览次数:20905 次

sqlplus 导入 Sql文件中 如果数据中有&字符怎么转意?
Sql文件中有语句是:
insert into MENU (MENU_ID, MENU_NAME, MENU_LEVEL, MENU_URL, PARENT_MENU_ID, MENU_ICON, TARGET, CHILD_COUNT, MENU_ORDER)
values (50, '', 1, './codingSetAction.do?method=displayIndex&tableId=1', 49, null, null, 0, 1);

在Dos窗口执行到上面语句后提示:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

Enter value for tableid:

------解决方案--------------------
1. 在你运行sql前先运行下面的语句
set define off 


2. 字符值分开写
'./codingSetAction.do?method=displayIndex&'||'tableId=1'

 
3.将&用chr(38)代替就不会出现上面的问题了。
 

------解决方案--------------------
把 './codingSetAction.do?method=displayIndex&tableId=1 '变成 @#./codingSetAction.do?method=displayIndex&tableId=1@# 试一下
------解决方案--------------------
insert into MENU (MENU_ID, MENU_NAME, MENU_LEVEL, MENU_URL, PARENT_MENU_ID, MENU_ICON, TARGET, CHILD_COUNT, MENU_ORDER)
values (50, ' ', 1, './codingSetAction.do?method=displayIndex' || '&' || 'tableId=1 ', 49, null, null, 0, 1); 

chr(38)也可以.
------解决方案--------------------
&加上一个单词的话,sqlplus里面表示一个变量。
会出现要求输入的画面。