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

Home -> Community -> Usenet -> c.d.o.misc -> Re: MAX(DATE)

Re: MAX(DATE)

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 29 Mar 2000 21:38:52 +0200
Message-ID: <954360061.6429.1.pluto.d4ee154e@news.demon.nl>

<jeanch_at_my-deja.com> wrote in message news:8btkgn$h7g$1_at_nnrp1.deja.com...
> Folks
>
> Can anybody help ?
>
> I am trying to get the latest (timewise) entry to the clipboard.
>
> when I run the below select using SQL it works
> but not using PL/SQL;
>
> It seems like the MAX function does not
> understand Date type.
>
> ....
> v_undoString CLIPBOARD.DATA%TYPE DEFAULT NULL;
> p_eid INTEGER;
> v_name VARCHAR(30);
>
>
> BEGIN
> SELECT data
> INTO v_undoString
> FROM CLIPBOARD WHERE
> timestamp = (SELECT MAX(timestamp)
> FROM CM_UNDO_CLIPBOARD
> WHERE num = p_num AND OWNER = v_Name);
> END;
>
>
> Table description
> Name Null? Type
> ------------------------------- -------- ----
> num NUMBER(38)
> TIMESTAMP DATE
> OWNER VARCHAR2(100)
> DATA VARCHAR2(2000)
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

I would make sure using table aliases everywhere, pl/sql is very sensitive about scope.
You also may want to check whether timestamp is a reserved word, to my best knowledge it isn't, but you never know.

Hth,
Sybrand Bakker, Oracle DBA Received on Wed Mar 29 2000 - 13:38:52 CST

Original text of this message

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