db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kamdar, Devang \(MLITS\)" <Devang_Kam...@ml.com>
Subject How to insert using hard-coded dates in a table?
Date Mon, 05 May 2008 08:55:52 GMT
Hi,
How to insert dates (need to do some testing) into tables?
I am doing following at SQL prompt

insert into TRAN
values ('Jan/01/2007', 'Expense', 20, 'from', 'to', 'descr', 'main',
'sub', 'exotic', '1');

It gives me following error
Error code -1, SQL state 42821: Columns of type 'NUMERIC' cannot hold
values of type 'CHAR'. 
Line 1, column 1

Execution finished after 0 s, 1 error(s) occurred.

I have also tried entering in following format:
insert into TRAN
values ('Jan-01-2007', 'Expense', 20, 'from', 'to', 'descr', 'main',
'sub', 'exotic', '1');

insert into TRAN
values ('01-01-2007', 'Expense', 20, 'from', 'to', 'descr', 'main',
'sub', 'exotic', '1');

insert into TRAN
values ('01/01/2007', 'Expense', 20, 'from', 'to', 'descr', 'main',
'sub', 'exotic', '1');

insert into TRAN
values ('2007-Jan-01', 'Expense', 20, 'from', 'to', 'descr', 'main',
'sub', 'exotic', '1');

Still getting the same error.

Can someone tell me how should I enter?

Also when I am populating this field from a form or populating from a
Java variable to store it in the Database, how can I control the format
e.g. YYYY-MM-DD or YYYY/DD/MM
Is there some doc that explains this in details?

I tried to search in the manuals and user guides and also did some
google ... but no luck.

Thanks
Dev.
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if
you are not an intended recipient, please notify the sender, do not use or share it and delete
it. Unless specifically indicated, this message is not an offer to sell or a solicitation
of any investment products or other financial product or service, an official confirmation
of any transaction, or an official statement of Merrill Lynch. Subject to applicable law,
Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems.
The laws of the country of each sender/recipient may impact the handling of EC, and EC may
be archived, supervised and produced in countries other than the country in which you are
located. This message cannot be guaranteed to be secure or error-free. This message is subject
to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging
with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------

Mime
View raw message