DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: plsql hell (need urgent help)

  1. #1
    Join Date
    Oct 2000
    Posts
    4
    Hi, Ive got the simplest question on earth, hell i should be able to answer it but for some reason it wont work.

    I have this line in my plsql program

    insert into migrate.apc_call_details
    select * from migrate.apc_call_details_07
    where rownum between from_row_num and to_row_num;


    where from_row_num and to_row_num are variables.

    Theses variables are being populated right.

    When I get to this insert my plsql program just hangs.

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    I do not know there is a bug while using rownum.

    Try to use < operator with rownum.

    First of all it is not a good idea to use rownum in insert statement.

  3. #3
    Join Date
    Nov 1999
    Location
    Elbert, Colorado, USA
    Posts
    81
    You cannot use ">" or "BETWEEN" with rownum. However, I would have hoped it would do something a little more graceful than hanging!

    If you're sure you really want to use rownum as your search criteria, you could try

    insert into migrate.apc_call_details
    select * from migrate.apc_call_details_07
    where rownum < to_row_num
    MINUS
    select * from migrate.apc_call_details_07
    where rownum < from_row_num;

    However, be advised that since this is actually doing two queries plus a sort (due to the MINUS operation), (a) it may take a while to run, depending on the size of your table and (b) the order that rows are returned may differ between queries (hence the questioning of this technique) and you may get anomalous results.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width