Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> ORA-00936 from Oracle Web Server
Why do I get this error?
I'm using dbms_sql to do a dynamic query based on user input. Here is the
code:
i_query2 := 'SELECT COUNT(wa_request_id) FROM out_wa_interface ';
i_query2 := i_query2||'WHERE wa_case_id IN (SELECT tk_out_wa_cases.case_id
FROM tk_out_wa_cases ';
i_query2 := i_query2||i_WHERE_prob||') AND '||i_WHERE_time;
htp.p('<b>call_count:</b> '||i_query2||'<p>'); -- enable for debugging
cursor2 := dbms_sql.open_cursor;
dbms_sql.parse(cursor2,i_query2,dbms_sql.v7);
dbms_sql.define_column(cursor2,1,call_count);
ret_val := dbms_sql.execute(cursor2);
ret_val := dbms_sql.fetch_rows(cursor2);
dbms_sql.column_value(cursor2,1,call_count); dbms_sql.close_cursor(cursor2);
i_WHERE_prob and i_WHERE_time are going to vary each time, but the resulting
SQL is similar to this:
SELECT COUNT(wa_request_id) FROM out_wa_interface WHERE wa_case_id IN
(SELECT tk_out_wa_cases.case_id FROM tk_out_wa_cases WHERE
tk_out_wa_cases.product like '%Phaser 550%') AND created_dt BETWEEN
('06-MAY-98 ') AND ('06-OCT-98 ')
When I run this with SQL Plus 3.3 or SQL Navigator 3.0, it works every time.
If I run this using Oracle Web Server I always get an ORA-00936 error
message:
ORA-00936: missing expression SELECT COUNT(wa_request_id) FROM
out_wa_interface WHERE wa_case_id IN (SELECT tk_out_wa_cases.case_id FROM
tk_out_wa_cases WHERE tk_out_wa_cases.product like '%Phaser 550%') AND
created_dt BETWEEN ('06-MAY-98 ') AND ('06-OCT-98 ')
Received on Tue Oct 06 1998 - 16:42:57 CDT