ORACLE中Insert时总是出现让enter value for....

来源:互联网 发布:bcm20702a0 mac 编辑:程序博客网 时间:2024/06/06 01:01

ORACLE在执行insert语句时,总是出现让enter  value  for....

解决:在执行insrt语句前,在SQL PLUS中,执行SQL>  set define off

原因:是因为在insert时,值中有转义字符,插入数据前,需关闭转义字符的定义。


SQLPLUS下处理&字符的方法还有如下几个:

 

(1)   关闭对于替换字符的定义

SQL> set define off

SQL>insert into t values('&2');

 

1 row created.

 

SQL> commit;

 

Commit complete.

 

(2)      将替换字符的定义设置为其他不用的字符

 

SQL>set define %

SQL> insert into t values('&3');

 

1 row created.

 

SQL> commit;

 

Commit complete.

 

(3)      设定字符转义

 

SQL> set escape on

SQL> show escape

escape "\" (hex 5c)

SQL> insert into t values('\&4');

 

1 row created.

 

SQL>commit;

 

Commit complete.

 

SQL> select * from t;

 

NAME

--------------------

&

&!@#$%^*()_+

&1

&2

&3

&4

 

6 rows selected.




0 0
原创粉丝点击