sql错误:ora-00913:值00913太多00000-“插入查询的值太多”

1tu0hz3e  于 2021-07-26  发布在  Java
关注(0)|答案(3)|浏览(545)
CREATE TABLE AAA_MYTB_STUDENT
     (
          STUDENT_NIC INT NOT NULL PRIMARY KEY,
          INSID INT NOT NULL,
          UNIID INT NOT NULL,
          FNAME VARCHAR(30)NOT NULL,
          MNAME VARCHAR(30),
          LNAME VARCHAR(30),
          ADDRL1 VARCHAR(15),
          ADDRL2 VARCHAR(15),
          ADDRL3 VARCHAR(15),
          ADDRL4 VARCHAR(15),
          BATCHNO VARCHAR(10) NOT NULL,
          DOB DATE,
          GENDER CHAR(1)
    );

上面是我用19c版在oracle数据库中创建的create table查询。使用下面的查询,我试图将值插入到创建的表中。但它一直给我下面的错误信息。我看了很多以前的答案,但我不知道这个问题出了什么问题。

INSERT INTO AAA_MYTB_STUDENT(STUDENT_NIC, INSID, UNIID, FNAME, MNAME, LNAME, ADDRL1,ADDRL2, ADDRL3, ADDRL4, BATCHNO, DOB)
VALUES (873393262, 12345, 200569, "Chamara", "Munasinghe","Arachchige","123A", "DNR State", "HOMAGAMA","Sri Lanka","2021Jan001","1999/12/05","M");

sql错误:ora-00913:值00913太多。00000-“值太多”

xpszyzbs

xpszyzbs1#

insert语句中没有“性别”列。

INSERT INTO AAA_MYTB_STUDENT(STUDENT_NIC, INSID, UNIID, FNAME, MNAME, LNAME, ADDRL1,ADDRL2, ADDRL3, ADDRL4, BATCHNO, DOB, GENDER)
VALUES (873393262, 12345, 200569, "Chamara", "Munasinghe","Arachchige","123A", "DNR State", "HOMAGAMA","Sri Lanka","2021Jan001","1999/12/05","M");
bvuwiixz

bvuwiixz2#

这是因为提供的数值大于insert子句中提到的列数。
在本例中,缺少“gender”字段

INSERT INTO AAA_MYTB_STUDENT(STUDENT_NIC, INSID, UNIID, FNAME, MNAME, LNAME, ADDRL1,ADDRL2, ADDRL3, ADDRL4, BATCHNO, DOB)
VALUES (873393262, 12345, 200569, "Chamara", "Munasinghe","Arachchige","123A", "DNR State", "HOMAGAMA","Sri Lanka","2021Jan001","1999/12/05","M");
lpwwtiir

lpwwtiir3#

这个 GENDER 列丢失,但一旦修复该问题,则需要将双引号更改为单引号。
双引号表示区分大小写的标识符(即列或表名)。
单引号表示文字(即字符串)。

INSERT INTO AAA_MYTB_STUDENT(
  STUDENT_NIC,
  INSID,
  UNIID,
  FNAME,
  MNAME,
  LNAME,
  ADDRL1,
  ADDRL2,
  ADDRL3,
  ADDRL4,
  BATCHNO,
  DOB,
  GENDER             -- The gender column was missing.
) VALUES (
  873393262,
  12345,
  200569,
  'Chamara',         -- Single quotes
  'Munasinghe',      -- Single quotes
  'Arachchige',      -- Single quotes
  '123A',            -- Single quotes
  'DNR State',       -- Single quotes
  'HOMAGAMA',        -- Single quotes
  'Sri Lanka',       -- Single quotes
  '2021Jan001',      -- Single quotes
  DATE '1999-12-05', -- Use a DATE literal
  'M'
);

相关问题