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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Date and time field question

Re: Date and time field question

From: Mark D Powell <markp7832_at_my-deja.com>
Date: 2000/04/13
Message-ID: <8d4tpo$p1k$1@nnrp1.deja.com>#1/1

In article <8d3uh2$t7h$1_at_mawar.singnet.com.sg>,   "Matthew Tan" <tankc_at_singnet.com.sg> wrote:
> Hello,
>
> I am having problem creating a time and date format,
>
> 1) v_timedate := to_char(sysdate,'DD-MON-YYYY HH24:MI:SS');
>
> I will encounter this error message :
>
> "date format picture ends before converting entire input string"
>

How is v_timedate defined? As is it must be a char or varchar2 column with a length of at least 20.

> When I change to
>
> 2) v_timedate := to_char(sysdate,'DD-MON-YYYY');
>
> It will work fine BUT it will display :
>
> 13-APR-00
>

How are you displaying the date? The normal Oracle default display date format is dd-Mon-yy which is what you are showing.

> What happen to the '20' ?
>
> Thanks for any help !
>

Observe:
UT1> l
  1 declare

  2  v_date1      varchar2(20) ;
  3  v_date2      date         ;

  4 begin
  5 v_date1 := to_char(sysdate,'dd-mon-yyyy hh24:mi:ss');   6 v_date2 := sysdate ;
  7 dbms_output.put_line('v_date1 is '||v_date1);   8 dbms_output.put_line('v_date2 is '||to_char(v_date2,'dd-mon-yyyy hh24:mi:ss');
  9* end ;

UT1> @temp
v_date1 is 13-apr-2000 12:49:00
v_date2 is 13-apr-2000 12:49:00

PL/SQL procedure successfully completed.

--
Mark D. Powell  -- The only advice that counts is the advice that
 you follow so follow your own advice --


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Apr 13 2000 - 00:00:00 CDT

Original text of this message

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