Regular Expression to Check number with at least one decimal point

Hi,
I would like to use the REGEX_LIKE to check a number with up to two digits and at least one decimal point:
Ex.
10.1
1.1
1
12
This is what I have so far. Any help would be appreciated. Thanks.
if regexp_like(v_expr, '^(\d{0,2})+(\.[0-9]{1})?$') t

Hi,
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
SammyStyles wrote:
Hi,
I would like to use the REGEX_LIKE to check a number with up to two digits and at least one decimal point:
Ex.
10.1
1.1
1
12
This is what I have so far. Any help would be appreciated. Thanks.
if regexp_like(v_expr, '^(\d{0,2})+(\.[0-9]{1})?$') t
Do you really mean "up to two digits", that is, 3 or more digits is unacceptable?  What if there are 0 digits?  (0 is less than 2.)
Do you really mean "at least one decimal point", that is, 2, 3, 4 or more decimal points are okay?  Include some examples when you post the sample data and results.
It might be more efficient without regular expressions.  For example
WHERE   TRANSLATE ( str              -- nothing except digits and dots
                  , 'A.0123456789'
                  , 'A'
                  )   IS NULL
AND     str           LIKE '%.%'     -- at least 1 dot
AND     LENGTH ( REPLACE ( str       -- up to 2 digits
                )     <= 2

Similar Messages

  • EBS check number with leading zeros

    When we upload EBS, we are getting the check number in the record 16 (reference field). But unlike the check number posted in SAP, the check number in the BAI file has 2 leading zeros. Now since check number is coming in record 16, instead of record 88 we are not able to solve this problem through String configuration.
    So, we thought of following solutions(Options):
    1.    Modify the check lot numbers to have two leading zeros plus associated changes like the form and so on.
    2.    Modify the check number in the incoming file u2013 strip the check number with two leading zeros with the use of customer enhancement. (After upload and before posting)
    Can we solve the problem of leading zeros (before the check number) through any configuration steps instead of changing the SAP script form for check(Check lot) or going for customer enhancement.
    Thanks
    Ron

    You are correct, since the check numbers are coming through only in the 16 records and not in the 88 records, you cannot use a search string to resolve the issue with leading zeros.  Also, I do not know of any other configuration that can be used to reformat the reference values in the 16 records.
    The 2 solutions you have listed are both valid options.  Although with the first option (changing the check lots), you would need to make sure the business users approved of changing the check lots before going forward with that option.  And you would still have to manually clear checks that had been issued prior to the check lot change.
    At my company, we went with the second option - using ABAP code to update the check numbers from the file to match those in SAP (we actually had to add leading zeros to the check numbers).  In our case, we had already created a pre-processor program for other re-formatting of the file that was needed prior to loading it into SAP - so we added the check number logic to that.
    However, if you do not have a pre-processor program, I know there is a user exit available for EBS - exit EXIT_RFEBBU10_001, include ZXF01U01.  I have heard of others using this exit to update the check numbers from 16 records.  The exit is called during the FF.5 processing.
    Regards,
    Shannon

  • Regular expression to check the sequence of strings

    HI,
    I am validating an EDI document like as follows
    ISA*XX*XXXXXXXXXXXXXXX*XX*XXXXXXXXXXXXXXX*030130*0912*~IEA*1*000005900~
    I need to create a regular expression which checks ISA should always occur before IEA.
    Please help me if you have any hints.
    Thanks.

    Thanks.I had taken that into consideration.
    But using regular expression I could say
    ISA* only once
    IEA* only once
    And
    ISA before IEA
    Any hints how to specify "before"/sequence using Regular expression ?
    I agree sometime using basic String operation we can do this.

  • Limit the number of digits after the decimal point

    hi,
    in webform how to limit the number of digits after the decimal point?
    thanks

    Hi,
    In the Web form Design menu there is a tab for Other Options wherein you would find the setting for number of Decimal places.
    Thanks.
    Madhavi

  • Regluar expression: at least one number AND at least one capital letter.

    How to write regular expression to determine rule:
    1) input string must contain at least one number. For example '0A1' contains 2 numberic symbols, but 'Abc' doesn't contain. At least one numeric symbol must occur.
    2) input string must also contain one capital letter. for example '0A1' contains capital A, but '0a1' doesn't. At least one capital letter must exist in
    Bot 1) and 2) must be true for input string.
    How to write such regular expression?

    Seems it still is not correct, because 'Test123' is not outputted:Be aware that there are NLS issues:
    SQL> alter session set nls_language=english
    Session altered.
    SQL> with t as (
    select '01A' str from dual union all
    select '01a' from dual union all
    select 'anc' from dual union all
    select 'ABC' from dual union all
    select 'A3C' from dual union all
    select '3Ä' from dual union all
    select 'Ä3' from dual union all
    select '4Ca' from dual union all
    select 'Test123' from dual union all
    select 'aTest123' str from dual union all
    select 'A423' from dual
    select * from t where regexp_like(str, '([A-Z]+\d+)|(\d+[A-Z]+)')
    STR    
    01A    
    A3C    
    4Ca    
    A423   
    4 rows selected.
    SQL> alter session set nls_language=german
    Session altered.
    SQL> with t as (
    select '01A' str from dual union all
    select '01a' from dual union all
    select 'anc' from dual union all
    select 'ABC' from dual union all
    select 'A3C' from dual union all
    select '3Ä' from dual union all
    select 'Ä3' from dual union all
    select '4Ca' from dual union all
    select 'Test123' from dual union all
    select 'aTest123' str from dual union all
    select 'A423' from dual
    select * from t where regexp_like(str, '([A-Z]+\d+)|(\d+[A-Z]+)')
    STR    
    01A    
    A3C    
    3Ä     
    Ä3     
    4Ca    
    Test123
    aTest123
    A423   
    8 rows selected.

  • Regular expression to check a value if it contains a specific word.

    Hi All,
    How can i check if a certain word exists in a value in regular expression ?
    I have an attribute called Race. Race can contain the following:
    White, Non-Hispanic
    Black, Non-Hispanic
    White, Non Hispanic
    Black, Non Hispanic
    White, NonHispanic
    Non-Hispanic, white
    Non Hispanic - black
    What i want is to check if my value contains the word "NON" (NON can be at the beginning, middle or end), if it does, parse it and return it.
    This is what I have, however I want to make sure it covers all cases and not missing anything else
    select REGEXP_SUBSTR(UPPER(trim('Black, Non-Hispanic')), '[NON]+') from dual;Thanks in advance.

    Rooney wrote:
    Could you please explain what are the 2 ones's for ?The two 1 are not really needed for this. It is just taht the syntax requires those parameters when I add the fifth parameter.
    http://docs.oracle.com/cd/E14072_01/server.112/e10592/functions148.htm
    First 1 is where the search starts (same as in substr('Abc',1))
    Second 1 is the number of occurences. Here meaning return the first occurence that was found. Replace it with 2 in my next example to see a (very slight) difference.
    Also 'NON' alone will not cover all cases ?But you don't have non alone. You have regexp with non + upper. The 'i' replaces the upper. Also the output is slightly different. the 'i' version will return the same capitalization as it was found in the original. It depends a little what you want to achieve. And of cause INSTR will give the same info as your version. if the result is > 0 it means NON was found.
    with testdata as (select 'White,Non-Hispanic' str from dual union all
                      select 'Non-White,nOn-Hispanic' str from dual union all
                      select 'White,Hispanic' str from dual
    /* end of test data creation */
    select str,
          REGEXP_SUBSTR(UPPER(TRIM(str)), 'NON') regexp1,
          REGEXP_SUBSTR(str, 'NON',1,1,'i') regexp2,
          instr(upper(str),'NON') instr
    from testdata;
    STR                    REGEXP1                REGEXP2                INSTR
    White,Non-Hispanic     NON                    Non                        7
    Non-White,Non-Hispanic NON                    Non                        1
    White,Hispanic                                                           0

  • Regular expression - get longest number from string

    I believe it is easy one but I can't get it.Lets say I have a string 'A1_1000' I want to substract the 1000 using regular expression. When I feed Match regular expression I get '1' which is not the longest number. I know other ways of doing that but I want clean solution in one step. Does anybody knows the right regular expression to accomplish that? Thanks!
    LV 2011, Win7
    Solved!
    Go to Solution.

    ceties wrote:
    This is the best solution I was able to come with. I am just wondering if there is "smoother way" without the cycle.
    Since multiple checks are required I would tend to beieve that we do have to loop through the possibilities. in this example
    I start check at offset "0" into the string for a number. Provided i find a number I check if it is longer that any previous number I found and if so save the new longer number in the shift register.
    Have fun!
    Ben
    Message Edited by Ben on 04-15-2009 09:23 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Find_Longest.PNG ‏33 KB

  • Regular expressions for replacing text with sms language text

    Hi, I'm trying to write a function which converts normal, correctly spelled text into the shorter sms language format but struggling to come up with the regular expressions i need to do so, can anyone help?
    1: remove surplus white space at the beginning of a sentence and at the end of a sentence.
    e.g. " hello." --> "hello." OR "hello ." --> "hello."
    2: remove preceeding and/or proceeding space if there's a word then a number possibly followed by another word
    e.g. "come 2 me" --> "come2me" OR "dnt 4get" --> "dnt4get"
    3: remove "aeiou" if word starts and ends with "!aeiou"
    e.g. "text" --> "txt"

    You can make the whitespace on either side optional:   text = text.replaceAll("\\s*(\\d)\\s*", "$1");1. Use String's trim() method.
    3. This one has to be done in two steps: import java.util.regex.*;
    public class Test
      public static void main(String... args) throws Exception
        String text = "The quick brown fox jumps over the lazy dog.";
        System.out.println(devowelize(text));
      public static String devowelize(String str)
        Pattern p = Pattern.compile(
          "[a-z&&[^aeiou]]++(?:[aeiou]++[a-z&&[^aeiou]]++)+",
          Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(str);
        StringBuffer sb = new StringBuffer();
        while (m.find())
          m.appendReplacement(sb, m.group().replaceAll("[aeiou]+", ""));
        m.appendTail(sb);
        return sb.toString();
    }

  • Regular Expression for Invalid Number

    Hi everyone,
    I am using oracle version as follows:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    I am using regular expression to replace invalid values from a table.
    I received oracle error stating "ORA-01722 invalid number"
    My query looks like this:
    SELECT DISTINCT
    MRC_KEY,
    PURPOSE_CD,
    RESIDENCE_DESC,
    to_number(regexp_replace(ICAP_GEN_MADAPTIVE,'[+. ]?0?0?(\d+)[-.]?','\1')) as ICAP_GEN_MADAPTIVE,
    From
    MRRC_INT
    I am not sure what are the invalid values in the table so I can write regexp accordingly.
    Any guidance is highly appreciated!
    Thanks in advance
    J

    Or use DML error logging:
    create table t1
      (col1 number);
    exec dbms_errlog.create_error_log ('t1','t1_errors')
    insert into t1
    with t as
      (select '1' col from dual union all
       select '1.1' col from dual union all
       select '.11' col from dual union all
       select '0.11' col from dual union all
       select '-1' col from dual union all
       select '1,1' col from dual union all
       select '11a' col from dual union all
       select '1d' col from dual union all
       select '1e6' col from dual union all
       select '1e6.1' col from dual union all
       select '1e' col from dual
    select col
    from t
    log errors into t1_errors
    reject limit 20
    col col1 for 999,999,999.99
    select * from t1;
               COL1
               1.00
               1.10
                .11
                .11
              -1.00
       1,000,000.00
    col col1 for a30
    select * from t1_errors;
    ORA_ERR_NUMBER$ ORA_ERR_MESG$                  ORA_ERR_ROWID$       OR ORA_ERR_TAG$         COL1
               1722 ORA-01722: invalid number                           I                       1,1
               1722 ORA-01722: invalid number                           I                       11a
               1722 ORA-01722: invalid number                           I                       1d
               1722 ORA-01722: invalid number                           I                       1e6.1
               1722 ORA-01722: invalid number                           I                       1e

  • Regular Expression to Locate Words with Character

    I want to identify all the words in a document that are followed by the register mark (®) symbol.
    I built, what I thought was a regular expression that would search for a register mark preceeded by alpha number characters and a space. So if my text contained the sentence "Adobe InDesign® is a great product.", the regular expression would find "InDesign®"
    Below is the regular expression I composed. It grabs anything with a register mark, not just the register marks preceded by a space and alpha numeric characters. Where did I go wrong? I though the \s would restrict the search to complete words with a register mark.
    \s[a-zA-Z0-9]|®

    \s is the special GREP code for "any kind of space" -- a regular space, a tab, hard return, or any of ID's own white space codes. It has nothing to do with "complete words", because a word can appear at the start of a story, without any preceding space. It would also not find "InDesign®" because there is no space before it, there is a double quote instead.
    Your GREP does not work because, well, you got the general idea (words may consist of the set of characters "a-z", "A-Z", and "0-9") but since you use the [..] without any other code, GREP will apply this rule once -- per character. If you want to find words of more than one character, you need to tell GREP "one or more of these, please": with a +.
    Second, where did that | come from? It's the OR operator. Essentially, you are looking for
          any space followed by one character from the set "a-z", "A-Z", and "0-9"
    OR
          the ® character
    The 'word break' you were looking for is this code: \b, so you could search for "\b[a-zA-Z0-9]+" (note the '+' to allow more than one instance) -- but it's not necessary, because by default GREP grabs as much as it can. The set 'a-zA-Z0-9' etc. describes the allowed "word" characters, but you might want to prefer these: \l (ell) and \u for all lowercase and all uppercase characters -- they are shorter, and they automatically include accented characters, Greek, Russian, and a lot more. Similar, \d (for "digits") is the short-cut for "0-9". And even better: \w is the shortcut for "word character", i.e., your set but then shorter and a bit better.
    Try this one:
    \w+~r

  • Regular expression - parse version number string

    Hi,
    I try to parse a string using regular expressions but id did not work correctly in all cases.
    The string that i want to parse can have one of the following layout:
    3.4.5.v20090305 or
    3.4.5The first three parts have to be integer values, the last part can be a free string (which is optional).
    I use the following code to parse the version number and extract the parts:
    Pattern versionPattern = Pattern.compile("(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?");
    Matcher m = versionPattern.matcher(versionString);
    if (!m.find()) {
        throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
    // assert that we matched every part
    // three groups (without qualifier) or four parts (with qualifier)
    int groups = m.groupCount();
    if (groups != 4) {
         throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
    // extract the parts
    major = parseInt(m.group(1));
    minor = parseInt(m.group(2));
    micro = parseInt(m.group(3));
    qualifier = m.group(4);The above regular expression works in all cases that i tested, except one.
    The follwoing string is accepted as correct input: (but it shouldn't)
    3.4.5a.v20090305And i get the result:
    major = 3
    minor = 4
    micro = 5
    qualifier = a.v20090305
    Thanks for help or suggestions :)
    Best Regards,
    Michael

    heissm wrote:
    Hi,
    I try to parse a string using regular expressions but id did not work correctly in all cases.
    The string that i want to parse can have one of the following layout:
    3.4.5.v20090305 or
    3.4.5The first three parts have to be integer values, the last part can be a free string (which is optional).
    I use the following code to parse the version number and extract the parts:
    Pattern versionPattern = Pattern.compile("(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?");
    Matcher m = versionPattern.matcher(versionString);
    if (!m.find()) {
    throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
    // assert that we matched every part
    // three groups (without qualifier) or four parts (with qualifier)
    int groups = m.groupCount();
    if (groups != 4) {
    throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
    // extract the parts
    major = parseInt(m.group(1));
    minor = parseInt(m.group(2));
    micro = parseInt(m.group(3));
    qualifier = m.group(4);The above regular expression works in all cases that i tested, except one.
    The follwoing string is accepted as correct input: (but it shouldn't)
    3.4.5a.v20090305And i get the result:
    major = 3
    minor = 4
    micro = 5
    qualifier = a.v20090305No, that can't be the output. Perhaps you have some old class files you're executing, because with the code you now posted, that can't be the result.
    To verify this, execute this:
    import java.util.regex.*;
    public class Main {
        public static void main(String[] args) {
            String versionString = "3.4.5a.v20090305";
            Pattern versionPattern = Pattern.compile("(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?");
            Matcher m = versionPattern.matcher(versionString);
            if (!m.find()) {
                throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
            // assert that we matched every part
            // three groups (without qualifier) or four parts (with qualifier)
            int groups = m.groupCount();
            if (groups != 4) {
                 throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
            // extract the parts
            System.out.println("1 -> "+m.group(1));
            System.out.println("2 -> "+m.group(2));
            System.out.println("3 -> "+m.group(3));
            System.out.println("4 -> "+m.group(4));
    }and you'll see that the following is the result:
    1 -> 3
    2 -> 4
    3 -> 5
    4 -> nullSome remarks about your pattern:
    "(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?"All the "{1}" can be omitted they don't add anything to your regex and are only cluttering it up. And you'll probably also want to "anchor" your regex using the start- and end-of-string-meta-characters, like this:
    "^(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\w+))?$"

  • Unique regular expression to check if a string contains letters and numbers

    Hi all,
    How can I verify if a string contains numbers AND letters using a regular expression only?
    I can do that with using 3 different expressions ([0-9],[a-z],[A-Z]) but is there a unique regular expression to do that?
    Thanks all

    Darin.K wrote:
    Missed the requirements:
    single regex:
    ^([[:alpha:]]+[[:digit:]]+|[[:digit:]]+[[:alpha:]])[[:alnum:]]*$
    You either have 1 or more digits followed by 1 or more letters or 1 or more letters followed by 1 or more digits. Once that is out of the way, the rest of the string must be all alphanumerics.  The ^ and $ make sure the whole string is included in the match.
    (I have not tested this at all, just typed it up hopefully I got all the brackets in the right place).
    I think you just made my point.  TWICE.  While the lex class would be much more readable as a ring.... I know all my brackets are in the correct places and don't need to hope.
    Jeff

  • Regular Expressions and phone number

    HI,
    there is a column "Phone_number Varchar2"
    Data containing :
    123-89556-6852
    (123)-857-965
    123-(5846)5648
    I want to display that
    123895566852
    123857965
    12358465648
    Pls help by Regular Expressions.
    Edited by: YLN on Feb 17, 2010 3:59 PM

    with t
    as
      select '123-89556-6852' col from dual union all
      select '(123)-857-965' col from dual union all
      select '123-(5846)5648' col from dual
    SELECT regexp_replace(col,'[^[:digit:]]') FROM tRavi Kumar

  • Regular Expression Find and Replace with Wildcards

    Hi!
    For the world of me, I can't figure out the right way to do this.
    I basically have a list of last names, first names. I want the last name to have a different css style than the first name.
    So this is what I have now:
    <b>AAGAARD, TODD, S.</b><br>
    <b>AAMOT, KARI,</b> <br>
    <b>AARON, MARJORIE, C. </b> <br>
    and this is what I need to have:
    <span class="LastName">AAGAARD</span>  <span class="FirstName">, TODD, S. </span> <br />
    <span class="LastName">AAMOT</span> <span class="FirstName">, KARI,</span> <br/>
    <span class="LastName">AARON</span> <span class="FirstName">, MARJORIE, C.</span> <br/>
    Any ideas?
    Thanks!

    Make a backup first.
    In the Find field use:
    <b>(\w+),\s+([^<]+)<\/b>\s*<br>
    In the Replace field use:
    <span class="LastName">$1</span> <span classs="FirstName">$2</span><br />
    Select Use regular expression. Light the blue touch paper, and click Replace All.

  • Hierarchical sql-how to get only branches with at least one not null leaves

    On 10gR2 we want below hierarchical query to return only the branches which at least have one not NULL leaf ;
    -- drop table corporate_slaves purge ;
    create table corporate_slaves (
    slave_id integer primary key,
    supervisor_id references corporate_slaves,
    name varchar(100), some_column number );
    insert into corporate_slaves values (1, NULL, 'Big Boss ', NULL);
    insert into corporate_slaves values (2, 1, 'VP Marketing', NULL);
    insert into corporate_slaves values (9, 2, 'Susan ', NULL);
    insert into corporate_slaves values (10, 2, 'Sam ', NULL);
    insert into corporate_slaves values (3, 1, 'VP Sales', NULL);
    insert into corporate_slaves values (4, 3, 'Joe ', NULL);
    insert into corporate_slaves values (5, 4, 'Bill ', 5);
    insert into corporate_slaves values (6, 1, 'VP Engineering', NULL);
    insert into corporate_slaves values (7, 6, 'Jane ', NULL);
    insert into corporate_slaves values (8, 6, 'Bob' , 3);
    SELECT sys_connect_by_path(NAME, ' / ') path, some_column col,  connect_by_isleaf isLeaf
      FROM corporate_slaves
    CONNECT BY PRIOR slave_id = supervisor_id
    START WITH slave_id IN
                (SELECT slave_id FROM corporate_slaves WHERE supervisor_id IS NULL) ;For this example wanted output is like this one since Marketing has no NOT NULL some_column leaves where as Engineering and Sales has at least one;
    PATH                                                                            
    / Big Boss                                                                  
    / Big Boss  / VP Sales                                                      
    / Big Boss  / VP Sales / Joe                                                
    / Big Boss  / VP Sales / Joe  / Bill                                        
    / Big Boss  / VP Engineering                                                
    / Big Boss  / VP Engineering / Jane                                         
    / Big Boss  / VP Engineering / Bob                                           Regards.

    Here is a slightly modified version, you can try it:
    WITH SRC AS (
    SELECT   SYS_CONNECT_BY_PATH(NAME ,
                                 '/ ') path,
             SOME_COLUMN COL,
             CONNECT_BY_ISLEAF ISLEAF,
             CONNECT_BY_ROOT SLAVE_ID ROOT_SLAVE_ID,
             SLAVE_ID slave_id,
             CONNECT_BY_ROOT SUPERVISOR_ID SUPERVISOR_ID,
             SOME_COLUMN
        FROM CORPORATE_SLAVES
      CONNECT BY PRIOR SLAVE_ID = SUPERVISOR_ID
    SELECT path, col, isleaf
    FROM SRC
    WHERE SUPERVISOR_ID IS NULL
    AND SLAVE_ID IN (SELECT ROOT_SLAVE_ID FROM SRC WHERE SOME_COLUMN IS NOT NULL)
    PATH                                COL                    ISLEAF                
    / Big Boss                                                 0                     
    / Big Boss / VP Sales                                      0                     
    / Big Boss / VP Sales/ Joe                                 0                     
    / Big Boss / VP Sales/ Joe / Bill   5                      1                     
    / Big Boss / VP Engineering                                0                     
    / Big Boss / VP Engineering/ Bob    3                      1                     
    6 rows selectedI tested it for 1000 records in the source table (tested on Oracle 10 XE),
    and .... the performance was a big surprise:
    INSERT INTO corporate_slaves
    SELECT SLAVE_ID + X SLAVE_ID,
           SUPERVISOR_ID + X SUPERVISOR_ID,
           NAME || ' ' || X NAME,
           some_column
    FROM  CORPORATE_SLAVES
    CROSS JOIN (
      SELECT 10*LEVEL x
      FROM DUAL
      CONNECT BY LEVEL <= 100
    COMMIT;
    SELECT count(*) FROM corporate_slaves;
    COUNT(*)              
    1010 Your query (slightly modified - removed leading space from the separator in CONNECT_BY_PATH):
    set timings on;
    CREATE TABLE BUBA1 AS
    SELECT SYS_CONNECT_BY_PATH(NAME,
                                '/ ') path,
            some_column col,
            connect_by_isleaf isleaf
        FROM corporate_slaves
       WHERE slave_id IN (SELECT connect_by_root slave_id "slave_id"
                            FROM corporate_slaves
                           WHERE some_column IS NOT NULL
                          CONNECT BY PRIOR slave_id = supervisor_id)
      CONNECT BY PRIOR slave_id = supervisor_id
       START WITH SLAVE_ID IN
                  (SELECT SLAVE_ID FROM CORPORATE_SLAVES WHERE SUPERVISOR_ID IS NULL)
    CREATE TABLE succeeded.
    6 095ms elapsedrewritten query:
    CREATE TABLE BUBA2 AS
    WITH SRC AS (
    SELECT   SYS_CONNECT_BY_PATH(NAME ,
                                 '/ ') path,
             SOME_COLUMN COL,
             CONNECT_BY_ISLEAF ISLEAF,
             CONNECT_BY_ROOT SLAVE_ID ROOT_SLAVE_ID,
             SLAVE_ID slave_id,
             CONNECT_BY_ROOT SUPERVISOR_ID SUPERVISOR_ID,
             SOME_COLUMN
        FROM CORPORATE_SLAVES
      CONNECT BY PRIOR SLAVE_ID = SUPERVISOR_ID
    SELECT path, col, isleaf
    FROM SRC
    WHERE SUPERVISOR_ID IS NULL
    AND SLAVE_ID IN (SELECT ROOT_SLAVE_ID FROM SRC WHERE SOME_COLUMN IS NOT NULL)
    CREATE TABLE succeeded.
    167ms elapsed
    SELECT COUNT(*) FROM BUBA1;
    COUNT(*)              
    606 
    SELECT COUNT(*) FROM BUBA2;
    COUNT(*)              
    606
    SELECT COUNT(*) FROM(
      SELECT * FROM BUBA1
      INTERSECT
      SELECT * FROM BUBA2
    COUNT(*)              
    606  ANd now the above tests repeated for 10.000 records
    truncate table  corporate_slaves;
    insert into corporate_slaves values (1, NULL, 'Big Boss ', NULL);
    insert into corporate_slaves values (2, 1, 'VP Marketing', NULL);
    insert into corporate_slaves values (9, 2, 'Susan ', NULL);
    insert into corporate_slaves values (10, 2, 'Sam ', NULL);
    insert into corporate_slaves values (3, 1, 'VP Sales', NULL);
    insert into corporate_slaves values (4, 3, 'Joe ', NULL);
    insert into corporate_slaves values (5, 4, 'Bill ', 5);
    insert into corporate_slaves values (6, 1, 'VP Engineering', NULL);
    insert into corporate_slaves values (7, 6, 'Jane ', NULL);
    insert into corporate_slaves values (8, 6, 'Bob' , 3);
    INSERT INTO corporate_slaves
    SELECT SLAVE_ID + X SLAVE_ID,
           SUPERVISOR_ID + X SUPERVISOR_ID,
           NAME || ' ' || X NAME,
           some_column
    FROM  CORPORATE_SLAVES
    CROSS JOIN (
      SELECT 10*LEVEL x
      FROM DUAL
      CONNECT BY LEVEL <= 1000
    COMMIT;
    SELECT count(*) FROM corporate_slaves;
    COUNT(*)              
    10010
    CREATE TABLE BUBA22 AS
    WITH SRC AS (
    SELECT   SYS_CONNECT_BY_PATH(NAME ,
                                 '/ ') path,
             SOME_COLUMN COL,
             CONNECT_BY_ISLEAF ISLEAF,
             CONNECT_BY_ROOT SLAVE_ID ROOT_SLAVE_ID,
             SLAVE_ID slave_id,
             CONNECT_BY_ROOT SUPERVISOR_ID SUPERVISOR_ID,
             SOME_COLUMN
        FROM CORPORATE_SLAVES
      CONNECT BY PRIOR SLAVE_ID = SUPERVISOR_ID
    SELECT path, col, isleaf
    FROM SRC
    WHERE SUPERVISOR_ID IS NULL
    AND SLAVE_ID IN (SELECT ROOT_SLAVE_ID FROM SRC WHERE SOME_COLUMN IS NOT NULL)
    CREATE TABLE succeeded.
    345ms elapsed
    CREATE TABLE BUBA11 AS
    SELECT SYS_CONNECT_BY_PATH(NAME,
                                '/ ') path,
            some_column col,
            connect_by_isleaf isleaf
        FROM corporate_slaves
       WHERE slave_id IN (SELECT connect_by_root slave_id "slave_id"
                            FROM corporate_slaves
                           WHERE some_column IS NOT NULL
                          CONNECT BY PRIOR slave_id = supervisor_id)
      CONNECT BY PRIOR slave_id = supervisor_id
       START WITH SLAVE_ID IN
                  (SELECT SLAVE_ID FROM CORPORATE_SLAVES WHERE SUPERVISOR_ID IS NULL)
    CREATE TABLE succeeded.
    526 437ms elapsed
    SELECT COUNT(*) FROM BUBA11;
    COUNT(*)              
    6006
    SELECT COUNT(*) FROM BUBA22;
    COUNT(*)              
    6006
    SELECT COUNT(*) FROM(
      SELECT * FROM BUBA11
      INTERSECT
      SELECT * FROM BUBA22
    COUNT(*)              
    6006 Wow.... 526 seconds vs. 0,4 seconds !!!
    131500 % performance gain ;)
    I have got similar results on Oracle 11.2

Maybe you are looking for

  • Cost Elements and Cost Centers in a service order

    Hello Finance Friends.... I am inquiring about something that has been happening and I can not find the answer as to how.  I spoke with the finance consultant and he seems to think it is the valuation class being changed but the valuation class has n

  • Can I move MPEG movie from Mac to my iPad?

    Can I move a protected MPEG movie from Mac to my iPad?

  • Lumia 925 Black update minor problem

    Hello, Just wanted to send feedback about my update experience. - I have Lumia 925 - I have developer account and related MS updates already installed - When installing Lumia Black, installation started normally - During first reboot my phone got stu

  • Fetch Records directly from BackEnd DB

    Hi Forum Members, I have a Z table. It should have a SQL Server representation at the Back End! I want to directly fetch data from that Back End SQL Server table. Is it possible? If yes, then how? Also I want to know if my Z-table name is ZEMP then w

  • Labview 2010 error during exe build active x control

    During the build of an exe of a labview vi, I get the following crash ( see attached jpeg). It has something to do with the activex control that is used in the vi. The activex control is registered with windows and functions properly. Any ideas? Atta