473,385 Members | 1,732 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,385 software developers and data experts.

Oracle Text with Numbers

Hello,

I need to search in a number column for particular "subnumbers". For
example I have a column with 3453454 in it an I like to searh for the
number "53" in it. I know I could use

select * from table where number_column like '%53%'

but since the table is rather big I'd like to use Oracle Text for it
and query like

select * from table where contains(number_column, 53) > 0

but above query would return NULL after converting the number column
to a varchar2 column! Only full numbers are indexed and therefore only
a search on the full number 3453454 would yield a result. What are my
options to make above query with "contains" clause work?

Thanks in advance
Jul 19 '05 #1
3 7683

"Michael" <ms*******@hotmail.com> wrote in message
news:e7**************************@posting.google.c om...
Hello,

I need to search in a number column for particular "subnumbers". For
example I have a column with 3453454 in it an I like to searh for the
number "53" in it. I know I could use

select * from table where number_column like '%53%'

but since the table is rather big I'd like to use Oracle Text for it
and query like

select * from table where contains(number_column, 53) > 0

but above query would return NULL after converting the number column
to a varchar2 column! Only full numbers are indexed and therefore only
a search on the full number 3453454 would yield a result. What are my
options to make above query with "contains" clause work?

Thanks in advance

Oracle text won't help since Oracle Text is looking for words not
substrings. I can't think of a Mathmatical transformation that would then
use an index on the column. Is it always 53 or could it be any substring?
If it was always 53 then you could have a function based index. I think you
are going to have to do:
select * from table where to_char(number_column) like '%53%' and have to do
a full table scan.
Jim
Jul 19 '05 #2
"Jim Kennedy" <ke****************************@attbi.net> wrote in message news:<utQpc.61946$z06.8535347@attbi_s01>...
"Michael" <ms*******@hotmail.com> wrote in message
news:e7**************************@posting.google.c om...
Hello,

I need to search in a number column for particular "subnumbers". For
example I have a column with 3453454 in it an I like to searh for the
number "53" in it. I know I could use

select * from table where number_column like '%53%'

but since the table is rather big I'd like to use Oracle Text for it
and query like

select * from table where contains(number_column, 53) > 0

but above query would return NULL after converting the number column
to a varchar2 column! Only full numbers are indexed and therefore only
a search on the full number 3453454 would yield a result. What are my
options to make above query with "contains" clause work?

Thanks in advance

Oracle text won't help since Oracle Text is looking for words not
substrings. I can't think of a Mathmatical transformation that would then
use an index on the column. Is it always 53 or could it be any substring?
If it was always 53 then you could have a function based index. I think you
are going to have to do:
select * from table where to_char(number_column) like '%53%' and have to do
a full table scan.
Jim


Thanks for your prompt reply.

it could be any substring, thats why I need sth.like above query

select * from table where contains(number_column, '234') > 0

there must be a (better) solution to avoid the full table scan. Any
other opinions,suggestions?

Thanks, Michael
Jul 19 '05 #3

"Michael" <ms*******@hotmail.com> wrote in message
news:e7**************************@posting.google.c om...
"Jim Kennedy" <ke****************************@attbi.net> wrote in message

news:<utQpc.61946$z06.8535347@attbi_s01>...
"Michael" <ms*******@hotmail.com> wrote in message
news:e7**************************@posting.google.c om...
Hello,

I need to search in a number column for particular "subnumbers". For
example I have a column with 3453454 in it an I like to searh for the
number "53" in it. I know I could use

select * from table where number_column like '%53%'

but since the table is rather big I'd like to use Oracle Text for it
and query like

select * from table where contains(number_column, 53) > 0

but above query would return NULL after converting the number column
to a varchar2 column! Only full numbers are indexed and therefore only
a search on the full number 3453454 would yield a result. What are my
options to make above query with "contains" clause work?

Thanks in advance

Oracle text won't help since Oracle Text is looking for words not
substrings. I can't think of a Mathmatical transformation that would then use an index on the column. Is it always 53 or could it be any substring? If it was always 53 then you could have a function based index. I think you are going to have to do:
select * from table where to_char(number_column) like '%53%' and have to do a full table scan.
Jim


Thanks for your prompt reply.

it could be any substring, thats why I need sth.like above query

select * from table where contains(number_column, '234') > 0

there must be a (better) solution to avoid the full table scan. Any
other opinions,suggestions?

Thanks, Michael


Think about it. How would one index a number (even represented as a string)
to be able to quickly search for any matching substring? (Your use of
contains as an example isn't how contains works. It is contains in a
document or string of characters delimited by spaces. 12345 isn't delimited
by spaces to search for 234 so nothing would be returned.) If this isn't
an OLTP system and if you have a limited number of decimal places (eg all
numbers are less than 1 million) then you could split the number into
seperate columns and use a bitmapped index on each column. Like:

myNumberCol Hundred1000s ten1000s thousands hundreds tens ones
12345 0 1 2
3 4 5
543215 5 4 3
2 1 5

then the select would be
select * from mytable where (Hundred1000s='2' and ten1000s='3' and thousands
='4') or
(ten1000s='2' and thousands='3'
and hundreds ='4') or
(thousands='2' and hundreds
='3' and tens ='4') or
(hundreds ='2' and tens ='3'
and ones='4')

Using a bitmapped index would be fast. (only 10 values in a column and it
can and them together) But don't do it in an oltp environment.
Jim


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jan Bols | last post by:
I've been trying to install Oracle 8.1.7 on a fresh Mandrake 9.1 O.S for days, but I'm still not able to get it running. I've tried several install instructions that I found on the internet but no...
133
by: jonathan | last post by:
hey all, I realize that this question might pop up from time to time, but I haven't seen it a while and things might of changed, so - Right now (July 2004) how does mysql stand up in...
3
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary...
1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
6
by: robin9876 | last post by:
In an Access 97 (and 2000) database that has linked tables to Oracle which is showing some fields as text when they are numbers in Oracle. In Oracle they are specified to a size e.g. Number(38)....
56
by: Ashish Patankar | last post by:
I want to migrate my Oracle 10g database to Db2. I want some documentation for the comparision between these to databases. I also want to know which features of Oracle 10g are supported by Db2 and...
5
by: jonceramic | last post by:
Hi All, I started developing in Access, and people took notice and so we're starting to migrate into our corporate's bigger Oracle system. I'll still be using my developed Access front ends,...
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
3
by: Michael | last post by:
Hello, I need to search in a number column for particular "subnumbers". For example I have a column with 3453454 in it an I like to searh for the number "53" in it. I know I could use select...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.