Looking for ORACLE/Sql Forms 3.0 help

From: Larry W. Virden <lwv27_at_cas.org>
Date: Wed, 15 Jan 1992 17:12:58 GMT
Message-ID: <1992Jan15.172205.8471_at_cas.org>


I am looking for ideas on resolving the following situation.

Imagine a pretty ugly form which would look like this:

Required 1: ________

Required 2: ________

Optional 3: ________

   Field 4: ________

Now, fields 1 and 2 are required values which will be entered by the user and used as a portion of the key. Field 3 is another member of the key. On the table in question, this field is permitted to have a NULL value.

I want to build a List of Possible Values window for Field 4, based on those entries from the table which match the key specified in fields 1 2 and 3.

I have tried this:

SELECT field4

	into :input.field4
	from mytable

	where (mytable.field1 = :input.field1 and
		mytable.field2 = :input.field2 and
		mytable.field3 = :input.field3)

	ORDER by field4

as the select. But the problem APPEARS to be that if :input.field3 has no value, then no hits will return. I tried to do this:

SELECT field4

	into :input.field4
	from mytable

	where (mytable.field1 = :input.field1 and
		mytable.field2 = :input.field2 and
		mytable.field3 = :input.field3) OR
	      (mytable.field1 = :input.field1 and
		mytable.field2 = :input.field2 and
		mytable.field3 IS NULL)
	
	ORDER by field4

and that results in:

o If field3 is NULL, the proper list is built,

o	If field3 is filled in, the proper list is built, IF anything
		is found.

o	If field3 is filled in with a value that isnt on the database
		(or probably if the other two are filled in likewise)
		then a list is generated as if the field had been
		empty.

Can anyone think of a way to get the last case to just generate an empty list or a 'No list available' type message?                 

-- 
Larry W. Virden			UUCP: osu-cis!chemabs!lwv27
Same Mbox: BITNET: lwv27_at_cas    INET: lwv27_at_cas.org
Personal: 674 Falls Place,   Reynoldsburg,OH 43068-1614
America Online: lvirden
Received on Wed Jan 15 1992 - 18:12:58 CET

Original text of this message