Results 1 to 2 of 2

Thread: Apply distinct

  1. #1
    Join Date
    Feb 2004
    Location
    Jordan
    Posts
    137

    Red face Unanswered: Apply distinct

    Hi all

    I have a form with 2 non-Database fields (:item1 , :item2), and Grid based on a view and a button,
    when I press the button I change the where clause using:

    set_block_property(block1, default_where, 'field1 = :item1 and field2 = :item2');

    some rows come duplicated, how I can apply distinct

    thanx in advance

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    They would be duplicated anyway; your SET_BLOCK_PROPERTY has nothing to do with it.

    How to fix it? You'll have to change data source. Now it is ... what? A table? If so, you could try to create a view as SELECT DISTINCT FROM YOUR_TABLE and base form's data block on that view. If you'd like to perform updates and inserts, consider use of the INSTEAD OF trigger. Also, you'll probably have to code form's ON-INSERT, ON-UPDATE and ON-DELETE triggers.

    Or, create a (stored) procedure and base a form data block on the procedure. The procedure should return a PL/SQL (index-by) table. In that case, you could even pass "item1" and "item2" values to the procedure so that it'll return desired records. Of course, you'd still have to use DISTINCT in the procedure's SELECT statement.

    Or, base the block on the FROM clause. You can use SELECT DISTINCT in there as well.

    I can't think of any other option at the moment.

Posting Permissions

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