Using text on column containing only 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?
My initial thought was to create a CTSYS.CTXCONTEXT index.
Column type is Number  10,0
I tried to create a index
create index on table (num_colmn)
indextype is ctsys.context ;
then I get error as follow
RA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.DRVPARX", line 36
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 364
Thanks in advance

Example:
SCOTT@orcl12c> create table x (y_num number(10,0))
  2  /
Table created.
SCOTT@orcl12c> alter table x add (y_char  varchar2(10))
  2  /
Table altered.
SCOTT@orcl12c> create or replace trigger x_bir
  2    before insert or update of y_num on x
  3    for each row
  4  begin
  5    :new.y_char := to_char (:new.y_num);
  6  end x_bir;
  7  /
Trigger created.
SCOTT@orcl12c> begin
  2    ctx_ddl.create_preference('mywordlist', 'BASIC_WORDLIST');
  3    ctx_ddl.set_attribute('mywordlist','PREFIX_INDEX','TRUE');
  4    ctx_ddl.set_attribute('mywordlist','PREFIX_MIN_LENGTH', '3');
  5    ctx_ddl.set_attribute('mywordlist','PREFIX_MAX_LENGTH', '4');
  6    ctx_ddl.set_attribute('mywordlist','SUBSTRING_INDEX', 'YES');
  7    ctx_ddl.set_attribute('mywordlist','WILDCARD_MAXTERMS', 0);
  8  end;
  9  /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> create index x_idx on x (y_char)
  2  indextype is ctxsys.context
  3  parameters
  4    ('wordlist mywordlist
  5       sync      (on commit)')
  6  /
Index created.
SCOTT@orcl12c> insert into x (y_num) values (3453454)
  2  /
1 row created.
SCOTT@orcl12c> commit
  2  /
Commit complete.
SCOTT@orcl12c> select * from x where contains (y_char, '%53%') > 0
  2  /
     Y_NUM Y_CHAR
   3453454 3453454
1 row selected.

Similar Messages

  • A more efficient way to assure that a string value contains only numbers?

    Hi ,
    I'm using Oracle 9.2.0.6.
    I was curious to know if there was any way I could write a more efficient query to determine if a string value contains only numbers.
    Here's my current query. This SQL is from a sub query in a Join clause.
    select distinct cta.CUSTOMER_TRX_ID, to_number(cta.SALES_ORDER) SALES_ORDER
                from ra_customer_trx_lines_all cta
                where length(cta.SALES_ORDER) = 6
                and cta.SALES_ORDER is not null
                and substr(cta.SALES_ORDER,1,1) in('1','2','3','4','5','6','7','8','9','0')
                and substr(cta.SALES_ORDER,2,1) in('1','2','3','4','5','6','7','8','9','0')
                and substr(cta.SALES_ORDER,3,1) in('1','2','3','4','5','6','7','8','9','0')
                and substr(cta.SALES_ORDER,4,1) in('1','2','3','4','5','6','7','8','9','0')
                and substr(cta.SALES_ORDER,5,1) in('1','2','3','4','5','6','7','8','9','0')
                and substr(cta.SALES_ORDER,6,1) in('1','2','3','4','5','6','7','8','9','0')This is a string where I'm finding A-Z-a-z characters and '/' and '-' characters in all 6 positions, plus there are values that are longer than 6 characters. That's what the length(cta.SALES_ORDER) = 6 is for. Also, of course. some cells are NULL.
    So the question is, is there a more efficient way to screen out only the values in this field that are 6 character numbers or is what I have the best I can do?
    Thanks,

    I appreciate all of your very helpfull workarounds. The cost is a little better in all cases than my original where clause.
    To address the discussion that's popped up about design from this question, I can say a few things that should clear , at least, my situation up.
    First of all this custom quoting , purchase order , and sales order entry system WAS written by a bunch a of 'bad' coders who didn't document their work and then left. We don't even have an ER diagram
    The whole project that I'm only a small part of is literally trying to put Humpty Dumpty together again and then move it from a bad custom solution into Oracle Applications.
    We're rebuilding, documenting, and doing ETL. This is one of your prototypical projects from hell.
    It's a huge database project so we're taking small bites as a time. Hopefully, somewhere right before Armageddon hits, this thing will be complete.
    But until then,..., well,..., you know the drill.
    Thanks Again.

  • How to Identify whether string contains only numbers

    Hi Experts,
    How to identify whether a string contains only numbers...
    Thanks & Regards,
    Neeraj.

    Hi Neeraj,
    ISNUMERIC(String_Field)
    The above function returns '0' for non-numerics and
    '1' for numeric
    Hope this helps.
    Regards,
    Bala

  • How to restrict the text field to enter only numbers???

    I have used "onkeyup" event to call a function "test", I am getting the alert message for every entry (even for a number), I dont know why I am getting this. Please help me out.....
    Number1 : <input type="text" name="myin1" id="a" onkeyup="test(this,event)">
    function test(ff,evt)
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :
    ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
    alert("Only numbers are allowed"); }
    }

    Hi,
    However this is java forum and you are asking for a solution of a javascript problem,
    I think I got the problem.
    This script works fine when I run it on IE and use the numeric keys above the text keys,
    but give error when I use the numerical keypad on the right.
    I think you should change your if condition like this
    if (charCode > 31 && ((charCode < 48 || charCode > 57) || (charCode < 96 || charCode > 105)) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Returning two rows with one column containing only one place

    Dear all;
    I have a query that returns two rows similar to this below
    ID      PLACE            PROGRAM
    A       NEWYORK      PROGRAM A
    A       NEWYORK      PROGRAM B
    I would like this instead
    ID      PLACE             PROGRAM
    A       NEWYORK       PROGRAM A
                                   PROGRAM  B
    All help is appreciated. Thank you.Edited by: user13328581 on Mar 22, 2011 11:52 AM

    user13328581 wrote:
    WOW...THanks a lot Solomon, I have never used partitions and row_number in such a manner...can you please explain your logic.Sure:
    row_number() over(partition by id order by place,program)This will take all rows returned by the query andsplit them into buckets (partitions) by id. Inside each bucket it will order rows by place and program and assign them row numbers. So for each ID row number 1 will be row with first (alphabetically) place first programt. And this is the row where we want ID to show up. That is why we wrap the above analytic function in CASE statement which will do exactly that. Now:
    row_number() over(partition by id,place order by program)does pretty much the same just bucket is ID and PLACE combination. So for each such combination we want to show only for the first (alphabetically) programt.
    Now notice in ORDER BY clause I prefix ID and PLACE with table alias. You must do it since otherwise query alias ID and PLACE will take precedence resulting in wrong sort order (remember we nulled all ID and PLACE except for row number 1).
    SY.

  • Column contains only space(s)

    I have a problem using bind variables with Method 4 out of Pro*C/C++ Precompiler Programmer's Guide Release 8.1.5.
    I've pretty much taken the sample code and customized it. Everything else works fine; however, when I want to select where colum = :s and I have ' ', that's a single space, for a bind value, it doesn't find the row. This also occurs when there is more than one space. It works when I have 'A', or 'A ', or ' A', but not ' ' or ' '.
    Has anyone else seen this? can explain it? most importantly, found a way around it?

    How have you declared your bind variables? I assume the column type is CHAR?

  • How do I find that, a column contains only numeric characters ?

    I want to search for all the column values which has some non numeric value.

    This should work: you'll need to adjust it if the column exceeds 10 characters. You also may need to add permitted non-numerical characters i.e. <space>, <comma>, <decimal point>, <minus sign>, etc.
    select col1
    from my_table
    where translate(col1, '1234567890' '**********') != substr('**********', 1, length(col1))rgds, APC

  • 'GUI_UPLOAD': uploading of only numbers

    Dear Experts,
    I use 'GUI_UPLOAD' for uploading of the CSV-File into my ALV and I need that whatever information this list contains, only numbers (well no letters)
    will be uploaded into the grid.
    My current code for uploading looks following:
    CALL FUNCTION 'GUI_UPLOAD'
         EXPORTING
           filename = v_filename
           filetype = 'ASC'
         TABLES
           data_tab = ta_csv_data.
       LOOP AT ta_csv_data INTO v_string.
         IF sy-tabix = 1.
           CONTINUE.
         ENDIF.
         SPLIT v_string AT ';'
         INTO
         wa_csv-vkorg
         wa_csv-matnr
         wa_csv-preis.
         APPEND wa_csv TO ta_csv.
         CLEAR wa_csv.
    Is this somehow possible?
    Thank you in advance
    BR, Denis

    From here
    Re: numeric containing in char - how to extract
    DATA lv_text TYPE string VALUE 'ab000cdeSDFf34534gh1ASDF234ijk5abc0'.
    WRITE : /,'Before Replace :',lv_text. REPLACE ALL OCCURRENCES OF REGEX '[[:alpha:]]' IN lv_text WITH ''.
    WRITE : /,'After Replace :',lv_text. 
    Output: Before Replace : ab000cdeSDFf34534gh1ASDF234ijk5abc0  7
    After Replace : 00034534123450
    [[:alpha:]]
    specifies any alphabet in lower or upper case.
    Remember that there is no space between the single quotes in the WITH clause.
    Or hereDelete all non-numc from string
    You have to do it for your char fields

  • Installation: hello, I am trying to install my adobe elements twelve. I have a serial number, which contains no letters (only numbers), from the box. I use a mac. When I try to install it, it says it's unable to validate my serial number. I have already c

    Installation: hello, I am trying to install my adobe elements twelve. I have a serial number, which contains no letters (only numbers), from the box. I use a mac. When I try to install it, it says it's unable to validate my serial number. I have already checked the spelling. What should I do?

    Does it begin with 1057? If not, it's a redemption code. In which case, see here:
    Redemption Code Help
    If it is a serial number, go to system preferences>security & privacy>firewall>firewall options and be sure that PSE is allowed to call out.

  • I have a column in a Numbers document that currently only contains a number--the numbers are different in different columns.  Before each number I want to add the words "Pack Qty."  How would I do this?

    I have a column in a Numbers document that currently contains a number and that number is different in different columns.  I want to add the words "Pack Qty" before each number in the column.  How do I do that?  I'm using Numbers '09 on a brand new Macbook Pro.  Thanks!

    In an adjacent column add the formula:
    ="Pack Qty: "&<CELL>
    where <CELL> is the cell in the same row where the quantity is,
    Like:
    E2="Pack Qty: "&D2
    select, and hold,  the little circle at the bottom right corner of the selction, then drag down

  • I would like to create a custom datagridview column containing text images and MS Word OLE objects

    I am an old time LabView programmer going back to 2.0.  But moved on with my career several years ago.  But here I am back attempting a custom column in dataviewgrid control.  .NET is hard.  My goal is to read in an MS Word document and parse it out to a custom column.  The column will contain regular old text, images and MS Word objects, sometimes called OLE objects.
    There is scant information on creating .NET and labview when it comes to form manipulation.  I have stuggled through the learning curve and now able to insert a text box column into a datagridview and add it to the form container and actually size it to the datagridview control.  I've added a menu, but still figuring out the layout class.  Did I say .NET is hard?
    I know there must be a custom column created and even found a C# example, sorta.  Trouble is the example uses easy stuff like override and private.  It will take me another 3 weeks for that, darnit I'm getting lazy.
    Does anybody out there have some example of a custom column in the datagridview?
    If you ask to post code.  I have nothing I would be proud to show.
    The sorta go by: http://www.codeproject.com/Articles/31823/RichTextBox-Cell-in-a-DataGridView

    This is what the progress looks like so far.  I broke the tasks down in sub VIs.  One to create a custom cell so I can add it to the column CellTemplate.  The other to add the column to the control.  My limited knowledge of .NET and the implementation in LV causes me to question the value of LV .NET.
    The coding to create a TextBoxCell override with ImageCell CellTemplate.  Honestly I'm guessing what to do, because the LV documentation on inheritance and overriding is poor at best.
    The column coding to add the cell to the custom column.
    Probe 19 always comes up with an error.  The error is the standard 1172 with no clue what is causing it.  The "index" will work on 0 or 1, I suspect bc the two cell types are 0 and 1 but nothing tells me that, just guessing.

  • Is there a Numbers equivalent to Excel's "Text to Columns"?

    I am new to Numbers 09. In Excel I often need to take large amounts of ASCII text data, with hundreds or even thousands of line, paste the data into Column A, then use the "Text to Columns" utility to parse the data into separate columns for further manipulation, calculation, or graphing. Is there a similar process available in Numbers?

    I found a way to accomplish this, assuming you also have iWork “Pages” available.
    Paste your delimited text into a blank"Pages" document.  Do a Find / Replace on your delimiting character (comma or whatever) and replace it with a tab character. 
    To do this, use Edit > Find > Find... and choose “Advanced” (at the top of the pop-up).  Your delimiter goes in the Find text box.  Then use the “Insert” pull-down menu to set the Replace text to “Tab.”   It puts a little arrow symbol into the text box.
    Your original text probably has line breaks already.  But if it has a separate delimiter instead, you can convert them into the required line breaks in the same way, using Find/Replace to "Paragraph Break.".  Hopefully the same delimiter is not used for both row and column breaks in your data.
    Now copy/paste that text from Pages into a single cell in Numbers and it should break it into columns and rows.
    MS Office for Mac isn’t that expensive.  After this ordeal I’ve ordered a copy.

  • Only numbers in a text field?

    Problem Solved.

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>SAPUI5 Accordion</title>
    <script id="sap-ui-bootstrap"
    src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
    data-sap-ui-theme="sap_bluecrystal"
    data-sap-ui-libs="sap.ui.commons"></script>
    <script>
    //var integerPattern = (/^-?\d*(\.\d+)?$/);
    var phoneNOTextField= new sap.ui.commons.TextField({
    id:"phoneNOTextField",
    width:"100px"
    /*onKeyup:function(evt){
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57))
    sap.ui.getCore().byId("phoneNOTextField").setValue="";
    phoneNOTextField.attachBrowserEvent("keyup",function(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode
    var phoneNOValue = evt.target.value;
    if (charCode > 31 && (charCode < 48 || charCode > 57))
    //if(!(phoneNOValue.match(integerPattern)))
    evt.target.value="";
    phoneNOTextField.placeAt("div1");
    </script>
    </head>
    <body class="sapUiBody">
    <div id="div1"></div>
    </body>
    </html>
    this is d code i am using
    i used keycode,keypress,keyup as events for the function
    works well but it displys letters and then empties the field
    my requirement is it should display and take only numbers
    please help

  • How to load a comma seprated text file which contain address in to sql server table using ssis package

    Hi,
    I want to load a file which is comma separated and contain address .Problem is that address its self comma seprated so how do I differenciate whether comma used for column seprator or it used in address.
    for eg.
    One person having address like
    "c/o AB corp,156 cross lane,USA"
    Thanks.....

    Hi SR_MCTS,
    Based on your description, you want to distinguish a comma is used for column separator or used in address column in a text file, then load the data from the text file to SQL Server table.
    As per my understanding, if you can replace the comma column separator to another delimiter like semicolon (;), just do it. Then we can select Semicolon {;} as Column delimiter for the Flat File Connection Manager. Or ensure all columns are enclosed in double
    quotes ("). Then we can set the double quotes (") as Text qualifier for the Flat File Connection Manager, and the commas will be loaded as part of the string fields.
    If you can't have that done, because computers don't know the context of the data, you would have to come up with some kind of rules that decides when a comma represents a delimiter, and when it is just part of the text. I think a custom script component
    would be necessary to pre-process the data, identify where a comma is part of an address, and then treat that as one field.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How can i open a PDF bank statement in numbers so that the rows and columns contain properly aligned data from statement?

    how can i open a PDF bank statement in "numbers" so that the rows and columns contain properly aligned data from statement?

    Numbers can store pdfs pages or clippings but does not directly open pdf files.  To get the bank statement into Numbers as a table I would open the bank statment in Preview (or Skim) or some pdf viewer.
    Then hold the option key while selecting a column of data.
    Then copy
    Then switch to numbers and paste the column into a table
    Then repeat for the other columns in the pdf document
    It would be easier (in my opinion) to download the QFX or CSV version from your bank

Maybe you are looking for

  • Using iTunes to burn a CD

    I'm trying to convert some ACC files form my iTunes library into MP3 files to burn on a CD and, have run into a problem. I created a new playlist of 130 songs from my library to burn on to the CD. 27 of the 130 songs need to be in MP3 format. So, I c

  • Is there a way to connect to two networks simultaneously?

    Here is my scenario: I am an audio technician who travels from venue to venue for work have to constantly switch between two networks to do my job.  I use MAC OS w/ the most current version 10.9 Example: 99% of the time, there is venue provided wirel

  • "UFL 'u2ltdate' that implements this function is missing."

    I am working through migrating older reports from a very outdated version of Crystal into a newer version and trialing Crystal Server 2013 with Crystal Reports for Enterprise.  The only problem I am running into is that I have many reports using the

  • How to use reference parameters (BAPI Import Parameters) in SQL statements

    Dear SAP gurus I have a question on using parameters passed in a custom BAPI in SQL statements. I am sending 2 parameters  TABLENAME, COLUMNNAME into a custom bapi. In the BAPI I need to give an sql command some thing like select * from TABLENAME whe

  • DBMS_OUTPUT within BULK COLLECT FORALL

    Hi, I am trying to figure out how I can output using DBMS_OUTPUT.PUT_LINE within a BULK COLLECT/ FORALL Update? Example: FETCH REF_CURSOR BULK COLLECT INTO l_productid,l_qty forall indx in l_productid.first..l_productid.last Update products aa Set aa