Regexp_like function

Hi ,
I am trying to match a column from another table using regular expressons, following is the query i am using but its not working.
select * from  table1 t1, table2 t2 where  regexp_like(t1.ind_code,'^'(t2.ind_code))Can someone please suggest how can we achive results.
Thanks

shavetachawla wrote:
Hi ,
I am trying to match a column from another table using regular expressons, following is the query i am using but its not working.
select * from  table1 t1, table2 t2 where  regexp_like(t1.ind_code,'^'(t2.ind_code))Can someone please suggest how can we achive results.
ThanksYour code has syntax error because you are not concatenating the '^' with t2.ind_code.
The correct syntax is this one:
select * from  table1 t1, table2 t2 where  regexp_like(t1.ind_code,'^'||t2.ind_code);However in order to see if you are doing things correctly you should post some sample data (CREATE TABLE and INSERT statement).
Please read SQL and PL/SQL FAQ
Regards.
Al

Similar Messages

  • Function to allow only printable ASCII in data

    Hi,
    In my CSV upload utility, I've implemented various error checking functions (not a number, not a valid date, not null... etc.), but today I found some strange characters in customer's DB, which was uploaded previously by someone else using sqlldr. Those characters look like small squares from sql developer, so I'm guessing the users had cut-and-paste characters from a different language or special symbols (like the trademark character cut out from Word).
    I'd like to make a function or procedure to check for such characters. Basically I want to only include printable characters found only on an English keyboard. Are there any SQL or PL/SQL functions to check for this? Would the regexp_like function be helpful? If so then I'll probably need a reference table that translate between a character and it's chr(x) number for checking.
    Many thanks.

    Have you tried writing a loop to identify the squares in your character set?
    declare
    begin
    for i in 0...255 loop
    dbms_output.put_line(i);
    dbms_output.put_line(chr(i));
    end loop;
    /

  • Error in Package containing function

    Hi, Here is my package that i am getting error - "PLS-00103: Encountered the symbol "=" when expecting one of the following"
    create or replace package pre_pkg
    is
    FUNCTION FUN_DATE (a_date date)
    RETURN number;
    end pre_pkg;
    create or replace package body pre_pkg
    is
    function FUN_DATE (a_date date)
    return number
    is
    BEGIN
    IF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4} \d{2}:\d{2}:\d{2}.\d{3}$')
    AND (REGEXP_INSTR(a_date,'[AP]M',1)=0
    AND LENGTH(a_date) > 11
    AND LENGTH(TRUNC(to_char(TO_TIMESTAMP(a_date,'MM/DD/YYYY HH24:MIS.FF'),'YYYY')))=4)
    THEN
    return := 0;
    ELSIF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4} \d{2}:\d{2}:\d{2} [AP]M$')
    AND (REGEXP_INSTR(a_date,'[AP]M',1) > 0
    AND LENGTH(TRUNC(to_char(TO_DATE(a_date,'MM/DD/YYYY HH:MIS AM'),'YYYY')))=4)
    THEN
    return := 0;
    ELSIF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4}$')
    AND (REGEXP_INSTR(a_date,'[AP]M',1)=0
    AND LENGTH(TRIM(a_date)) < 11
    AND LENGTH(TRUNC(to_char(TO_DATE(a_date,'MM/DD/YYYY'),'YYYY')))=4)
    THEN
    return := 0;
    ELSE
    return := 1;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    return := 1;
    END FUN_DATE;
    END pre_pkg;
    Can any one help me in this regard. I am using oracle 10g.

    Good practice for writing functions it so have a single exit point at the end of the function, rather than embedding return statements throughout it e.g.
    create or replace package pre_pkg is
      FUNCTION FUN_DATE (a_date date) RETURN number;
    end pre_pkg;
    create or replace package body pre_pkg is
      function FUN_DATE (a_date date) return number is
        v_retval number;
      BEGIN
        IF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4} \d{2}:\d{2}:\d{2}.\d{3}$')
           AND (REGEXP_INSTR(a_date,'[AP]M',1)=0
           AND LENGTH(a_date) > 11
           AND LENGTH(TRUNC(to_char(TO_TIMESTAMP(a_date,'MM/DD/YYYY HH24:MIS.FF'),'YYYY')))=4)
        THEN
          v_retval := 0;
        ELSIF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4} \d{2}:\d{2}:\d{2} [AP]M$')
           AND (REGEXP_INSTR(a_date,'[AP]M',1) > 0
           AND LENGTH(TRUNC(to_char(TO_DATE(a_date,'MM/DD/YYYY HH:MIS AM'),'YYYY')))=4)
        THEN
          v_retval := 0;
        ELSIF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4}$')
           AND (REGEXP_INSTR(a_date,'[AP]M',1)=0
           AND LENGTH(TRIM(a_date)) < 11
           AND LENGTH(TRUNC(to_char(TO_DATE(a_date,'MM/DD/YYYY'),'YYYY')))=4)
        THEN
          v_retval := 0;
        ELSE
          v_retval := 1;
        END IF;
        RETURN v_retval;
      EXCEPTION
        WHEN OTHERS THEN
          return := 1;
      END FUN_DATE;
    END pre_pkg;
    /Other things to note:
    WHEN OTHERS exception is considered poor practice, especially if it doesn't raise an exception itself. Exception handlers should be written to cater for whatever exceptions you are expecting to happen, not a capture-all. Looking at your code, I wouldn't expect it to be raising any exceptions from the code itself.
    Curiously, your function seems very odd. It looks like you are trying to validate that a date is valid, but by virtue of the fact that it's a DATE datatype it will (with very few exceptions e.g corrupt dates) be valid. The fact that you pass a DATE datatype as the first parameter of your REGEXP_LIKE functions means that it is doing an implicit conversion of that DATE datatype to a VARCHAR2 datatype based on your sessions NLS_* settings, which could vary and cause your function to fail in other sessions. If the date were actually being passed into the funciton as a string (varchar2) then there are simpler ways to validate whether it's a valid date or not, simply by trying to turn the string into a DATE datatype and capturing the exception for invalid dates.

  • Query to apply regexp_like for patterns specified in different table

    Hi all,
    with table trap_store as ( vb clob) and table conf as (patten varchar2(20))
    Need to retrieve records from trap_store where data in vb column matches patterns in conf table.
    Presently planning to use regexp_like function ie; regexp_like(vb,'Start').
    In the above query, have hardcoded the pattern as 'Start'. But, Patterns are present in different conf table. Each row of trap_store table ie; each value of vb column in trap_store table should be matched with all the patterns of conf table.
    How to apply all the patterns of conf table ?

    It's possible to write a script with a LOOP over the pattern table to generate queries or generate a filter, and then execute it via Dynamic SQL (depends on the pattern table size)

  • Find a number in a string

    Hi all,
    I've got a text field in my source table that can contain both numbers and characters, like any normal varchar2. The issue is with a field that should contain insurance numbers, but also thinks "hello world" will do! A change to the application will not help, nor any constraints on database level will do!
    I want to determine if a record has any numbers, if it has, than i validate it to ok, if not, so only characters are in the field, than i want to validate it to not ok.
    My solution so far is that I use a case statement with a translate, which translates all characters to a zero and leaves numbers untouched. When result is larger than zero it is valid
    So 'ABC123 ' would return 0001230 and evaluate to true, even so '0 123 ABC' would translate 001230000 and will also evaluate to true, and ABC will evaluate to false, exactly how I like it to be.
    But...the translate function has all charaters that are directly visible on my keyboard, in upper and lower case, and now i bumped into a special character. An E with two dots above (alt 137).
    now to prevent me from building a solution that has all the characters in it which I could ever produce in my translate is there any smarter sollution?
    Hope you guys (or girls) can help!
    Cheers,
    Gilles

    Gilles,
    What you need is a regular expression. Below is a simple example using the Oracle regexp_like function to determine if the function's input has any numeric characters in it, and returns 1 if it does, otherwise it returns 0:
    create or replace function find_digit(p_string varchar2) return number is
    l_ret boolean;
    begin
    l_ret := regexp_like(p_string, '[[:digit:]]');
    if l_ret then return 1; else return 0; end if;
    end;
    You should be able to use something like this. you can use the regexp_like function in the WHERE clause of your SQL or wrap it in to a function like this you need it in the SELECT clause (as the return type of regexp_like is boolean which isn't supported in the SELECT clause).
    hope this helps,
    Borkur

  • Regular expression fro date time format

    Hi
    im trying to use regexp_like() function in my where clause as
    select 1 from dual where REGEXP_LIKE(''31/12/2003 11:59:59 PM',regular expr pattern)
    I tried this pattern using the following regular expresion which i found on a web site. but this didnt work.
    '^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))(\/)(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M)?)|([01]\d|2[0-3])(:[0-5]\d){1,2})?$'
    can some one suggest me an alternative regular expression for this.
    P.S : i donot want to use to_char/ to_date functions.
    Regards
    Vibhuti

    Hi elic
    I tried with your suggestion yet it didnt work. This is my query
    select 1 from dual where regexp_like('03/02/2000 02:59:59 AM','^(?=[0-9])(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9][0-9])?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?: |$))|(?:2[0-8]|1[0-9]|0?[1-9]))(\/)(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9][0-9])?[0-9][0-9](?:(?= [0-9]) |$))?(((0?[1-9]|1[012])(:[0-5][0-9]){0,2}( [AP]M)?)|([01][0-9]|2[0-3])(:[0-5][0-9]){1,2})?$')
    this should return 1 as output. but its not returning any thing. Im currently working on 10g R2 database. Please help me out, its very critical. Im trying to learn regualr expressions but im unable to crack this code.
    Regards
    Vibhuti

  • String check problem

    I have a doozy of a problem on my hands. My company has introduced a password policy that every user must me now. Some of my criteria is that a password must contain at least one symbol and at least one number. In 10g I can use REGEXP_LIKE function, but I am running 9i. I have tried to use translate, OWA_PATTERN function, everthing. How can I take a string variable, and test to see if there is a symbol in the text or a number. I want to be able to return a true/false value?
    Please advise?

    Like Kamal says, use built-in functionality FIRST.
    Failing that, presumably you would write something like this (I forget the exact naming standard for the password verify function).
    CREATE FUNCTION valid_password (
       p_password IN VARCHAR2)
       RETURN BOOLEAN
    IS
       FUNCTION contains_at_least_one (
          p_string IN VARCHAR2,
          p_characters IN VARCHAR2)
          RETURN BOOLEAN
       IS
       BEGIN
          RETURN LENGTH (TRANSLATE (p_string, 'X' ||
            p_characters, 'X')) < LENGTH (p_string);
       END;
    BEGIN
       RETURN contains_at_least_one (p_password, '0123456789')
          AND contains_at_least_one (p_password, '!£$%^&*(){}~@??|<>');
    END;

  • Multiple like statements in a query

    Hi,
    I wonder if it's possible to have multiple like statements in a query.
    suppose instead of
    select * from someTable where remarks like '%ab%'
    I want to search for many string patterns such as '%edi%' '%odi%' '%di%' '%gf%' '%od%' '%podi%' etc. in one query.
    BTW, the table contains many millions of records.
    Regards
    Crusoe
    Edited by: Crusoe on 19-Jan-2009 00:25

    Crusoe wrote:
    This regexp_like function does not work with the development server to which I have rights to create tables etc. I guess it only works in 10g or greater. However i tried a quick test in the production server and it worked. It returned rows where the values between the | characters were found anywhere in the field ( I must learn this regex syntax sometime). Yes, regular expressions are 10g upwards. (You really should have your development server reflect your production server)
    There was a thread a while back giving an introduction to regular expressions...
    Introduction to regular expressions ...

  • Locating row with invalid number from  table with few million rows

    We need to query the a table or a view of same to obtain a id of type VARCHAR with bind value being NUMBER. Any attempts in this regard I try seem to result ORA-01722: invalid number. Once case is below here
    SQL> select TEXT_ID FROM ATT_TABLE where to_number(TEXT_ID) = 9411956;
    select TEXT_ID FROM ATT_TABLE where to_number(TEXT_ID) = 9411956
    ERROR at line 1:
    ORA-12801: error signaled in parallel query server P010
    ORA-01722: invalid number
    1. TEXT_ID column is meant to have numeric values in VARCHAR type. It is possible that some record / row is not complying. How can I locate the non-complying records ?
    2. What would be a VIEW definition that would return only records with valid numeric data in TEXT_ID column.
    Edited by: bonjonbovi on Feb 13, 2009 3:58 PM

    Of course the regexp_like is really cpu expensive, but there's no other solution in your situation
    The only way to differ numberic value from character, is REGEXP_LIKE function
    But you can do it using PL/SQL
    BEGIN
       FOR c IN (SELECT TO_NUMBER (ID) ID
                   FROM test_number)
       LOOP
          DBMS_OUTPUT.put_line (c.ID);
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          NULL;
    END;

  • Regular Expression in SELECT

    Purpose : Write a query that will identify patterns in a fiels.
    It will recognize that 801 can be written as 80[1,2,3] or [8,9]01 or 80[1:5]
    WITH t AS
              SELECT column_value AS col1
                   FROM TABLE (SYS.dbms_debug_vc2coll
    ('80[1,2,3]', '81[1-5]9', '[8,9]01', '80[1:5]')
    SELECT * FROM t;
    I tried a few different things, but couldn't get the right expression. I am not even sure if I can do this in one statement, because there are multiple ways that the expression in the column could be written in.
    Any hel will be great.

    In 10g you can use REGEXP_LIKE function, prior to that there are functions in OWA_PATTERN which may be of use
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> SELECT b.column_name, a.column_value
      2  FROM   TABLE (varchar2_table (
      3            '80[1,2,3]', '81[1-5]9', '[8,9]01', '80[1:5]')) a,
      4        (SELECT '801' column_name
      5         FROM   dual) b
      6  WHERE  REGEXP_LIKE (b.column_name, a.column_value);
    COLUMN_NAME          COLUMN_VALUE
    801                  80[1,2,3]
    801                  [8,9]01
    801                  80[1:5]
    SQL>

  • Validation General Questions

    I have a couple of general questions on validation.
    1) I have a text field defined as a "Required" field (it is using the form_required template). Must I also create a NOT NULL validation on this field as well? It seems that I should not have to do this. However, if I do not create this NOT NULL validation, then clicking on a Submit button while this field is empty is not generating any error message. But when I include a NOT NULL validation, then I do get an error message.
    2) This question is related to the first. I tried creating a regular expression validation on my field in which I use the pattern
    [[:alnum:]]{1,}[|$#&_?]+
    The field should allow the user to type-in a string consisting of 1 or more alphanumeric characters (it could be a foreign language characters as well)
    and 1 or more special characters like $ or #.
    I thought this would also generate an error message if the user clicks the Submit button while leaving the field empty. But, again, I get no error message. Why?
    Thank you in advance for any insight on this.

    Thanks very much, Justin.
    When I saw the regexp_like() function in your reply, I am wondering if, perhaps, you might also have some insight into how I can ckeck if a field contains non-English type characters (i.e., mult-byte characters). I already posted a question about this an hour ago but have not gotton any replies as yet. In my post I asked about using the regular expression pattern [[:alnum:]] since the docs state that this will check for mult-byte characters. And so, I thought if perhaps there is some function I might use to return a boolean TRUE if a field contains non-English characters versus a FALSE if it contains only English characters.
    Any insight in this would be most appreciated.
    Thanks again for your help.

  • How to create function based index on REGEXP_LIKE funtion

    Dear Gurus,
    I have below table CDR
    Name Null Type
    STARTTIME NOT NULL DATE
    SUBSCRIBERNUMBER NOT NULL NUMBER
    CALLINGNUMBER NOT NULL VARCHAR2(20)
    CALLEDNUMBER NOT NULL VARCHAR2(20)
    I am regularly firing below query
    SELECT count(*)
    FROM CDR data
    WHERE STARTTIME BETWEEN '01-Jul-2009 00:00:00' and '31-May-2012 23:59:59'
    AND REGEXP_LIKE(data.SUBSCRIBERNUMBER, '^98721[0-9]*[5]+[0-9]*$');
    since there is REGEXP_LIKE is being used, Can I use function based index to improve performance.
    Thanking in advance
    Sanjeev

    Hi,
    you can do it that way :Scott@my11g SQL>create table test (name varchar2(30));
    Table created.
    Scott@my11g SQL>create index myfbi on test(case when regexp_like(name,'^98721[0-9]*[5]+[0-9]*$') then 1 else 0 end);
    Index created.
    Scott@my11g SQL>explain plan for
      2  select * from test where case when regexp_like(name,'^98721[0-9]*[5]+[0-9]*$') then 1 else 0 end = 1;
    Explained.
    Scott@my11g SQL>/
    PLAN_TABLE_OUTPUT
    Plan hash value: 140237472
    | Id  | Operation                   | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |       |     1 |    20 |     1   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| TEST  |     1 |    20 |     1   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | MYFBI |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access(CASE  WHEN  REGEXP_LIKE ("NAME",'^98721[0-9]*[5]+[0-9]*$')
                  THEN 1 ELSE 0 END =1)
    Note
       - dynamic sampling used for this statement (level=2)
    19 rows selected.

  • REGEXP_LIKE help with literal single-quote

    I'm trying to write a check constraint to validate email addresses that may include an apostrophe in the email address. Such as joe.o'[email protected] Here is my sample setup:
    create table emails
    ( email_address varchar2(150)
    insert into emails values('[email protected]') ;
    insert into emails values('[email protected]') ;
    insert into emails values('joey.o''[email protected]') ;
    commit;
    sql> select * from emails;
    EMAIL_ADDRESS
    [email protected]
    [email protected]
    joey.o'[email protected]
    alter table emails add constraint email_address_format_ck
        CHECK ( REGEXP_LIKE ( email_address, '^[a-z0-9._%-]\'?+@[a-z0-9._%-]+\.mil$','c'));
    ERROR at line 2:
    ORA-00911: invalid characterIt doesn't like *\'?*
    My understanding is this means one or more single-quotes. Anyone know the correct syntax to accept apostrophes?

    Hi,
    jimmyb wrote:
    ... insert into emails values('joey.o''[email protected]') ;
    That's the correct way (actually, that's one correct way) to include a single-quote in a string literal: use 2 single-quotes in a row.
    ... alter table emails add constraint email_address_format_ck
    CHECK ( REGEXP_LIKE ( email_address, '^[a-z0-9._%-]\'?+@[a-z0-9._%-]+\.mil$','c'));Here, the 2nd argument to REGEXP_LIKE is a string literal, just like 'joey.o''[email protected]' was a string literal.
    To include a single-quote in the middle of this string literal, do the same thing you did before: use 2 of them in a row:
    CHECK ( REGEXP_LIKE ( email_address, '^[a-z0-9._%''-]+@[a-z0-9._%-]+\.mil$','c'));There were a couple of other problems, too.
    I'm sure you meant for the apostrophe to be inside the square brackets. Inside square brackets, \ does not function as an escape character. (Actually, single-quote has no special meaning in regular expressions, so there's no need to escape it anyway.)
    I'm not sure what the '?' mark was doing; I left it out.
    Of course, you'll have trouble adding the CHECK constraint if any existing rows violate it.
    Edited by: Frank Kulash on Feb 10, 2012 6:52 PM

  • How to find Unused variables in procedure,function or package

    Hi all,
    I want find out unused variables in procedure, function and package.
    I have written below script for doing this ,but i am not getting the expected result.
    Kindly help me to improve the below code ,so that it works as expected.
    {code}
    version details
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE    11.2.0.3.0    Production"
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    {code}
    {code}
    What i Have tried is This.
    DECLARE
      V_OBJECT_NAME VARCHAR2(30) :='PR_PRINT';
      V_OBJECT_TYPE VARCHAR2(30) :='PROCEDURE';
      CURSOR C1(CP_OBJECT_NAME VARCHAR2,CP_OBJECT_TYPE VARCHAR2)
      IS
        SELECT US.NAME,
          US.TYPE,
          US.LINE,
          REGEXP_SUBSTR(US.TEXT,'.* ') AS var_name
        FROM user_source US
        WHERE name=CP_OBJECT_NAME
        AND type  =CP_OBJECT_TYPE
        AND REGEXP_LIKE (TEXT,'(v_|g_|c_)','i')
        AND REGEXP_LIKE (TEXT,'^[^ ]')
        AND REGEXP_LIKE (TEXT,'^[^--]') ;
      v_count NUMBER ;
    BEGIN
      FOR i IN C1(V_OBJECT_NAME,V_OBJECT_TYPE)
      LOOP
        SELECT COUNT( *)
        INTO V_COUNT
        FROM USER_SOURCE US
        WHERE US.NAME=I.NAME
        AND REGEXP_LIKE(US.TEXT,i.var_name,'i' )
        AND US.LINE<>I.LINE;
        IF V_COUNT  =0 THEN
          DBMS_OUTPUT.PUT_LINE('variable '||I.VAR_NAME||'Is declared at line#'||I.LINE||' But no where used');
        END IF ;
      END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE('p_err_code := '||SQLCODE||dbms_utility.format_Error_backtrace());
      DBMS_OUTPUT.PUT_LINE('p_err_msg := '||sqlerrm);
    END ;
    {code}
    Thanks,
    P Prakash

    Hello,
    as suggested by padders you can use PL/Scope, an example:
    ALTER SESSION SET PLSCOPE_SETTINGS='IDENTIFIERS:ALL';
    CREATE OR REPLACE PACKAGE ui_test1 AS
        global_number   NUMBER := 9;
    FUNCTION get_number
        RETURN NUMBER;
    END ui_test1;
    CREATE OR REPLACE PACKAGE BODY ui_test1 AS
    PROCEDURE setNull
         p_varchar          IN OUT VARCHAR2
    IS
    BEGIN
        p_varchar := NVL(p_varchar,'NULL');
    END setNull;
    FUNCTION get_number
        RETURN NUMBER
    IS
        FUNCTION setZero
             p_number       IN NUMBER
            RETURN NUMBER
        IS
        BEGIN
            RETURN NVL(p_number,0);
        END setZero;
    BEGIN
        RETURN global_number;
    END get_number;
    END ui_test1;
    SELECT  DISTINCT
            object_name
           ,object_type
           ,name
           ,type
           ,line
           ,col
    FROM    all_identifiers obj
    WHERE   obj.owner = USER
    AND     obj.usage = 'DECLARATION'
    AND     obj.object_name = 'UI_TEST1'
    AND     NOT EXISTS (
                SELECT  1
                FROM    all_identifiers with_rh
                WHERE   obj.signature = with_rh.signature
                AND     with_rh.usage IN ('REFERENCE','CALL','ASSIGNMENT')
    ORDER BY TYPE
            ,object_name
            ,object_type
            ,name;
    OBJECT_NAME  OBJECT_TYPE   NAME       TYPE       LINE COL
    UI_TEST1     PACKAGE       GET_NUMBER FUNCTION     11  10
    UI_TEST1     PACKAGE BODY  SETZERO    FUNCTION     35  14
    UI_TEST1     PACKAGE       UI_TEST1   PACKAGE       1   9
    UI_TEST1     PACKAGE BODY  SETNULL    PROCEDURE    12  11
    Regards
    Marcus

  • Validate PO Box  with RegExp_Like

    I'm trying to validate strings with variations of PO BOX, P.O. BOX 3232, Post Office Box 2323. The functions is like so:
    CREATE or REPLACE FUNCTION FN_CHK_PO_BOX (v_str in VARCHAR2)
    RETURN VARCHAR2
    AS
    BEGIN
       IF REGEXP_LIKE (v_str, '^[p|P][\s]*[o|O][\s]*[b|B][\s]*[o|O][\s]*[x|X][\s]*[a-zA-Z0-9]*|\b[P|p]+(OST|ost|o|O)?\.?\s*[O|o|0]+(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]+\.?\s+[#]?(\d+)*(\D+)*\b$') THEN
              RETURN 'PO BOX Not Permitted';
       ELSE
              RETURN NULL;
       END IF;
    END FN_CHK_PO_BOX;
    select FN_CHK_PO_BOX('P.O. BOX 2323') from dual;For some reason it keeps evaluating to NULL and not returning "PO BOX Not Permitted" as expected. Not sure, any ideas?

    The patterns depends on how flexible you want to be with the string, take a look at those rows that were left out:
    SQL> with t as (
      2  select 1 num, 'P.O. BOX 2323' expr from dual union
      3  select 2, 'POST OFFICE BOX 2323' from dual union
      4  select 3, 'P O BOX 2323' from dual union
      5  select 4, 'P O BOX 2323' from dual union
      6  select 5, 'PO BOX 2323' from dual union
      7  select 6, 'p.o boX 2323' from dual union
      8  select 7, 'pO. BoX 2323' from dual union
      9  select 8, 'P. OFFICE BOX 2323' from dual union
    10  select 9, 'POST O. BOX 2323' from dual union
    11  select 10, 'POST OFF. BOX 2323' from dual union
    12  select 11, 'P.O OFFICE BOX 2323' from dual union
    13  select 12, 'POST OFFICE BOX 2323' from dual union
    14  select 13, 'POST OFFICE BOX ' from dual union
    15  select 13, 'POST OFFICE BOX ABC' from dual
    16  )
    17  select expr
    18    from t
    19  where regexp_like(expr
    20        , '^((P\.?\s*O\.?)|(POST\s+OFFICE))\s*B\s*O\s*X\s*\d+$','i')
    21  /
    EXPR
    P.O. BOX 2323
    POST OFFICE BOX 2323
    P O BOX 2323
    P O BOX 2323
    PO BOX 2323
    p.o boX 2323
    pO. BoX 2323
    POST OFFICE BOX 2323
    8 rows selected
    SQL>

Maybe you are looking for

  • HP LaserJet 1102w printer settings on WRT54G2-V1 lost after power is turned off

    I have installed the HP drivers for  my HP LaserJet 1102w printer on my Windows 7 (64 bit)  Professeional and Windows XP laptops.They both print fine over the network using the WRT54G2-V1 router immediately after installing the drivers. However after

  • Audio in menübar is not working right!

    Hi i got a little problem here when i switch on my mac the Audio sign in the menü bar is like this (in the picture) this is not everytime i swich it on but sometimes. I had also some other problems with os x lion so i completly deleted the hard drive

  • How to get beats audio working on windows 7

    Just downloaded windows 7 on my hp envy dv7 and my beats audio no longer works. Is there a driver I need to download to correct the issue? Or is there some configuring I have to do? This question was solved. View Solution.

  • Can't Downgrade firmware on HP Officejet 8600 Plus!!!

    Hi In my office I have to scan and copy many many Legal size documents per day, I recently have aquired this awesome printer Hp Officejet 8600 Plus The first day I was able to scan a bunch of 2 sided legal paper, very awesome, but then I upgraded the

  • Reading data from ERP 6.0 (using BAPI) to VBA (MS Excel)

    Hi Guys, I want to learn something about RFC called from VBA using BAPI's. I was able to write a simple VBA makro to read data from single record, but now I would like to wirte something using GetData. Here I have problems and could not find useful i