• oracle插入数据问题


    这个是我的表结构:
    desc T_STUDENT;
    Name         Type         Nullable Default Comments
    ------------ ------------ -------- ------- --------
    stu_id       VARCHAR2(10)                          
    stu_name     VARCHAR2(40)                          
    stu_password VARCHAR2(40) Y                        
    stu_age      INTEGER      Y                        
    stu_perform  FLOAT(2)     Y   

    在PL/SQL中向此表插入一条数据
    insert into  T_STUDENT (stu_id, stu_name, stu_password, stu_age, stu_perform) values ('001', 'David', 'David', 12, 89.00);
    插入失败,ORA-00904: "STU_PERFORM": 标识符无效
    为什么啊? 全改成大写也不行,将 stu_perform去掉 就会提示stu_age标识符无效。
    求解决 麻烦各位大虾了~

    从你在pl/sql desc命令看出,你的字段名为小写,建表时字段加双引号的结果
    create table t_studetn("stu_id","stu_name",.........
    这样的话,在插入数据时字段上也加上双引号,并且大小写要对应,这样:
    insert into T_STUDENT ("stu_id", "stu_name", "stu_password", "stu_age", "stu_perform") values ('001', 'David', 'David', 12, 89.00);

    所以在建表时和使用标识符的时候都不要加上双引号,免得自找麻烦。。。

    从你在pl/sql desc命令看出,你的字段名为小写,建表时字段加双引号的结果 create table t_studetn("stu_id","stu_name",......... 这样的话,在插入数据时字段上也加上双引号,并且大小写要对应,这样: insert into T_STUDENT ("stu_id", "stu_name", "stu_password", "stu_ag……

    楼上果然厉害。 我也desc了我自己的表,字段真的是大写的。楼主的小写 ,估计就是这的事。平时还得细心观察这些小事呢

    从你在pl/sql desc命令看出,你的字段名为小写,建表时字段加双引号的结果 create table t_studetn("stu_id","stu_name",......... 这样的话,在插入数据时字段上也加上双引号,并且大小写要对应,这样: insert into T_STUDENT ("stu_id", "stu_name", "stu_password", "stu_age……

    我靠 我是用建模工具弄的 靠 太谢谢你了 原来是这样

  • 相关阅读:
    合并字符串中的多个空格
    IfcSpecularRoughness
    IfcSpecularExponent
    IfcPresentableText
    IfcFontWeight
    IfcFontVariant
    uwb ifc模型定位測試
    IfcFontStyle
    IfcGeometricModelResource
    qt6安装
  • 原文地址:https://www.cnblogs.com/qmfsun/p/4262309.html
Copyright © 2020-2023  润新知