Re: PL/SQL & sysdate

From: Mike Dwyer <dwyermj_at_co,larimer.co.us>
Date: 2000/06/23
Message-ID: <Y%J45.3$nk2.3079_at_wdc-read-01.qwest.net>#1/1


SQL*Plus> set serveroutput on
SQL*Plus> declare thisyear number;
  2 begin
  3 select to_number(to_char(sysdate, 'YYYY'))   4 into thisyear from dual;
  5 dbms_output.put_line( to_char(thisyear));   6 end;
  7 /
2000

PL/SQL procedure successfully completed.

SQL*Plus> select * from v$version;

BANNER



Oracle8 Enterprise Edition Release 8.0.5.2.1 - Production PL/SQL Release 8.0.5.2.0 - Production
CORE Version 4.0.5.0.0 - Production
TNS for Solaris: Version 8.0.5.0.0 - Production

Seems to work fine in this ^ environment. How are you declaring and using 'thisyear'? How have you isolated the problem to this particular 'select' statement?

<blank214_at_my-deja.com> wrote in message news:8ivkf1$s18$1_at_nnrp1.deja.com...
> I want to get the current year from the database & convert it to a
> number. The PL/SQL block compiles, but hangs when I try to execute it.
> The following is the problem statement:
>
> select to_number(to_char(sysdate, 'YYYY'))
> into thisyear from dual;
>
> What am I doing wrong?
>
> Thanks in advance - Jennifer
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Jun 23 2000 - 00:00:00 CEST

Original text of this message