2016-03-31 62 views
1

我無法將字符串插入帶有逗號的表中,我的數據類型是否不正確?我一直在作戰,無法在網上找到答案。 我得到了太多的錯誤 - 值「ORA-00913:值過多」用逗號插入字符串sqlplus

create table customer (cust_id number(5) not null primary key, 
cust_name char(25), 
year_born number(4)); 

insert into customer values(1, ‘Harry, L’, 2002); 
insert into customer values(2, ‘Sally, P’, 1992); 
insert into customer values(3, ‘Lio, L’ ,1998); 
insert into customer values(4, ‘Patel, P’, 2001); 
insert into customer values(5, ‘Roner, K’, 1978); 
insert into customer values(6, ‘Jackson, O’, 2002); 
insert into customer values(7, ‘Long, P’, 2001); 
insert into customer values(8, ‘Smith, G’, 1992); 
insert into customer values(9, ‘Harry, L’, 2002); 
insert into customer values(10, ‘Paner, K’, 1978); 
insert into customer values(11, ‘Dan, U’, 2010); 
insert into customer values(12, ‘Patel, M’, 2001); 
+5

使用直的單引號,例如「'哈利,歐萊雅'。 – jarlh

+1

**爲什麼你沒有發佈錯誤代碼?**'ORA-錯誤'代碼是有原因的。 –

+0

ORA-00913:值太多 –

回答

0

關閉「智能引號」中無論你的編輯器。 Oracle不會將它們看作適當的單引號,而是試圖將它們作爲普通字符插入。這意味着它將附加的逗號看作是一個分隔字段的逗號,而不是數據中包含的逗號,並且認爲您試圖插入4個數據元素而不是3個,從而導致錯誤。

注意當複製/粘貼時也會發生這種情況。您可能需要將智能報價編輯爲適當的單引號。