Re: Forms 4.5: Select distinct...!!

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/08/08
Message-ID: <5sf2vh$1f7_at_camelot.dsccc.com>#1/1


Here is a code snippet to go into a PRE-QUERY trigger. Change the first IF statement to do whatever you want.  

BEGIN
  DECLARE
    block_id Block := find_block('OBJ');     sub_where VARCHAR2(512);
    def_where VARCHAR2(512);  

    FUNCTION add_and(
      P_WHERE IN VARCHAR2
    ) RETURN VARCHAR2 IS
    BEGIN

      IF (nvl( length(P_WHERE), 0) != 0) THEN
        RETURN( P_WHERE || ' and ');
      ELSE
        RETURN( P_WHERE );
      END IF;

    END;     BEGIN       sub_where := NULL;
    IF (:OBJ.DSP_LOGIN_NAME IS NOT NULL) THEN
      sub_where := add_and( sub_where ) || '(LOGIN_NAME like '''||
          :OBJ.DSP_LOGIN_NAME || ''')';

    END IF;  
     if def_where is not null then
        sub_where := def_where ;
        def_where := get_block_property (block_id, DEFAULT_WHERE) ;
        def_where := add_and (def_where) || sub_where  ;
     end if ;
 

    set_block_property(block_id, DEFAULT_WHERE, def_where);  

  END;
END; Stuart Turton (sturton_at_maderich.demon.co.uk) wrote:
: 1) Frig the SQL statement to be come a UNION or MINUS statement:
: You can do this by appending something like
: ' UNION SELECT .... from <table-name> WHERE 1 = 2';
 

: 2) Put something in you POST-QUERY trigger which compares the current
: record with the previous record and fail if they match.
 

: Claude Ramazzini wrote:
: >
: > Hi everybody,
: > do someone know how to do a SELECT DISTINCT
: > into forms 4.5? I know that we can control in the properties of the bloc
: > the ORDER BY and the WHERE clause, but is there a trick to modify the
: > SELECT statement of Oracle to introduce the DISTINCT clause?
: >
: > Thanking you in advance,
: >
: > Claude Ramazzini
: > Production Engineer
: > airborne_at_sympatico.ca
: > Airborne Gear and Mach. Ltd
: > tel: (514) 325-9000 ext. 4
: > fax: (514)325-3265
: >
: > ** If there is so many things to configure in Linux, maybe this is because
: > it is doing so much.

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Fri Aug 08 1997 - 00:00:00 CEST

Original text of this message