Difference b/w 2 ways of fetching record

From: Praveen <spraveen2001_at_yahoo.com>
Date: 13 Feb 2003 00:59:50 -0800
Message-ID: <98d8ec76.0302130059.7f5a0e69_at_posting.google.com>


Hi All,

I have a USR table with username,first_name,last_name,nick_name and email_address columns. Here the requirement is to fetch records in ranges like 1-100,101-201... and so on. I have done this using two(2) ways, They are:

1.

   select username,first_name,last_name,nick_name,email_address from (    select rownum recno,first_name,,last_name,nick_name,email_address    from USR) where recno >= 1 and recno < 101;

2. In this case, I created a GLOBAL TEMPORARY TABLE called TMP_USR with

seq_id,username,first_name,last_name,nick_name and email_address columns.

    Insert into tmp_usr(

                seq_id,username,first_name,last_name,nick_name,email_address)     select rownum,username,first_name,last_name,nick_name,email_address

                from USR;

    then,

	select username,first_name,last_name,nick_name,email_address
		from TMP_USR where seq_id >=1 and seq_id < 101;

    Here, which approach is best one, can anyone sugges me?

Thanks in Advance,
Praveen Received on Thu Feb 13 2003 - 09:59:50 CET

Original text of this message