Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Passing a date and time to a stored procedure

Re: Passing a date and time to a stored procedure

From: zoetosis <NeilJellis_NoSpam_Please__at_Hotmail.com>
Date: Wed, 31 Mar 2004 12:35:26 +0100
Message-ID: <c4eadv$n7k$1$8302bc10@news.demon.co.uk>


Mark,

Would it be better to accept a varchar2 parameter and do the conversion within the procedure itself?

> you will need to pass in a valid date datatype, not a character (varchar2)
datatype
I thought I was but could you provide an example so I can see where I got it wrong

Regards

Neil

"Mark C. Stock" <mcstockX_at_Xenquery .com> wrote in message news:rsKdnXwe9s_7N_fd4p2dnA_at_comcast.com...
>
> "zoetosis" <NeilJellis_NoSpam_Please__at_Hotmail.com> wrote in message
> news:c4e7vc$ku6$1$8302bc10_at_news.demon.co.uk...
> | I need to know how I can accept a date and time such as 31-mar-2004
> 11:45:12
> | as a parameter to a stored procedure.
> | I've looked around but can only find examples of where a date but no
time
> | element is passed.
> |
> | The parameter is declared thus:
> | ..., pwdexpiredate_in in useraccount.pwdexpiredate%type, ...
> |
> | The parameter will ultimately supply the value to go into a column in a
> | table.
> |
> | When I run the procedure Oracle complains about the hours element of the
> | time.
> |
> | Thanks
> |
> | Neil
> |
> |
>
> assuming the useraccount.pwdexpiredate column is defined as a date
datatype,
> then the pwdexpiredate_in parameter will also be a date datatype
>
> oracle date datatypes include time, to the second
>
> you will need to pass in a valid date datatype, not a character (varchar2)
> datatype
>
> if you are calling your procedure with a literal, you will need to use the
> to_date() function to convert your literal (character string) to a date --
> specifying both the date value and a corresponding format
>
> ;-{ mcs
>
>
Received on Wed Mar 31 2004 - 05:35:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US