MEMBER

MEMBER is a keyword used within SQL. It refers to a specific element within an object, typically associated with the object-oriented features of SQL. It's utilized to access functions or procedures that are part of a type or object in SQL. The MEMBER keyword helps in using these incorporated functions or procedures in object-relational SQL databases.

Example

DECLARE
TYPE num_tab IS TABLE OF NUMBER
INDEX BY VARCHAR2 (64);
nt1 num_tab;
BEGIN
nt1('one') := 1;
nt1('two') := 2;
nt1('three') := 3;
IF nt1.EXISTS('two') THEN
DBMS_OUTPUT.PUT_LINE('Element exists');
END IF;
IF nt1.MEMBER('four') THEN
DBMS_OUTPUT.PUT_LINE('Element does not exist');
END IF;
END;

Output

Element exists

Explanation

In the example code, num_tab is a hash-indexed collection of numbers indexed by varchar2. The EXISTS method is used to check if an index is part of the collection and returns true if it does exist, resulting in the print of ‘Element exists’. The MEMBER method is used to check if a value is a member of the collection. However, ‘four’ is not a member of the collection, thus the related output is not printed.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.