PostgreSQL equivalent of Oracle "member of" - Mailing list pgsql-general

From Vadi
Subject PostgreSQL equivalent of Oracle "member of"
Date
Msg-id 20190329094424.12000.qmail@f4mail-235-128.rediffmail.com
Whole thread Raw
Responses Re: PostgreSQL equivalent of Oracle "member of"  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
Hi all

I would like to know if there is any equivalent in PostgreSQL for the Oracle "member of" syntax.

The usage is as shown below:

I have used the Oracle sample HR schema for the below example:

CREATE OR REPLACE TYPE params as table of varchar2 (100);
/

CREATE OR REPLACE function in_list (in_list in varchar2) return params pipelined as
param_list varchar2(4000) := in_list || ',';
pos number;
begin
loop
pos := instr(param_list, ',');
exit when nvl(pos, 0) = 0;
pipe row (trim(substr(param_list, 1, pos - 1)));
param_list := substr(param_list, pos + 1);
end loop;

return;
end in_list;

/

CREATE TABLE tname as
SELECT listagg(first_name, ', ') within group (order by first_name) first_name FROM employees;

SELECT * FROM tname;

SELECT * FROM employees
WHERE first_name member of in_list(first_name);

Any help is much appreciated.

Thanks in advance.

Regards
Vadi

pgsql-general by date:

Previous
From: Takuma Hoshiai
Date:
Subject: what case does xid wraparound warning messages like example emit?
Next
From: Karsten Hilbert
Date:
Subject: Re: Key encryption and relational integrity