ORA-29908: missing primary invocation for ancillary operator

前提是你 提交于 2019-12-11 04:01:55

问题


I have an error that I can't seem to figure out. Anyone has an idea what I'm doing wrong here? Please assume that images has place, subject, description, and testing appears several times in subject or place or description. Also, I did set the ConText initialization parameter TEXT_ENABLE to be true.

SELECT 4*SCORE(1) + 2*SCORE(2) + SCORE(3) AS RANK
FROM   images i
WHERE  CONTAINS(i.subject, 'testing', 1)>0
OR  CONTAINS(i.place, 'testing', 2)>0
OR  CONTAINS(i.description, 'testing', 3)>0
ORDER BY RANK;

回答1:


I manged to solve the problem by surrounding the current query with another query and pulling the ORDER BY RANK to the outside query. Like so:

SELECT * 
FROM (SELECT 4*SCORE(1) + 2*SCORE(2) + SCORE(3) AS RANK
      FROM   images i
      WHERE  CONTAINS(i.subject, 'testing', 1)>0
      OR  CONTAINS(i.place, 'testing', 2)>0
      OR  CONTAINS(i.description, 'testing', 3)>0)
ORDER BY RANK;



回答2:


I can't reproduce on 10.2.0.4. What is your DB version?

test script:

CREATE TABLE text_data (
   txt1 VARCHAR2(4000), 
   txt2 VARCHAR2(4000), 
   txt3 VARCHAR2(4000)
);
INSERT INTO text_data 
   (SELECT text, text, text FROM all_source WHERE ROWNUM <= 1e4);

CREATE INDEX txt1 ON text_data (txt1) INDEXTYPE IS ctxsys.context;
CREATE INDEX txt2 ON text_data (txt2) INDEXTYPE IS ctxsys.context;
CREATE INDEX txt3 ON text_data (txt3) INDEXTYPE IS ctxsys.context;

SELECT 4 * SCORE(1) + 2 * SCORE(2) + SCORE(3) AS RANK
  FROM text_data i
 WHERE CONTAINS(i.txt1, 'FUNCTION', 1) > 0
    OR CONTAINS(i.txt2, 'FUNCTION', 2) > 0
    OR CONTAINS(i.txt3, 'FUNCTION', 3) > 0
 ORDER BY RANK;


来源:https://stackoverflow.com/questions/8352796/ora-29908-missing-primary-invocation-for-ancillary-operator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!