This discussion is archived
4 Replies Latest reply: Sep 26, 2013 4:19 AM by jspalmer RSS

CURRENT_DATE

user762915 Newbie
Currently Being Moderated

We are trying to execute a statement SELECT CURRENT_DATE FROM DUAL on Timesten 11.2.2  . It throws error unknown referenced column error.

 

Command> select current_date from dual;

2211: Referenced column CURRENT_DATE not found

The command failed.

 

But the following doc shows the support.

 

Please help.

 

 

TimesTen PL/SQL Support: Reference Summary

 

CURRENT_DATE function

Returns the current date in the session time zone.

          Y

In TimesTen this returns the current date in UTC (universal time). TimesTen does not support local time zones.

  • 1. Re: CURRENT_DATE
    Steve - Oracle Journeyer
    Currently Being Moderated

    If you want the date why not use    SELECT SYSDATE FROM DUAL; ?

     

    Here's a little example on using current_date though :

     

    Command> create procedure test is

           > begin

           > dbms_output.put_line( current_date );

           > end;

           > /

     

    Procedure created.

     

    Command> set serveroutput on;

    Command>  exec test;

    2013-09-26 10:27:51

     

    Hope that helps.

     

    Steve

  • 2. Re: CURRENT_DATE
    user762915 Newbie
    Currently Being Moderated

    sysdate gives the date in local and not in UTC . we are looking for UTC. What is the best way to get it in a select statement.

  • 3. Re: CURRENT_DATE
    Steve - Oracle Journeyer
    Currently Being Moderated

    I don't believe that is possible in TimesTen.

  • 4. Re: CURRENT_DATE
    jspalmer Journeyer
    Currently Being Moderated

    current_date is not available as an SQL function in TimesTen, unlike Oracle. It's available as a PLSQL function, which can be used in this way:

     

    create or replace procedure test is

              dt date;

              mydt varchar2(100);

           begin

     

               dt := current_date;

               mydt := to_char(dt, 'HH24');

               if ((mydt >= 0) and (mydt <= 24)) then

                 dbms_output.put_line(mydt);

               else

                 dbms_output.put_line('FAILURE');

               end if;

             end;

     

     

    Procedure created.

     

    Command> exec test;

    11

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points