向ORACLE中插入记录:
INSERT INTO TB_BASE_MONEY( vcMoneyCode,vcMoneyName,vcMoneySign,fRate,
vcMemo,vcCreatePerson,dCreateTime,vcAspID,bIsMain)         
VALUES('2','美元','USD',8.000000,'','admin','2007-04-25','mulaolao','否')
报'文字与格式字符窜不匹配',好像是'2007-04-25'
请问哪里出错了?

解决方案 »

  1.   

    要转换成date类型,用to_date('2007-04-25', 'YYYY-MM-DD')试试看
      

  2.   

    换成to_date('2007-04-25', 'YYYY-MM-DD')后不报那个错误了,
    但现在报'无法将NULL插入到(TOYERP.TB_BASE_MONEY.NMONEYID)中',NMONEYID是主键,
    在SQL SERVER中把NMONEYID定义为自动增长的就可以了,但是在ORACLE中也可以把这个列定义为自动增长的列吗,如可可以怎么定义?
      

  3.   

    不能,可以建一个序列a,然后取a.nextval做为主键的值即可。
      

  4.   

    SQL> create table test_a(id number,note varchar2(50));Table createdSQL> create sequence seq_test_a
      2  start with 1
      3  minvalue 1
      4  maxvalue 999999999999999999
      5  increment by 1
      6  noorder;Sequence createdSQL> create trigger tri_test_a before insert
      2  on test_a
      3  for each row
      4  begin
      5   select seq_test_a.nextval into :new.id from dual;
      6  end;
      7  /Trigger createdSQL> insert into test_a(note) values('abc');1 row insertedSQL> insert into test_a(note) values('efg');1 row insertedSQL> select * from test_a;        ID NOTE
    ---------- --------------------------------------------------
             1 abc
             2 efgSQL>