Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Time is cut off from sysdate using PL/SQL
I discovered that the time part of sysdate is cut of using sysdate in a
to_date function in a PL/SQL procedure.
If you first select sysdate into a local variable it doesn't happen.
Is this a normal behaviour of PL/SQL or more like a bug?
Here's a sample program which explains what I mean.
SQL> DECLARE
2 date1 DATE; 3 date2 DATE; 4 BEGIN 5 date1 := TO_DATE(SYSDATE, 'DD.MM.RRRR HH24:MI:SS'); 6 6 SELECT sysdate 7 INTO date2 8 FROM dual; 9 9 DBMS_OUTPUT.PUT_LINE ('Date1: '||TO_CHAR(date1, 'DD.MM.RRRR HH24:MI:SS')); 10 DBMS_OUTPUT.PUT_LINE ('Date2: '||TO_CHAR(date2, 'DD.MM.RRRRHH24:MI:SS'));
PL/SQL procedure successfully completed.
SQL>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Thu Jul 15 1999 - 03:14:47 CDT