A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Error in Oracle like clause
Joined: Mar 07, 2006
May 23, 2006 15:33:00
Here the like clause is not working,since the sql is itself in sinle quotes.
I don't know how to make the like clause work.
The error it is giving me is:
ORA-00920: invalid relational operator
ORA-06512: at "TABCOUNT", line 10
ORA-06512: at line 2
The code is
CREATE OR REPLACE FUNCTION tabcount (
tab IN VARCHAR2, field IN VARCHAR2 ,whr IN VARCHAR2)
DBMS_OUTPUT.PUT_LINE ('whr' ||whr);
DBMS_OUTPUT.PUT_LINE ('field1' ||field);
' SELECT COUNT(*) FROM ' || tab ||
' WHERE ' || field || 'like ''%'||whr ||'%'''
DBMS_OUTPUT.PUT_LINE ('countis!' ||retVal);
Looking for some answer.
Joined: Jun 05, 2006
Jun 10, 2006 03:04:00
the bug in ur query is the statement whatever u have written as || 'like ''%'||whr ||'%'''
|| ' like ''%'||whr ||'%'''
u have skipped the blank space between the field values & like keyword
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: Error in Oracle like clause
PL/SQL substitution variable
Problem in executing Oracle Function from JSP Page
Stored procedure which returns array
Permission problem calling java from PL/SQL
ORA-06550: line 1, column 36: PLS-00103: Encountered the symbol ";"
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014