pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Query on array-elements inside object
2+ messages / 2 participants
[nested] [flat]

* Query on array-elements inside object
@ 2000-09-05 03:12 Umashankar Kotturu <adityauma@hotmail.com>
  2000-09-05 18:03 ` Re: Query on array-elements inside object Jie Liang <jliang@ipinc.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Umashankar Kotturu @ 2000-09-05 03:12 UTC (permalink / raw)
  To: pgsql-sql@hub.org

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.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Query on array-elements inside object
  2000-09-05 03:12 Query on array-elements inside object Umashankar Kotturu <adityauma@hotmail.com>
@ 2000-09-05 18:03 ` Jie Liang <jliang@ipinc.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jie Liang @ 2000-09-05 18:03 UTC (permalink / raw)
  To: Umashankar Kotturu <adityauma@hotmail.com>; +Cc: pgsql-sql@hub.org

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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-09-05 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-05 03:12 Query on array-elements inside object Umashankar Kotturu <adityauma@hotmail.com>
2000-09-05 18:03 ` Jie Liang <jliang@ipinc.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox