开发者

Sybase to equivalent oracle

开发者 https://www.devze.com 2023-02-20 13:25 出处:网络
I am doing an insert operation in oracle In sybase for instance(perl with sybase) sprintf(\"INSERT INTO Custodian_New (Type, Id, User, TimeCreated, RcNumber)

I am doing an insert operation in oracle

In sybase for instance(perl with sybase)

sprintf("INSERT INTO Custodian_New (Type, Id, User, TimeCreated, RcNumber) 
    values (1, %d, '%s', %d, '%s')", $dd, $Name, time(), $rc_num);
prints::(1, 10159, 'rr开发者_StackOverflow社区apak', 1301471663, '234')::Success

Insertion happens in sybase.In oracle the same query fails

Error:Cannot insert null values::

prints::(1, 10159, 'rrapak', 0, '234') ---Failure

The problem is time() value is not printed. When i changed %d to %s,the value is getting printed.But the same error.Unable to insert null values


If your question is actually related to Oracle and not Perl, you may want to have a look at this:

  • http://www.club-oracle.com/articles/oracle-date-functions-184/

More specifically, the SYSDATE and CURRENT_DATE section.


database column created as NOT NULL would do the trick.

0

精彩评论

暂无评论...
验证码 换一张
取 消