CONTAINS clause and the ORA-29902 error.

Hello folks,
I am encountering the following error in APEX.
report error:
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-10825: stored query does not exist: employee
DRG-10825: stored query does not exist: employee
Here is the rest of the information :
1. I have created the index on the column in question as specified here.
bq. {color:#0000ff} CREATE INDEX{color} \\ {color:#0000ff} \\ emp_idx ON meta_eul (display_name){color} \\ {color:#0000ff} \\ indextype is ctxsys.context; \\ {color}
2. I have created the sqe for the word as suggested [here |http://download-west.oracle.com/docs/cd/B19306_01/text.102/b14218/cqrypkg.htm#i997218]: employee
bq. {color:#0000ff} begin{color} \\ {color:#0000ff} \\ ctx_query.store_sqe('employee', 'empl or emp');{color} \\ {color:#0000ff} \\ end;{color}
3. When I execute the following sql in sql developer, I get results
bq. {color:#0000ff} SELECT SCORE(1), A.DISPLAY_NAME \\ FROM meta_eul a \\ WHERE 1 =1 \\ AND CONTAINS(A.DISPLAY_NAME , 'sqe(employee)', 1)> 0 \\ ORDER BY SCORE(1) \\ {color}
4. I have the same query in #3 above as a region in my Page.
When I execute it, I get the error that I have mentioned above.
Any thoughts ? Is this a limitation ?
I am on Apex version 3.0
Regards,
Atul

Thanks, Roel.
A similar option that worked out as an alternative is that I have changed the region code to :
bq. {color:#0000ff}SELECT SCORE(1), A.DISPLAY_NAME \\     FROM meta_eul a \\     WHERE 1 =1 \\     AND CONTAINS(A.DISPLAY_NAME , 'emp or empl or employee', 1)> 0 \\     ORDER BY SCORE(1) \\ {color}
and have avoided the sqe part. This doesn't seem to have an issue in Apex.

Similar Messages

  • ORA-29902 error with CONTAINS()

    Hello,
    I have trouble using the CONTAINS() function on an indexed document.
    I created the index with
    create index ikenndatenTextIndex
    on kenndaten_as_column_500 x (kenndaten)
    indextype is ctxsys.context
    +++++++++++++++++++++++++++++++++++++++++++++
    with Result:
    Index created
    +++++++++++++++++++++++++++++++++++++++++++++
    where the column "kenndaten" contains XMLType Documents
    Now, typing in isqlplus:
    select extract(x.kenndaten,'/kenndaten/schlagworte')
    from kenndaten_as_column_500 x
    WHERE CONTAINS(kenndaten,'$("taken") INPATH (/kenndaten/schlagworte)') > 0;
    ++++++++++++++++++++++++++++++++++++++++++++++++++++
    gets the desired result:
    EXTRACT(X.KENNDATEN,'/KENNDATEN/SCHLAGWORTE')
    <schlagworte>group an corporate the taken </schlagworte>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++
    Here is the Problem:
    If I do not look for "taken" but for "was":
    select extract(x.kenndaten,'/kenndaten/schlagworte')
    from kenndaten_as_column_500 x
    WHERE CONTAINS(kenndaten,'$("was") INPATH (/kenndaten/schlagworte)') > 0;
    ++++++++++++++++++++++++++++++++++++++++++++++++++++
    I get:
    select extract(x.kenndaten,'/kenndaten/schlagworte')
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    Using {was} instead of "was", typing \w\a\s or simply using ...CONTAINS(kenndaten,'$(was) INPATH...
    gets the same result
    I have no problem looking for words like "and","or","inpath" and the like
    Any ideas?
    Gregor Heuer

    HI,
    I don't know very well Oracle Text, but perhaps the next doc could you help on this one :
    http://www.oracle.com/technology/products/text/index.html
    http://www.oracle.com/technology/oramag/oracle/04-sep/o54text.html
    Nicolas.

  • CONTAINS clause and keywords

    We have an application which uses context indexes, and a user ran the following query today which resulted in an error:
    select *
    from paghtrd a
    where CONTAINS(A.NAME, 'ALL ABOUT AUTOS') > 0;
    SQL Error: ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-50901: text query parser syntax error on line 1, column 11 It's because "ABOUT" is a keyword. For instance, the following runs without a problem
    select *
    from paghtrd a
    where CONTAINS(A.NAME, 'ABOUT (AUTO)') > 0How do people handle these keyword entries? Does your interface strip them out when building the SQL?
    Thanks,
    --=Chuck

    You need to escape the reserved words if you want to use them in your search term.
    If they are single character reserved symbols like '&' then you can use backslash like this '\&'
    If ther are reserved words like ABOUT,ACCUM, AND ,FUZZY then you need to use curly brackets {} to escape them.
    >
    So does your interface do a "search & replace" on keywords, before inserting a user's entry into a CONTAINS( ) clause? "ABOUT" is only one of many keywords.
    >
    No, When you escape a reserved word, When reading the search term it simply treats it as a normal word.
    G.

  • ORA-29902: error in executing ODCIIndexStart() routine

    Hi,
    I have a problem with my text mining application.
    when I start the classification procedure I get the following errors
    Error executing statement: ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-50857: oracle error in drcs_query
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "CTXSYS.DRVODM", line 676
    ORA-01426: numeric overflow
    ORA-06512: at line 1
    After closing and restarting the SQL Navigator, most times it works again, but not every time.
    Here is the procedure I use:
    PROCEDURE sp_classify
    IS
    vc2_sqlcommand VARCHAR2(1000);
    guete DBMS_SQL.number_table;
    branche DBMS_SQL.varchar2_table;
    BEGIN
    vc2_sqlcommand := 'ALTER TABLE ergebnisse MOVE TABLESPACE xxx;
    execute IMMEDIATE vc2_sqlcommand;
    n_matchscore := 20;
    INSERT INTO ergebnisse
    SELECT rt.cat_id, pt.produktions_id, match_score(1) AS MatchScore
    FROM produktionsdaten pt, trainingsregeln rt
    WHERE matches ( rt.rule, pt.geschaeftsgegenstand, 1) > n_matchscore;
    COMMIT;
    vc2_sqlcommand :=
    'CREATE INDEX I_ERG_PRODID ON ERGEBNISSE ' ||
    '( PRODUKTIONS_ID ASC ) ' ||
    'TABLESPACE XXX' ||
    'STORAGE ( INITIAL 64K ' ||
    'NEXT 64K ' ||
    'PCTINCREASE 0 ' ||
    execute IMMEDIATE vc2_sqlcommand;
    Please help me
    Greetz Steffi Schweppe
    Message was edited by:
    user634781

    I agree with Omar, However if you want to search using special character, you may want to look into the following example. I am not saying this may be a solution for you, however this may give you a start on how to deal with special character in you search.
    In our enviroment we have "N" number of Science & Pharmacy & Chemical clients. They need the ability to search using special character for that we have done the following..
    begin
    select user into v_username from dual;
    ctx_ddl.create_preference('orc_CTX_WLPREF', 'BASIC_WORDLIST');
    ctx_ddl.set_attribute('orc_CTX_WLPREF','SUBSTRING_INDEX','TRUE');
    ctx_ddl.set_attribute('orc_CTX_WLPREF','WILDCARD_MAXTERMS','2559');
    ctx_ddl.Create_Preference('orc_LEXER','BASIC_LEXER');
    ctx_ddl.Set_Attribute('orc_LEXER', 'index_themes', 'FALSE');
    ctx_ddl.set_attribute('orc_LEXER','printjoins','0123456789%,./?;:<>[]{}\|+=-_()*&^$#@!''"%');
    end;
    And then siply create the index as follow..
    create index index_name on activitylog(columnname)
    indextype is ctxsys.context
    parameters ('Wordlist CYBERLAB_CTX_WLPREF lexer CYBERLAB_LEXER memory 48M');
    then I am able to do something like the following..
    select count(*) from ACTIVITYLOG where contains (DESCRIPTION, '<%.htm@') > 0;
    hope this helps..

  • ORA-20001: ORA-29902: error in executing ODCIIndexStart() routine

    Hi, everyone!
    I have an error as follow:
    ORA-20001: ORA-29902: error in executing ODCIIndexStart() routine
    ORA-06553: PLS-123: program too large
    I can get the sql where the procedure through the error, and execute the sql in sqlplus, no error. Does anyone have experience with the error? or have some direction to solve problem? thank you!
    My oracle version is 9.2.0.8.0 and sdo version is 9.2.0.8.0, too.

    I agree with Omar, However if you want to search using special character, you may want to look into the following example. I am not saying this may be a solution for you, however this may give you a start on how to deal with special character in you search.
    In our enviroment we have "N" number of Science & Pharmacy & Chemical clients. They need the ability to search using special character for that we have done the following..
    begin
    select user into v_username from dual;
    ctx_ddl.create_preference('orc_CTX_WLPREF', 'BASIC_WORDLIST');
    ctx_ddl.set_attribute('orc_CTX_WLPREF','SUBSTRING_INDEX','TRUE');
    ctx_ddl.set_attribute('orc_CTX_WLPREF','WILDCARD_MAXTERMS','2559');
    ctx_ddl.Create_Preference('orc_LEXER','BASIC_LEXER');
    ctx_ddl.Set_Attribute('orc_LEXER', 'index_themes', 'FALSE');
    ctx_ddl.set_attribute('orc_LEXER','printjoins','0123456789%,./?;:<>[]{}\|+=-_()*&^$#@!''"%');
    end;
    And then siply create the index as follow..
    create index index_name on activitylog(columnname)
    indextype is ctxsys.context
    parameters ('Wordlist CYBERLAB_CTX_WLPREF lexer CYBERLAB_LEXER memory 48M');
    then I am able to do something like the following..
    select count(*) from ACTIVITYLOG where contains (DESCRIPTION, '<%.htm@') > 0;
    hope this helps..

  • SQL Error: ORA-29902: error in executing ODCIIndexStart() routine

    I am running a SDO_RELATE operation on 2 geometries from 2 different tables. Spatial indexes are already created and the tables are also versioned.
    Below is the spatial meta data for both the geometries in user_sdo_geom_metadata table:
    DIMINFO is :
    MDSYS.SDO_DIM_ELEMENT(MDSYS.SDO_DIM_ELEMENT(Easting,0,700000,0.001),MDSYS.SDO_DIM_ELEMENT(Northing,0,1300000,0.001),MDSYS.SDO_DIM_ELEMENT(Height,-100,2000,0.001))
    SRID is 27700
    When I use SDO_RELATE or ADO_ANYINTERACT on both the geometires, i am getting the below error.
    Error report:
    SQL Error: ORA-29902: error in executing ODCIIndexStart() routine
    ORA-13243: specified operator is not supported for 3- or higher-dimensional R-tree
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 333
    29902. 00000 - "error in executing ODCIIndexStart() routine"
    *Cause:    The execution of ODCIIndexStart routine caused an error.
    *Action:   Examine the error messages produced by the indextype code and
    take appropriate action.
    Could you please let me know what should be the root cause for this issue?

    Hi
    Have you checked this posting?
    Re: ORA-13243
    Luc

  • ORA-29902 ERROR  on a querry

    We get this error with the following querry:
    SELECT
    DISTANCE FROM DIST_PTS
    WHERE (CLLI = 'CHCGILCL') AND (MDSYS.SDO_NN (GEOLOC,
    MDSYS.SDO_GEOMETRY (2001, NULL,
    MDSYS.SDO_POINT_TYPE (-87.63804626464844, 41.879520416259766, NULL),
    NULL, NULL), 'SDO_NUM_RES=1') = 'TRUE');
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-13236: internal error in R-tree processing: [failed to allocate memory]
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 84
    ORA-06512: at line 1
    Our table has 25 million records and we are using Oracle 8.1.7
    We were getting this error with 8.1.6 and were advised to upgrade. We did but we get the same error. Has anyone seen this ?

    I am getting a similar error code trying to run the "Nearest
    Neighbor" sample code:
    error message:
    ORA-29902: error in executing ODCIindexStart()routine
    ORA-13207: incorrect use of the [NO UNITS SUPPORTED] operator
    ORA-06512: at "MYSYS.SDO_INDEX_METHOD" line 83
    partial code:
    v_latlong := v_latlong.findlocation();
    if v_latlong.numTotalCand > 0 then
    v_lat := v_latlong.getLatitude(1);
    v_long := v_latlong.getLongitude(1);
    found3 := FALSE;
    dist := .25;
    while found3 = false loop
    dist := dist + .25;
    select a, b, c INTO r_a, r_b, r_c from atable where
    SDO_WITHIN_DISTANCE(atable.GEOLOC,MDSYS.SDO_GEOMETRY
    (2001,NULL,MDSYS.SDO_POINT_TYPE(v_long,v_lat,NULL),NULL,NULL),
    'distance = dist, Unit=MILE, layer_gtype = POINT')
    = 'TRUE';
    cnt := cnt + 1;
    end loop;
    if cnt >= 2 then
    found3:= TRUE;
    end if;
    The only references I am finding to the ODCI Index is in the
    Oracle Data Cartridge Developers manual. SInce I am not
    developing a Data Cartridge, I am assuming the error is coming
    from either the Oracle Geocoder or the MapInfo implementation of
    that. In either case I do not see how I can correct the
    problem.
    Is the suggestion that there might be a problem with the
    geometry (in my case both are x,y points)?
    Thank you for any help

  • ORA-29902 Error when executing context query

    We sometimes get the following error when executing a search based on keywords entered by a user:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Error generating context stmt ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: interMedia Text error: DRG-50901: text query <HR></BLOCKQUOTE>
    A demonstration of the error can be seen by going to the main
    http://technet.oracle.com technet page and then performing a site search. Type in any of the following search phrases:
    Oracle and not Microsoft
    not Microsoft
    and database
    In my brief experimentation, the presence of any of
    not, and, or
    at the beginning of the keywords, or next to each other 'and not' within the keywords set causes the above oracle error.
    OK, I could train the users not to do this, but with the potential for every net user on the planet using my site, it might take me some time to speak to all of them.
    So how do I stop Intermedia from throwing up the error? I have written a quick parser to try to strip out offending entries, but that is not, imho, a good solution, as I do not know all the rules that will break it.
    tia

    You need to write a text query parser. Check the Query Translator code samples from http://technet.oracle.com/sample_code/products/text/content.html

  • How to solve the ora-12516 error

    Hi,
    I'm sorry to say that I have a problem which should be solved as quickly as possible. Can you help me ? The problem is as follows:
    os:windows 2000
    db version:Oracle Database 10g Express Edition&#12303;(XE)
    After using for a while, the ora-12516 error occurs. However, scores of minutes later, the error can be solved automatically. How to avoid this kind of error ?
    Thank you.

    Are you connecting and disconnecting many times quickly?
    You may be hitting the problem where the listener thinks the database has run out of connections because the database doesn't inform the listener that connections have been closed fast enough.
    Try increasing the value of the processes parameter in the database.

  • I just restored my computer to the beginning and I did backup my files but when i tried to restore them i wouldn't work, then I tried to do it manually and the was an error. I really want my shows that I downloaded back can i redownload them?

    I just restored my computer to the beginning and I did backup my files but when i tried to restore them i wouldn't work, then I tried to do it manually and the was an error. I really want my itunes files that I downloaded back can i redownload them?

    If you are in the US then yes, you should be able to re-download them, as long as they are still in the store and you use the same iTunes account as your originally used to buy them : re-downloading
    If you are not in the US then they cannot currently be re-downloaded. Have you not got a different backup of your purchases that you could try copying them back from ?

  • I just updatet my Iphone 4S to IOS6 and the where a error, and now itunes telling me I need to recover my Iphone to use my Iphone and to recover I will lose all my media files and other files! this is an disaster! What can I do? MY IPHONE DON'T EVEN WORK!

    I just updatet my Iphone 4S to IOS6 and the where a error, and now itunes telling me I need to recover my Iphone to use my Iphone and to recover I will lose all my media files and other files! this is an disaster! What can I do?
    EVEN MY IPHONE DON'T WORK ANYMORE !! NOO!!

    I exactly have the problem. Tried to get help from AT&T and Apple. Still no solution...

  • I have 3 songs that will not download and the volume of error messages from Itunes about these "3" is annoying. I know my way around Itunes but cannot find a way to delete them and stop these Itunes download error messages.

    I have 3 songs that will not download and the volume of error messages from Itunes about these "3" is annoying. I know my way around Itunes but cannot find a way to delete them and stop these Itunes download error messages.
    Thank you.

    Thanks Mohammad - much appreciated.
    I also got a response from Apple who said that there was a problem related to fonts and the encryption.xml file
    Once we'd removed this we were able to upload the epub no problem.
    It's odd that the system seems to say that all is okay when it isn't. We have to rely on guesswork rather a lot using iBook Producer.
    Anyway, all sorted now and thank you again for your contribution.
    Best wishes and a Happy New Year!
    Sue

  • To_number function and the "invalid number" error

    Dear all,
    I have searched the forum for threads relating to the ORA-01722: invalid number error, could not find the answer I am looking for.
    What I was trying to do was
    select * from table1 where to_number(field1) > 1000
    field1 is a varchar2 data type.
    I tried all sorts of things i.e using fmt, nls params as defined in the documentation, nothing worked.
    Though the practical problem was solved by
    select * from table1 where field1 > '1000'
    I would still like to know why this error occurs. Can someone help ?
    Regards
    Crusoe

    I think the database engine should simply return the rows that successfully convert to number and meet the where condition Oracle does not work in that way ;)
    Then try this...
    Just you need to add the below where clause to your source query. as this will retrieve only the number, to_number should work without any problem.
    But still you have to create a subquery to escape the invalid number error.
    PRAZY@11gR1> select * from tablea;
    FIELD1
    123
    123.345
    45
    AVC
    23.234.234
    ABC.234
    345.45
    7 rows selected.
    Elapsed: 00:00:00.00
    PRAZY@11gR1> select to_number(field1) from tablea where  rtrim(trim(regexp_replace(field1,'\.','',1,1)),'0123456789') is null;
    TO_NUMBER(FIELD1)
                  123
              123.345
                   45
               345.45
    4 rows selected.
    Elapsed: 00:00:00.01Regards,
    Prazy
    Edited by: Prazy on Mar 23, 2010 4:00 PM

  • Question on using Distinct operator and avoiding ORA-00936 error

    I may have answered my own question, by searching the OTN forums, but I just want to confirm what I've learned.
    I'm trying to use a distinct on one of my columns, where I am pulling multiple columns, and trying to avoid duplicate entries. From most of my textbook example, when an example is using a distinct, they were only pulling one column.
    From my example below, when I try to use a distinct, I get the following error: ORA-00936: missing expression:
    select p.list_id, distinct(p.associate_id), d.first, d.last, c.street1, c.street2, c.city, c.state, c.country, c.postal_code, c.email
    from sf.profiles p, demographics d, contact_info c
    where p.entity_id = d.entity_id
    and p.entity_id = c.entity_id
    and p.list_id = 111
    and associate_id in (insert associate_id in here
    );Once I searched OTN, I saw some examples, where they had the distinct operator as the first column. So I switched it with p.list_id, and the query ran find.
    select distinct p.associate_id, p.list_id, d.first, d.last, c.street1, c.street2, c.city, c.state, c.country, c.postal_code, c.email
    from sf.profiles p, demographics d, contact_info c
    where p.entity_id = d.entity_id
    and p.entity_id = c.entity_id
    and p.list_id = 111
    and associate_id in (insert associate_id in here);So, does the distinct operator have to go first, if using multiple columns?
    thanks
    Message was edited by:
    cmmiller

    With or without parenthesis, it's a distinct clause for all columns in select statement:
    SQL> select * from tt1;
            ID T
         10203 1
         10203 2
    SQL> select distinct(id), text from tt1;
            ID T
         10203 1
         10203 2
    SQL> select id, text from tt1;
            ID T
         10203 1
         10203 2
    SQL> Nicolas.

  • Pipelined function with Union clause(Invalid Number(ORA-01722) error )

    Hi,
    I have a pipelined function.
    I am fetching the data with the use of a REF cursor.
    The query has two part: query1 and query2
    when I am opeing the cursor with query1 UNION query2,it is giving me Invalid Number(ORA-01722) error.
    but when I open the cursor separately for query1 and query2,I am getting the resultset for each of the query.
    query1 and query2 are running fine with UNION in the sql editor.
    But,when I put them into two variables (var1 :='query1' and var2:='query2' and try to open the cursor with var1 UNION var2 , it's giving me the error.
    But when I put query2 as 'Select ..... from dual' and then try to open the cursor for query1 UNION query2,
    then getting the result of query1 and one extra row for query2(dual).
    The FROM table set is same for query1 and query2..
    can anyone please help me , why this Invalid Number(ORA-01722) error is coming.

    query1 := 'SELECT to_char(st.store_no) STORE_NUMBER,pp.name PROGRAM_NAME, ''HBS'' DISPENSING_SYSTEM,
    pt.PATIENT_SRC_NO SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, pt.last_name PATIENT_LAST_NAME, pt.first_name
    PATIENT_FIRST_NAME, to_char(LPAD (pppd.rx_number, 7, '' '')|| ''-''|| LPAD (pppd.refill_number, 2, 0)) RX_REFILL
    FROM
    pega_patient_program_dispense pppd,pega_patient_program_reg pppr,health_care_profs hcp1,
    health_care_profs hcp2,prescription_dispenses pd,prescriptions p, pega_program_status_reason ppsr ,master_doctors md,
    prescription_disp_orders pdo, hbs_shipment_extract hse,stores st,master_stores ms,pega_programs pp,patients pt,master_patients mpt
    WHERE
    pppr.referring_hcp_id=md.id(+) and md.dispensing_system_id=hcp1.hcp_id and
    pppr.ID=pppd.PEGA_PATIENT_PROGRAM_REG_ID and pppd.prescription_dispense_id=pd.id and pd.prescriptions_id=p.id and
    p.hcp_id=hcp2.hcp_id and ppsr.ID=pppd.PEGA_PROGRAM_STATUS_REASON_ID and pppd.prescription_dispense_id = pdo.prescriptions_dispenses_id(+) AND
    pdo.shipment_number = hse.shp_no(+) and pppd.store_id=ms.id and st.id=ms.dispensing_system_id and pppr.pega_program_id=pp.id
    and pppr.patient_id=mpt.id and pt.patient_id=mpt.dispensing_system_id and pppd.dispensing_system=''HBS'' and pp.name LIKE ''REV%''
    AND
    ((pppd.prescription_dispense_id IS NOT NULL AND pppd.quantity_dispensed &gt; 0 AND pppd.reported_date IS NULL AND
    pppd.src_delete_date IS NULL AND ((pppr.program_specific_patient_code IS NULL ) OR (hcp1.last_name IS NULL) OR
    (hcp1.first_name IS NULL) OR (hcp2.first_name IS NULL) OR (hcp2.last_name IS NULL) OR (hcp2.address_1 IS NULL) OR
    (hcp2.city IS NULL) OR (hcp2.state_cd IS NULL) OR (hcp2.zip_1 IS NULL)OR (pppr.referral_date is NULL) OR
    (hcp1.state_cd IS NULL) OR (hcp1.zip_1 IS NULL)
    OR (hcp2.zip_1 IS NULL) OR (pppr.last_status_change_date IS NULL) OR (pppr.varchar_1 IS NULL) OR
    (pppr.varchar_7 IS NULL OR pppr.varchar_7 LIKE ''NOT AVAILABLE AT REFERRAL%'') OR (pppr.varchar_5 IS NULL OR
    pppr.varchar_5 LIKE ''NOT AVAILABLE AT REFERRAL%'')) ) AND ppsr.INCLUDE_ON_EXCEPTION_RPT_IND=''Y'')
    OR
    ((pppd.authorization_number IS NULL OR NVL(TRUNC(pdo.shipped_date),TRUNC(hse.shp_act_date_dt)) NOT BETWEEN
    TRUNC(pppd.date_1) AND TRUNC(pppd.date_2)) OR (pppd.varchar_4 IS NULL OR NVL(TRUNC(pdo.shipped_date),
    TRUNC(hse.shp_act_date_dt)) NOT BETWEEN TRUNC(pppd.date_3) AND TRUNC(pppd.date_5)))
    OR
    (pppr.pega_program_competitors_id IS NULL AND (ppsr.manufacturer_status=''TRIAGE'' AND ppsr.manufacturer_reason=''COMPETITOR''))
    OR
    (ppsr.manufacturer_reason IS NULL)
    query2 := ' SELECT ''150'' STORE_NUMBER,''test'' PROGRAM_NAME , ''RX2000'' DISPENSING_SYSTEM
    ,''01'' SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, ''test'' PATIENT_LAST_NAME, ''test'' PATIENT_FIRST_NAME,
    ''rx01'' RX_REFILL
    FROM
    pega_patient_program_reg pppr,health_care_profs hcp1, pega_program_status_reason ppsr ,
    master_doctors md,stores st,master_stores ms,pega_programs pp,patients pt,master_patients mpt
    WHERE
    pppr.referring_hcp_id=md.id(+) and md.dispensing_system_id=hcp1.hcp_id and
    ppsr.ID=pppr.REFERRAL_STATUS_ID and st.store_type=''M'' and pppr.store_id=ms.id and st.id=ms.dispensing_system_id
    and pppr.pega_program_id=pp.id and pppr.patient_id=mpt.id and pt.patient_id=mpt.dispensing_system_id and pp.name LIKE ''REV%''
    AND
    ((((pppr.program_specific_patient_code IS NULL ) OR (hcp1.last_name IS NULL) OR (hcp1.first_name IS NULL) OR
    (pppr.referral_date is NULL) OR (hcp1.state_cd IS NULL) OR (hcp1.zip_1 IS NULL) OR (pppr.last_status_change_date IS NULL)
    OR (pppr.varchar_1 IS NULL) OR (pppr.varchar_7 IS NULL) OR (pppr.varchar_5 IS NULL OR pppr.varchar_5 LIKE
    ''NOT AVAILABLE AT REFERRAL%'')) ) AND ppsr.INCLUDE_ON_EXCEPTION_RPT_IND=''Y'')
    OR
    (pppr.pega_program_competitors_id IS NULL AND (ppsr.manufacturer_status=''TRIAGE'' AND ppsr.manufacturer_reason=''COMPETITOR''))
    OR
    (ppsr.manufacturer_reason IS NULL)
    AND
    pppr.id NOT IN(select pppd.PEGA_PATIENT_PROGRAM_REG_ID from PEGA_PATIENT_PROGRAM_DISPENSE pppd)';
    BUT IF I put
    query2 := ' SELECT ''150'' STORE_NUMBER,''test'' PROGRAM_NAME , ''RX2000'' DISPENSING_SYSTEM
    ,''01'' SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, ''test'' PATIENT_LAST_NAME, ''test'' PATIENT_FIRST_NAME,
    ''rx01'' RX_REFILL
    FROM DUAL';
    then it is giving result.

Maybe you are looking for