Received: from tidal.ipinc.com (tidal.ipinc.com [199.245.188.85]) by hub.org (8.10.1/8.10.1) with ESMTP id e85I60B41587 for ; Tue, 5 Sep 2000 14:06:00 -0400 (EDT) Received: from ipinc.com (jliang.ipinc.com [199.245.188.130]) by tidal.ipinc.com (8.9.3/8.9.3) with ESMTP id LAA62882; Tue, 5 Sep 2000 11:05:40 -0700 (PDT) (envelope-from jliang@ipinc.com) Message-ID: <39B5356C.6385103A@ipinc.com> Date: Tue, 05 Sep 2000 11:03:25 -0700 From: Jie Liang Organization: ipinc.com X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Umashankar Kotturu CC: pgsql-sql@hub.org Subject: Re: Query on array-elements inside object References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200009/21 Hi, there I believe that if you create a function with PL/pgSQL that take a text array as parameter: create function cancer(_text) returns bool as ' declare ..... begin use a while loop here to scan the whole array if string match 'cancer' immediately return true otherwise end the loop return false end; ' language 'plpgsql'; Umashankar Kotturu wrote: > Hi, > > I am new to Postgres as well as object database. Wondering if one of you can > tell me on how to write a sql query to select an object that has a > particular element in an array. > > Example > > If I create an object-table with 2 elements. > a) PatientID -> numeric > b) DiseaseArray -> array of text > > - This DiseaseArray has elements like "cancer", "tb" etc... > > Now how will I write a sql-query to select all patients that have "cancer" > > Any pointers will be helpful. > > regards, > Uma. > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > Share information about yourself, create your own public profile at > http://profiles.msn.com. -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 jliang@ipinc.com www.ipinc.com