首先看建表語句 ,其中紅色語句為自動增長列的實現,更詳細內容請參考apache的derby用戶手冊:
create table cutCustomers (
id int not null PRIMARY KEYGENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
name varchar(10),
tell varchar(20),
createDate varchar(20)
)
接著,執行插入語句:
insert into cutCustomers values('阿亮','138264852','2010年10月2日')
報錯:ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.
費老大勁在百度google上搜索,無解。數據類型應該也沒問題。結果嘗試單列插入,以排除其他列帶來的問題。
insert into cutCustomers (name) values('阿亮')
結果:插入成功
思考:其他列沒有數據類型問題,難道是需要指定列名?
指定列名,嘗試執行:
insert into cutCustomers (name,tell,createDate) values('阿亮','138264852','2010年10月2日')
成功!!!!!!!!!!!!
我那個汗啊!
學軟件開發,到蜂鳥科技!
超強的師資力量 、完善的課程體系 、超低的培訓價格 、真實的企業項目。
網址:www.ntcsoft.com
電話:0371-63839606
鄭州軟件開發興趣小組群:38236716
posted on 2010-11-26 00:35
whistler 閱讀(2061)
評論(0) 編輯 收藏