If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > need to filter data by limit or count in table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-12, 02:31
extremeashok extremeashok is offline
Registered User
 
Join Date: Feb 2012
Posts: 14
Question need to filter data by limit or count in table

i have to filter data by count, that have to fileter data insze by 13 digist in a coloumn from a table, can anyone help me in this..
have to get the data which is size in 13 digits...
Reply With Quote
  #2 (permalink)  
Old 02-09-12, 02:49
flyboy flyboy is offline
Registered User
 
Join Date: Mar 2007
Posts: 546
What is "data"? If you mean column, what is its data type? Can you post some sample values?
What "data" is "13 digits"? May they be separated/padded by another characters?

Maybe it would be helpful, if you read this article before posting any question: http://tkyte.*************/2005/06/ho...questions.html
Pay special attention to the "Context" paragraph. Then, please try to post relevant parts of your problem. Do not hesitate to also post DDL/DML statements - yes, we do understand Oracle SQL here.

Because, now it is impossible to deduce anything (input, applied rules, output) from your post, so it is also impossible to provide you any meaningful suggestion/solution.
Reply With Quote
  #3 (permalink)  
Old 02-09-12, 03:11
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
If something as simple as the following example does what you are looking for, fine. If not, do what Flyboy told you.
Code:
SQL> with test as
  2    (select 123 col from dual union
  3     select 12345 from dual union
  4     select 123456789 from dual
  5    )
  6  select col
  7  from test
  8  where length(to_char(col)) = 5;

       COL
----------
     12345

SQL>
Reply With Quote
  #4 (permalink)  
Old 02-09-12, 03:43
extremeashok extremeashok is offline
Registered User
 
Join Date: Feb 2012
Posts: 14
example

this is the example

mu coloumns has a set of digits like

H14526358964

data type - string

i have to filter data by limit, like it should be in 12 digits only.. like wise i have to filter ..
Reply With Quote
  #5 (permalink)  
Old 02-09-12, 03:53
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
So LENGTH it is.
Reply With Quote
  #6 (permalink)  
Old 02-09-12, 05:19
extremeashok extremeashok is offline
Registered User
 
Join Date: Feb 2012
Posts: 14
yes

yes is is length, but i canget the length by using length function, but the issue is, some of the datas having emply spaces with them, bt using length those datas are also getting displayed. i have to find the data length and also i have to omit the spaces. and can anyone tell me the exact use of trim().
Reply With Quote
  #7 (permalink)  
Old 02-09-12, 05:23
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Quote:
Originally Posted by extremeashok View Post
can anyone tell me the exact use of trim().
The manual?

http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions219.htm#i79689
Reply With Quote
  #8 (permalink)  
Old 02-09-12, 05:37
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
How about REPLACE?
Code:
SQL> with test as
  2    (select 'H123' col from dual union
  3     select 'A 12 45  ' from dual union
  4     select 'B123456 789' from dual union
  5     select 'C 1  2   3    4  ' from dual
  6    )
  7  select col
  8  from test
  9  where length(replace(col, ' ', '')) = 5;

COL
-----------------
A 12 45
C 1  2   3    4

SQL>
Anyway: if you want to get the most accurate answer, you should provide as many details as possible. First there were numbers, then there were strings, now there are strings with spaces. What will be next?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On