Xref: utzoo comp.databases:6475 bit.listserv.sqlinfo:43 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!blake.acs.washington.edu!callisto From: callisto@blake.acs.washington.edu (Finn) Newsgroups: comp.databases,bit.listserv.sqlinfo Subject: Re: How do I handle wide SQL-tables Message-ID: <5157@milton.u.washington.edu> Date: 17 Jul 90 04:51:17 GMT References: <1990Jul15.112644.676@resam.dk> Sender: news@milton.u.washington.edu Organization: University of Washington, Seattle Lines: 32 In article <1990Jul15.112644.676@resam.dk> andrew@resam.dk (Leif Andrew Rump) writes: > >The next question (I haven't got to that part of the manual yet so if you >are able to tell me where it is in Oracle 6.0 manual feel free to tell me!): >I use Pro*C and I want to be able to search on whatever the user enters, >like Name and birthdate (Born) or Name and Telefone# or ... Do I have to >make a SELECT for every possibility: > > select * from State where Name='Leif Andrew Rump' and Born='02-AUG-63'; > select * from State where Name='Leif Andrew Rump' and Telefon#='35822770'; > First off.. I am using SQL in RBASE 3.0 not ORACLE, but I have a similar situation. If the table is very wide at all, there will be an unacceptably large number of possible combinations of search criteria, so the select for every possibility is right out. What I did is have the user edit a form, filling in anything he knows about the data that he is looking for. I then construct a search string using each variable that is not null and then execute the search string. (RBASE allows this by using the command &VARNAME ) Other enhancements to think about are using the LIKE statement so you can search with .. Name like '%Rump%' If there is a numeric or date value, use a trigger to pup up a menu with operators if the value is filled in so you can get searches like ..Name like '%rump%' and BORN > '01-JAN-60' If this isn't clear, mail me and I'll return you the code in mail, it's a bit long to be publishing on the net.