SQL 错误:ORA-00947:值不足
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26241337/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL Error: ORA-00947: not enough values
提问by Emmanuel
Learning Oracle SQL. I have created a table that looks like this:
学习 Oracle SQL。我创建了一个看起来像这样的表:
CREATE TABLE Kocury
(imie VARCHAR2(15) NOT NULL,
plec VARCHAR2(1) CONSTRAINT allowedValues CHECK (plec in ('M', 'D')),
pseudo VARCHAR2(15) Constraint PK_KOCURY PRIMARY KEY,
funkcja VARCHAR2(10) CONSTRAINT fk_checkF REFERENCES Funkcje (funkcja),
szef VARCHAR2(15) CONSTRAINT fk_checkS references Kocury (pseudo),
w_stadku_od DATE default sysdate,
przydzial_myszy NUMBER(3),
myszy_extra NUMBER(3),
nr_bandy NUMBER(2) CONSTRAINT fk_checkN REFERENCES Bandy(nr_bandy)
);`
and then I tried to insert some data:
然后我尝试插入一些数据:
INSERT INTO Kocury(imie, plec, pseudo, funkcja, szef, w_stadku_od, przydzial_myszy ,myszy_extra, nr_bandy)
VALUES ('JACEK', 'M', 'PLACEK', 'LOWCZY', 'LYSY', '2008-12-01, 67',NULL , 2);
INSERT INTO Kocury(imie, plec, pseudo, funkcja, szef, w_stadku_od, przydzial_myszy ,myszy_extra, nr_bandy)
VALUES ('JACEK', 'M', 'PLACEK', 'LOWCZY', 'LYSY', '2008-12-01, 67',NULL , 2);
as far as I am concerned the data types all match. But in Oracle SQL Developer I get this:
就我而言,数据类型都匹配。但是在 Oracle SQL Developer 中我得到了这个:
Error starting at line : 41 in command -
INSERT INTO Kocury(imie, plec, pseudo, funkcja, szef, w_stadku_od, przydzial_myszy ,myszy_extra, nr_bandy)
VALUES ('JACEK', 'M', 'PLACEK', 'LOWCZY', 'LYSY', '2008-12-01, 67',NULL , 2)
Error at Command Line : 42 Column : 1
Error report -
SQL Error: ORA-00947: not enough values
00947. 00000 - "not enough values"
*Cause:
*Action:
Error starting at line : 41 in command -
INSERT INTO Kocury(imie, plec, pseudo, funkcja, szef, w_stadku_od, przydzial_myszy ,myszy_extra, nr_bandy)
VALUES ('JACEK', 'M', 'PLACEK', 'LOWCZY', 'LYSY', '2008-12-01, 67',NULL , 2)
Error at Command Line : 42 Column : 1
Error report -
SQL Error: ORA-00947: not enough values
00947. 00000 - "not enough values"
*Cause:
*Action:
I am not sure what's happening and how to get my data inserted. What could I be doing wrong? These topics didn't help me: ORA-00947 : Not Enough ValuesORA-00947: not enough values
我不确定发生了什么以及如何插入我的数据。我可能做错了什么?这些主题对我没有帮助: ORA-00947:值不够ORA-00947:值不够
回答by sgeddes
You're missing some apostrophes in between '2008-12-01, 67'
:
您在两者之间缺少一些撇号'2008-12-01, 67'
:
INSERT INTO Kocury(imie, plec, pseudo, funkcja, szef, w_stadku_od, przydzial_myszy ,myszy_extra, nr_bandy)
VALUES ('JACEK', 'M', 'PLACEK', 'LOWCZY', 'LYSY', '2008-12-01', 67, NULL , 2)