Re: How to do this - SQL

From: Chris Nelson <ChrisNelson_at_eaton.com>
Date: Fri, 12 Mar 1999 16:33:12 -0500
Message-ID: <36E98818.66029511_at_eaton.com>


In answer to the first question: I would think that you could query on CREATION_DATE (when it's available, as it is in many tables) with:

SELECT my_column
FROM my_table
WHERE creation_date = (SELECT max( creation_date)

                                        FROM my_table)

Chris

Norazman Abu Sahir wrote:

> Greetings newsgroup member,
>
> I have two SQL-ORACLE question,
>
> 1)How to write SQL statements that will fetch a certain field
> of the "last record in the table". Say table A which contains
> field named Dept. I realized before this in this newsgroup there is
> a way to get the "last 15" using rownum < 16. However how if I
> don't know how many records in the table but I just want to get
> the last one.
>
> 2)The 2'nd question is regarding Oracle Report. Just to clarify
> my understanding. I have a report which have a PL/SQL inside.
> This PL/SQL was written in one of my function.
>
> I can insert a data into my table using sequence. Something like
> this. INSERT INTO TABLE1 (FIELD1,FIELD2)
> VALUES(SEQUENCE1.NEXTVAL, 10);
> It's perfectly OK and insert whatever next value on SEQUENCE1.
> However when I tried to assign the SEQUENCE1.CURRVAL to one of my
> variable it generate an error (outside of the DML operation).
>
> myvariable := SEQUENCE1.CURRVAL;
>
> Because it doesn't recognize SEQUENCE1.
>
> How to assign current value of SEQUENCE1 to my variable.Is it possible?
>
> Appreciate any help. Excuse me for asking siple question. I just another
> newbie...
>
> -NORAZMAN-
>
>
>
>
Received on Fri Mar 12 1999 - 22:33:12 CET

Original text of this message