Home » SQL & PL/SQL » SQL & PL/SQL » PL/SQL - DATETIME variable
PL/SQL - DATETIME variable [message #251010] Thu, 12 July 2007 03:18 Go to next message
kumarn
Messages: 13
Registered: June 2007
Location: London
Junior Member

Hi,
I am using Oracle8i.

I have a table desc like

USER        VARCHAR2(100),
  LOG_DATE    DATE,
  <column>    <type>

The column LOG_DATE contains date and time both e.g 7/12/2007 5:18:41 AM

I am using a query like
select user, log_date, <column> 
 INTO vUser, vDate, .... 
 FROM <table>;


vDate is of datatype DATE.

vDate contains only the DATE part of tha data.
But my need is to assign the enitre value (i.e 7/12/2007 5:18:41 AM) to vDate.

which datatype should I use ???

Regards,
Kumar



Re: PL/SQL - DATETIME variable [message #251013 is a reply to message #251010] Thu, 12 July 2007 03:20 Go to previous messageGo to next message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Either use a vDate of date datatype or use TO_CHAR function to convert your date into a string with the format you want.

Regards
Michel
Re: PL/SQL - DATETIME variable [message #251015 is a reply to message #251010] Thu, 12 July 2007 03:22 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The DATE datatype will hold both the date and the time.
I suspect that you're just not using a format mask that shows you the time component of the variable:
SQL> set serveroutput on
SQL> declare
  2    v_date  date;
  3  begin
  4    select sysdate 
  5    into v_date
  6    from dual;
  7    dbms_output.put_line('Date is '||to_char(v_date,'dd-mon-yyyy hh24:mi:ss'));
  8  end;
  9  /
Date is 12-jul-2007 09:24:46
Re: PL/SQL - DATETIME variable [message #251020 is a reply to message #251015] Thu, 12 July 2007 03:33 Go to previous message
kumarn
Messages: 13
Registered: June 2007
Location: London
Junior Member

Hi JRowbottom,

Thanks a lot !!!

Actually I was not using the correct format mask.


Rergards,
Kumar
Previous Topic: query required
Next Topic: ORA 22835: buffer too small for blob to char
Goto Forum:
  


Current Time: Wed Dec 07 03:16:49 CST 2016

Total time taken to generate the page: 0.11312 seconds