我有一张表 TB_INPORT:
CREATE TABLE tb_inport(
id char(20) primary key,
providerid char(10) NOT NULL,
paytype varchar(50) NOT NULL,
inporttime datetime NOT NULL,
operateperson varchar(50) NOT NULL,
number int NOT NULL,
price float NOT NULL,
comment varchar(100) NULL,
goodsid char(10) NOT NULL,
FOREIGN KEY(goodsid) REFERENCES tb_goods (id),
FOREIGN KEY(providerid) REFERENCES tb_provider (id)
);我使用下面的语句插入一条数据:INSERT INTO TB_INPORT
VALUES
  ('inp1', 'pro1', '1', '2010-1-1', '1', 4, 12.0, '1', 'goo1')
但总会报错:ORA-01861:文字与格式字符串不匹配;ps:外键关系我都有,tb_goods和tb_provider都有id

解决方案 »

  1.   

    --注意时间格式
    INSERT INTO TB_INPORT
    VALUES
    ('inp1', 'pro1', '1', to_date('2010-01-01','yyyy-mm-dd'), '1', 4, 12.0, '1', 'goo1')
      

  2.   

    inporttime datetime NOT NULL,
    你用datetime这个也能创建成功表?
    oracle的最常用类型 
    字符 char varchar2 
    数值 number
    日期 date
      

  3.   

    oracle 好像没有 datetime 
      

  4.   

    oracle 有datetime类型吗?????  看来楼主是高人!!!