日期:2014-05-17 浏览次数:20836 次
CREATE TABLE tableA(num NUMBER(5),id VARCHAR2(50),yesorno VARCHAR2(1)); INSERT INTO tablea(num,id) VALUES(1,'1,5,8'); INSERT INTO tablea(num,id) VALUES(2,'2,5,9'); INSERT INTO tablea(num,id) VALUES(3,'4,22'); INSERT INTO tablea(num,id) VALUES(4,'3,5,-9'); INSERT INTO tablea(num,id) VALUES(5,'2,4,3,6'); INSERT INTO tablea(num,id) VALUES(5,'2,4,3,6'); INSERT INTO tablea(num,id) VALUES(6,'10,20'); CREATE TABLE tableb(id2 number(2)); INSERT INTO tableb VALUES(1); INSERT INTO tableb VALUES(2); INSERT INTO tableb VALUES(3); INSERT INTO tableb VALUES(4); INSERT INTO tableb VALUES(5); INSERT INTO tableb VALUES(6); INSERT INTO tableb VALUES(7); INSERT INTO tableb VALUES(8); INSERT INTO tableb VALUES(9); UPDATE tablea SET yesorno='y' WHERE NOT EXISTS (SELECT 1 FROM TABLEb WHERE InStr(','||tablea.id||',',','||tableb.id2||',')>0); UPDATE TABLEa SET yesorno='n' WHERE yesorno IS NULL;
------解决方案--------------------