You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by yuryx <yu...@mobicomk.donpac.ru> on 2002/07/15 10:14:00 UTC
Insert full date and time into Oracle databse using esql:parameter
Hi all!
Is there any way to insert full datetime value into oracle database
using the following syntax:
<xsp:logic>
java.util.Date today=new java.util.Date();
</xsp:logic>
...
<esql:query>insert into query_stack
(t_stamp,username,q_body,q_type) values (
<esql:parameter type="Date"
><xsp:expr>java.sql.Date(today.getTime())</xsp:expr></esql:parameter>,
<esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
<esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
<esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:parameter>
)
</esql:query>
I always get the result value with 'zero' time :( , and I need to be
able to insert hh24:mi:ss values.
Thanx.
Yury.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Insert full date and time into Oracle databse using esql:parameter
Posted by yuryx <yu...@mobicomk.donpac.ru>.
Christoph Gaffga wrote:
>Why you don't try this:
>
><esql:query>insert into query_stack
>(t_stamp,username,q_body,q_type) values (
> NOW(),
>
This doesn't work (with sql exception )
It worked with 'sysdate' word instead of now() statement , but I have
solve problem with use Data objects for any dates...
It worked with to_date('<xsp:expr>mytimestamp</xsp:expr>','DD-MM-YYYY
hh24:mi:ss') statement also.
Thanx for the your reply.
Yury.
> <esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
> <esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
>
><esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:parame
>ter>
> )
> </esql:query>
>
>
>yours
>Christoph Gaffga
>cgaffga@triplemind.com
>
>
>
>From: "yuryx" <yu...@mobicomk.donpac.ru>
>
>
>>Is there any way to insert full datetime value into oracle database
>>using the following syntax:
>><xsp:logic>
>> java.util.Date today=new java.util.Date();
>></xsp:logic>
>>...
>> <esql:query>insert into query_stack
>>(t_stamp,username,q_body,q_type) values (
>> <esql:parameter type="Date"
>> ><xsp:expr>java.sql.Date(today.getTime())</xsp:expr></esql:parameter>,
>> <esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
>> <esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
>>
>>
>>
>>
><esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:parame
>ter>
>
>
>> )
>>
>> </esql:query>
>>I always get the result value with 'zero' time :( , and I need to be
>>able to insert hh24:mi:ss values.
>>
>>
>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Insert full date and time into Oracle databse using esql:parameter
Posted by Christoph Gaffga <cg...@triplemind.com>.
Why you don't try this:
<esql:query>insert into query_stack
(t_stamp,username,q_body,q_type) values (
NOW(),
<esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
<esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
<esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:parame
ter>
)
</esql:query>
yours
Christoph Gaffga
cgaffga@triplemind.com
From: "yuryx" <yu...@mobicomk.donpac.ru>
> Is there any way to insert full datetime value into oracle database
> using the following syntax:
> <xsp:logic>
> java.util.Date today=new java.util.Date();
> </xsp:logic>
> ...
> <esql:query>insert into query_stack
> (t_stamp,username,q_body,q_type) values (
> <esql:parameter type="Date"
> ><xsp:expr>java.sql.Date(today.getTime())</xsp:expr></esql:parameter>,
> <esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
> <esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
>
>
<esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:parame
ter>
> )
>
> </esql:query>
> I always get the result value with 'zero' time :( , and I need to be
> able to insert hh24:mi:ss values.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Insert full date and time into Oracle databse using esql:parameter
-solved
Posted by yuryx <yu...@mobicomk.donpac.ru>.
Thanx Vadim!
Vadim Gritsenko wrote:
>>From: yuryx [mailto:yuryx@mobicomk.donpac.ru]
>>
>>Hi all!
>>
>>Is there any way to insert full datetime value into oracle database
>>using the following syntax:
>>
>><xsp:logic>
>> java.util.Date today=new java.util.Date();
>></xsp:logic>
>>...
>> <esql:query>insert into query_stack
>>(t_stamp,username,q_body,q_type) values (
>> <esql:parameter type="Date"
>>
>><xsp:expr>java.sql.Date(today.getTime())</xsp:expr></esql:parameter>,
>>
>>
>
>Yury,
>
>Please read javadoc on java.sql.Date: it is *just* date, no time inside.
>
>You should be using java.sql.Timestamp.
>
>Vadim
>
>
>
>
><esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
>
>
><esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
>
>
>>
>>
><esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:pa
>ramete
>
>
>>r>
>> )
>>
>> </esql:query>
>>
>>I always get the result value with 'zero' time :( , and I need to be
>>able to insert hh24:mi:ss values.
>>
>>Thanx.
>>Yury.
>>
>>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: Insert full date and time into Oracle databse using esql:parameter
Posted by Vadim Gritsenko <va...@verizon.net>.
> From: yuryx [mailto:yuryx@mobicomk.donpac.ru]
>
> Hi all!
>
> Is there any way to insert full datetime value into oracle database
> using the following syntax:
>
> <xsp:logic>
> java.util.Date today=new java.util.Date();
> </xsp:logic>
> ...
> <esql:query>insert into query_stack
> (t_stamp,username,q_body,q_type) values (
> <esql:parameter type="Date"
>
><xsp:expr>java.sql.Date(today.getTime())</xsp:expr></esql:parameter>,
Yury,
Please read javadoc on java.sql.Date: it is *just* date, no time inside.
You should be using java.sql.Timestamp.
Vadim
>
<esql:parameter><xsp:expr>uname</xsp:expr></esql:parameter>,
>
<esql:parameter><xsp:expr>param</xsp:expr></esql:parameter>,
>
>
<esql:parameter><xsp:expr>Integer.parseInt(sql_type)</xsp:expr></esql:pa
ramete
> r>
> )
>
> </esql:query>
>
> I always get the result value with 'zero' time :( , and I need to be
> able to insert hh24:mi:ss values.
>
> Thanx.
> Yury.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>