A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
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
I agree. Here's the link:
subject: Error in Oracle like clause
Stored procedure which returns array
Permission problem calling java from PL/SQL
Problem in executing Oracle Function from JSP Page
ORA-06550: line 1, column 36: PLS-00103: Encountered the symbol ";"
PL/SQL substitution variable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015