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

Thread: Query Help

  1. #1
    Join Date
    Jul 2003
    Posts
    53

    Query Help

    Hi,
    Can anyone give me solution for these question:

    IS there any way we can retrieve alternate rows in a table(1,3,5,...)?

    What is the maximum number of triggers we can write on a table?

    Thanks All in advance
    Anupama
    anu

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439

    Re: Query Help

    Originally posted by anupamasuresh
    IS there any way we can retrieve alternate rows in a table(1,3,5,...)?
    What are those 1,3,5,... values? If they are for example values from some column (like sequence generated keys), you can us this:

    SELECT * FROM my_table
    WHERE MOD(my_column, 2) = 1;

    If on the other hand you simply would like to display every other record that is otherwise returned by the query, you can use this:

    SELECT * FROM
    (SELECT ROWNUM rn, x.* FROM my_table x)
    WHERE MOD(rn, 2) = 1;

    What is the maximum number of triggers we can write on a table?
    Don't think there is a limit on this (at least not a practical one).
    Last edited by jmodic; 02-17-2004 at 04:37 AM.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    1) something like:
    Code:
    select * from
    (select a.*, Rownum row_number
     from my_table a)
    where mod(row_number,2)=1
    2) since you can't determine the sequence of triggers firing, I'd prefer one trigger which calls a heap of procedures.

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