To add an item to the set
update TABLE set COLUMN = COLUMN |  NUM
  where NUM is the bit value of the element from the CREATE stmt.

To remove it:
update TABLE set COLUMN = COLUMN & ~NUM

For your example on

SET("dog", "cat", "rat")
Where you currently have "dog,cat"

To add rat
update t set pets = pets | 4

To remove cat,
update t set pets = pets & ~2

Can't do it with strings (or the value type of the field,) except via concat. 



>It works, but is that the canonical way to do this?
>
>  
>
No.


>Also, since this field is a set, I'm curious to know how to do some  
>of the other set operations:
>  add, delete, sort, count, find, union, intersect
>
>  
>
Sets are by def. unordered. Sets actually store the numeric value
(1,2,4,8.16) of each set position.

select pets+0 from t;
|pets+0|
   3

You can perform binary ops on them: E.g.
select * from t where )pets & (1+2+4) <> 0)

Otherwise those keywords, if they exist would apply to row ops.

-- 
Ed Howland
WDT Solutions, LLC.
[EMAIL PROTECTED]
(314) 962-0766

 
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to