473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Syntax error

296 100+
Hello,


A syntax error is coming in the following oracle code:


Expand|Select|Wrap|Line Numbers
  1.                         stmt := stmt || 'max(case when "' || c.column_name ||
  2.                                     '" REGEXP_LIKE(' || c.column_name || ',''' || search_string || ''') then ''' || c.column_name
  3.                                     || ' ''' || ' else null end) || ';
  4.  

Please help.
Apr 19 '08 #1
1 1454
pankajit09
296 100+
Expand|Select|Wrap|Line Numbers
  1. create or replace function search_in_table(
  2.             owner varchar2,
  3.             table_name varchar2,
  4.             search_string varchar2)
  5.             return varchar2 is
  6.             stmt varchar2(32700);
  7.             col varchar2(32700);
  8. begin
  9.             stmt := 'select ';
  10.             for c in (
  11.                         select column_name
  12.                         from all_tab_columns
  13.                         where all_tab_columns.table_name=search_in_table.table_name
  14.                                     and all_tab_columns.owner=search_in_table.owner
  15.                                     and data_type like '%CHAR%' )
  16.             loop
  17.                         stmt := stmt || 'max(case when "' || c.column_name ||'" REGEXP_LIKE(''' || c.column_name || ''',"' || search_string || '") then ''' || c.column_name|| ' ''' || ' else null end) || ';
  18.             end loop;
  19.             stmt:= stmt||'nvl2(count(*),null,null) from "'||owner||'"."'||table_name||'"';
  20.         execute immediate stmt into col;
  21.             return col;
  22. end;

and when I call the above function using the below code :

Expand|Select|Wrap|Line Numbers
  1. select table_name,cols from (
  2.             select rownum,
  3.             table_name,
  4.             search_in_table('SCOTT',table_name,'[[:digit:]]') cols
  5.             from all_tables where owner='SCOTT')
  6.             where cols is not null;


the follwing error comes :

Expand|Select|Wrap|Line Numbers
  1. search_in_table('SCOTT',table_name,'[[:digit:]]') cols
  2.             *
  3. ERROR at line 4:
  4. ORA-00920: invalid relational operator
  5. ORA-06512: at "SYS.SEARCH_IN_TABLE", line 20
Apr 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
1
by: Donald Canton | last post by:
Hi, I'm using Bjarne's book to learn C++ and am stuck on the Calc program in Section 6. Everything works fine except when I try to use istringstream to parse a token from the command line. I...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
2
by: david | last post by:
Anyone could give me a hand about this syntax error? Thank you. David Source Code: Dim conn As New SqlConnection(strConn) Dim daAngio As New SqlDataAdapter(strSelectStatement, conn) 'Create a...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
1
by: Hari Sekhon | last post by:
I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something ...
7
by: Josh | last post by:
I have a lot of except Exception, e statements in my code, which poses some problems. One of the biggest is whenever I refactor even the triviallest thing in my code. I would like python to...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
5
Banfa
by: Banfa | last post by:
So I have a little problem, I have a template class and that class contains a template function; now what I want to do is declare that function in the class (or indeed the entire class) as a friend...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.