Help in using  regexp_replace function.

Hi everyone,
i have a string something like this..
varchar2(100) := 'SUBF1.AAAAAAAAAAAAA.SUBF1.BBBBBBBBBB.SUBF1'
i want to replace the FIRST OCCURANCE of SUBF1 with some other string.
EX:
For the above string if i replace the FIRST OCCURANCE of SUBF1 with 'Hi' the output gonna be like this
OUTPUT : 'Hi.AAAAAAAAAAAAA.SUBF1.BBBBBBBBBB.SUBF1'
Sorry if this question had asked previously in this FORUM.
Thanks in advance..
phani

test@ora>
test@ora>
test@ora> --
test@ora> with t as (
  2    select 'SUBF1.AAAAAAAAAAAAA.SUBF1.BBBBBBBBBB.SUBF1' as x from dual)
  3  --
  4  select x,
  5         regexp_replace(x,'SUBF1','Hi',1,1) as modx
  6  from t;
X                                          MODX
SUBF1.AAAAAAAAAAAAA.SUBF1.BBBBBBBBBB.SUBF1 Hi.AAAAAAAAAAAAA.SUBF1.BBBBBBBBBB.SUBF1
1 row selected.
test@ora>
test@ora>isotope

Similar Messages

  • Help in using listagg function for more than 8000 char.

    Hi Friends,
    Need you urgent help in using listagg function for more than 8000 char.
    I did the below sample SQL and in "e_orig" and "d_orig" for upto 4000 char it is working fine but I have to use it for more than 8000 char. and it is giving error,
    I checked the listagg function is having limitation of 4000 char.
    I tried but I am unable to achive this. Can someone provide me a sample example to achive this
    select d.dname,d.loc,e.hiredate
    ,listagg(e.ename,',' ) within group (order by e.deptno) over (partition by e.deptno) as e_orig
    ,listagg(e.ename, ',') within group (order by e.sal) over (partition by e.deptno) as d_orig
    from emp e, dept d
    where e.deptno=d.deptno;[ This is my first post, I gone through the guideline for posting a post , and try to go according to that ( I have not pasted here create table and insert as I have used basic table emp, dept for example), please let me know if still I should give this, I will take care from my next post ]
    Thanks in advance

    Interesting, I didn't know you could do that, but...
    BluShadow wrote:
    You could write some PL/SQL code that does it all for you, but that would involve loops and would be slow.Well, objects are written in PL/SQL aren't they? And presumably there'll be implicit looping too? So it's not at all obvious that this method will be faster than doing the joining in PL/SQL in memory. The only way to find out is to benchmark them - so I have done that.
    I noticed that OP's ref cursor actually only ever retrieves a single record for a bound department number, so I decided the best thing would be to test using a procedure that passes an output string back. I selected all (109) employees and put spaces in to ensure above 4000 characters. I also noticed that as he is using PL/SQL he probably can use a VARCHAR2 type, but just not ListAgg in the query, so I wrote short procedures as follows:
    SimpleAggChr     - bulk collect and array processing, VARCHAR2 output
    ClobAggPrc     - the custom aggregation method, CLOB output
    SimpleAggClob     - bulk collect and array processing, CLOB output
    I then wrote a driving script that calls them in the order above and times each call (I like benchmarking so I have my own timing object to make it easy). I then print the lengths for checking, and my object writes the timings to my output table. Running a few times I got varying results, but generally it looks like there isn't a lot to choose between them for performance.
    Here's the procedure code:
    CREATE OR REPLACE TYPE char100_list_type AS TABLE OF VARCHAR2(100)
    CREATE OR REPLACE PROCEDURE SimpleAggChr (x_out OUT VARCHAR2) IS
      l_enames     char100_list_type;
    BEGIN
      SELECT first_name || '                                        ' || last_name
        BULK COLLECT INTO l_enames
        FROM employees
       ORDER BY salary;
      FOR i IN 1..l_enames.COUNT LOOP
        x_out := x_out || l_enames(i) || ',';
      END LOOP;
    END SimpleAggChr;
    CREATE OR REPLACE PROCEDURE SimpleAggClob (x_out OUT CLOB) IS
      l_enames     char100_list_type;
    BEGIN
      SELECT first_name || '                                        ' || last_name
        BULK COLLECT INTO l_enames
        FROM employees
       ORDER BY salary;
      FOR i IN 1..l_enames.COUNT LOOP
        x_out := x_out || l_enames(i) || ',';
      END LOOP;
    END SimpleAggClob;
    SHO ERR
    PROMPT ClobAggPrc
    CREATE OR REPLACE PROCEDURE ClobAggPrc (x_out OUT CLOB) IS
    BEGIN
      SELECT clobagg(first_name || '                                        ' || last_name || ',')
        INTO x_out
        FROM employees
       ORDER BY salary;
    END ClobAggPrc;
    SHO ERRand the driving script:
    SET SERVEROUTPUT ON
    SET TIMING ON
    DECLARE
      l_enames_c1     CLOB;
      l_enames_c2     CLOB;
      l_enames_v     VARCHAR2(32767);
      l_timer     timer_set_type := timer_set_type ('Aggregation');
    BEGIN
      Utils.g_id := 'Aggregation';
      SimpleAggChr (l_enames_v);
      l_timer.Increment_Time ('SimpleAggChr');
      ClobAggPrc (l_enames_c1);
      l_timer.Increment_Time ('ClobAggPrc');
      SimpleAggClob (l_enames_c2);
      l_timer.Increment_Time ('SimpleAggClob');
      DBMS_Output.Put_Line ('SimpleAggChr returned string of length ' || Length (l_enames_v));
      DBMS_Output.Put_Line ('ClobAggPrc returned string of length ' || Length (l_enames_c1));
      DBMS_Output.Put_Line ('SimpleAggClob returned string of length ' || Length (l_enames_c2));
      l_timer.Write_Times;
    END;
    SET TIMING OFF
    SET LINES 150
    SET PAGES 1000
    COLUMN id FORMAT A30
    COLUMN line_text FORMAT A120
    SELECT line_text
      FROM output_log
    WHERE id = 'Aggregation'
    ORDER BY line_ind
    /and the results:
    SimpleAggChr returned string of length 5779
    ClobAggPrc returned string of length 5779
    SimpleAggClob returned string of length 5779
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:27.05
    LINE_TEXT
    Timer Set: Aggregation, constructed at 03 Nov 2011 16:27:07, written at 16:27:35
    ================================================================================
    [Timer timed: Elapsed (per call): 0.02 (0.000016), CPU (per call): 0.01 (0.000010), calls: 1000, '***' denotes corrected
    line below]
    Timer              Elapsed          CPU          Calls        Ela/Call        CPU/Call
    SimpleAggChr          9.84         0.36              1         9.84400         0.36000
    ClobAggPrc            9.37         0.32              1         9.37400         0.32000
    SimpleAggClob         8.25         0.22              1         8.25000         0.22000
    (Other)               0.00         0.00              1         0.00000         0.00000
    Total                27.47         0.90              4         6.86700         0.22500
    13 rows selected.

  • Alternate without using regexp_replace function

    SELECT
      REGEXP_REPLACE(phone_number,
                     '([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})',
                     '(\1) \2-\3') "REGEXP_REPLACE"
                     FROM employees;
    is there any alternate without using regexp_replace function.........

    Another way
    (eliminating instr function.. as your problem focusses on a fixed length)
    WITH t AS (SELECT '112.345.6789' str FROM DUAL),
         tt AS (SELECT REPLACE (str, '.') str FROM t)
    SELECT    '('
           || SUBSTR (str, 1, 3)
           || ') '
           || SUBSTR (str, 4, 3)
           || '-'
           || SUBSTR (str, 7)
      FROM tt;
    Cheers,
    Manik.

  • Help on Using Analytical Functions

    I am hetting error when i use Analytical functions in Expressions
    AVG( INGRP1.Test1 ) OVER (PARTITION BY INGRP1.Test2)
    Error is as follows
    Line 1, Col 28:
    PLS-00103: Encountered the symbol "OVER" when expecting one of the following:
    * & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || multiset member SUBMULTISET_

    Hi,
    the syntax of this part of the sql statement is okay. Please post the complete statement to identify the error.
    Sometimes oracle identifies the wrong point for the error.
    Regards,
    Detlef

  • Need help in using replace function with special characters

    I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
    The data looks like this:
    CREEK&#39;S LANE
    ie for a street named CREEK'S LANE.
    I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
    When I try the query below I get prompted for substitution variable value.
    I don't seem to be able to find the right syntax to make this query work.
    SELECT REPLACE (street_name, '&#39;', '''')
    FROM
    streets WHERE street_id = 1
    Does anybody know how to do this?
    Any help would be much appreciated.
    Thanks.
    George

    george91 wrote:
    I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
    The data looks like this:
    CREEK'S LANE
    ie for a street named CREEK'S LANE.
    I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
    When I try the query below I get prompted for substitution variable value.
    I don't seem to be able to find the right syntax to make this query work.
    SELECT REPLACE (street_name, ''', '''')
    FROM
    streets WHERE street_id = 1
    Does anybody know how to do this?
    Any help would be much appreciated.
    Thanks.
    GeorgeHa! The codes you specified rendered in the HTML, but showed properly when I listed your original posting above. I didn't understand what you meant initially because the 5-character string represenation got rendered as the quote that you said you weren't able to get - a display problem.
    You're getting prompted for the substituon variable because of the ampersand; you appear to be doing this in SQL*PLUS. The first thing I would try is to SET DEFINE OFF when using the ampersands to see if that works. If That doesn't work check the docs to delmit the ampersand (I think its a backslash before it but can't remember offhand). Another, harder option might be to use the TRANSLATE function replacing the literal character instead of using REPLACE (though replacing a quote will be a little tricky). If you're on 10g also consider using the advanced quoting
    Good luck!
    Edited by: riedelme on May 22, 2009 12:45 PM

  • Need help in using sleep function in pl/sql

    Hi,
    need help:
    I have a condition where i want to validate total_pass=total_fail and
    I want to use the sleep function in a pl/sql where i want to wait for 2 minutes ie.checking
    whether total_pass=total_fail based upon class_id .
    I have the data in the table as:
    CLASS_ID TOT_PASS TOT_FAIL
    1 10 10
    2 5 4
    3 6 6
    4 7 5
    Any help will be needful for me

    I'm not quite sure what you are lookg for here, but whatever it is, your code as posted won't do it. You will never break out of the WHILE r_Class.Tot_Pass = r_Class.Tot_Fail loop, since these values will never change because you never get the next record form the cursor.
    From your original data, it looks like your cursor will return multiple rows which implies to me that you want to fetch the first row from the cursor, check if tot_pass = tot_fail, if they are equal, sleep for two minutes then get the next row. This does not make sense to me. Once the select in the cursor is executed, the data it returns will not change due to Oracle's read consistency model, so there seems to me no point in the sleep.
    The other alternative I can see is that you want to check all the returned rows, and if tot_pass = tot_fail for one of the rows (or possibly for all of the rows), then you want to sleep and try again.
    If you can explain in words what it is you are trying to accomplish, someone will be able to point you to a solution.
    John

  • Using ip-helper without using DHCP functionality

    Hello,
    I am fairly new to Cisco, and am after a bit of help.
    My scenario:
    We have a new domain setup on a new VLAN (3), seperate from our current infrastructure VLAN (2).
    The new domain controllers provide DHCP for our new servers, and I would also like them to handle DHCP for wireless clients.
    We have one DHCP scope 10.0.0.0 255.255.0.0, and I would like to assign all wireless clients an IP in the 10.0.6.0 range.
    My thinking on the best way to do this, is with a DHCP policy, that looks at the relay agent information.
    I would then set the ip-helper address, on the port the wireless access point is connected to on the Cisco, to point to the DHCP server.
    Then for that same port, I would seb a subscriber id in the relay agent information, and use this string to set the IP assigned to that device.
    Looking into doing this, it seems the Ciscos DHCP functionality has to be turned on in order to use ip-helper.
    In my config, I cannot tell if DHCP is enabled or not, I can see neither "service dhcp", nor "no service dhcp" in the config.
    Assuming I were to turn it on using "service dhcp", can I then leave the actual functionality turned off? i.e. turn on the DHCP service, but not have it assign IP addresses?
    Also, does turning it on cause any downtime or disruption?
    I think I have to run these commands:
    conf t
    service dhcp
    interface GigabitEthernet2/40
    Ip helper-address 10.0.0.1
    Ip dhcp relay information option-insert
    Ip dhcp relay information option subscriber-id “wireless”
    I know these are probably simple questions, so please forgive my ignorance.
    James

    Ok here goes.
    On my domain controller/DHCP server, I have a scope setup of 10.0.0.0 255.255.0.0, and is set with an IP range of 10.0.0.1 - 10.0.6.253
    I have various reservations in place, and a working policy to assign thin clients an IP of 10.0.2.X based on their MAC address.
    I have then created a second policy, that should be assigning IPs in the 10.0.6.0 range, based on relay agent information, subscriber ID. This is a HEX value, so whatever string I enter on the Cisco, has to be converted to HEX.
    This DHCP server is on the same VLAN 3. The VLAN interface on the Cisco has IP of 10.0.0.254 255.255.0.0
    The wireless clients are getting IP addresses, but not within the range specified by the policy, so they are getting any address between 10.0.0.1 and 10.0.6.253 that is not already in use.
    Image 1 shows the vlan interface, where I have set the helper address, relay information option-insert, and subscriber id of "wireless".
    Image 2 shows the config on the port that my access point is connected to.
    Image 3 shows the value of the policy on the DHCP server, based on subscriber ID
    Image 4 shows the string "wireless" converted to HEX
    Image 5 shows the IP range that the policy should be using
    Image 6 shows "Edss-iPhone" as have an IP not within the correct range
    Hopefully that helps.

  • Require help in using appropriate functions in Transformation

    Hi All,
    The following is my requirement.
    In the below XML, if the value of <payment> is any of the values (10, 20, 30, 40, 50, 60) then the xml tag <result> in the target should be assigned 'Y' or else it should be 'N'.
    Also the list of values 10, 20, 30, 40, 50, 60 should be retrieved from database.
    So could someone help me out on how do I proceed with regards to transformation.
    Source XML data
    <root>
    <subElement>
    <payDetails>
    <payment>10</payment>
    <invoiceDetails>
    <invoice>Test1</invoice>
    </invoiceDetails>
    <payment>110</payment>
    <invoiceDetails>
    <invoice>Test2</invoice>
    </invoiceDetails>
    </payDetails>
    </subElement>
    </root>
    As per the requirement in the target XML should be as follows:
    <main>
    <result>Y</result>
    <result>N</result>
    </main>
    Thanks,
    Prad

    Thank you, Ravdeep and Dhaval.
    Dhaval, I could not ake database route because, I have very huge xml getting stored in the database in a CLOB column. I cannot use the decode function on it and make this transformation at the database end. The source XML I provided in this example is a sample and not my exact XML data that I fetch from database.
    Ravdeep, I can use the logical OR but do not know how to capture the list of values as they are not constant always. i.e once they can be (10,20,20,40) next time they can be (30,50,60) so on.
    using DB adapter I can get the list of values, but while comparing with <payment> while transforming how do I refer my list of values retrieved from database.
    Thanks,
    Prad

  • Help needed using REPLACE function

    Post Author: Domo
    CA Forum: Formula
    I need to swap out HTML special characters for their corresponding symbols.
    The text field in question obviously contains many number codes, e.g. &#39; for an apostrophe (') and I would like to write a formula which replaces these for it's corresponding text character.
    How would I go about this? I know how to use replace for single entries, e.g. Replace(, "&#39;", "'"); but how do I apply this to multiple entries?
    I have been using Crystal syntax for other formulas in the report (not sure if Basic and Crystal can be used?).

    Post Author: Domo
    CA Forum: Formula
    Yeah it seems using a combination of Basic and Crystal syntax is possible in CR9.
    I simply created the following formula in the end:
    dim strInputstrInput = {TEXT.STRING}formula = replace(replace(replace(replace(replace(replace(replace(replace(replace(strinput, "<P>", "")," ", " "), "&#39;", "'"), "</P>", ""), "&#58;", ":"), "<BR>", CHR(13)), "&#60;", "<"), "&#62;", ">"), "&#34;", "''")
    Looks a little messy but it works!

  • Regexp_replace function

    Hi,
    First of all, thanks for viewing and I appreciate your great help.
    I am new to 11g and trying explore whether this is doable or not using regexp_replace function.
    Here is my requirement.
    I have a column, which has 300 character fixed-width text, so i know 1 to 9 characters are SSN, 11 to 20 characters are Date of Birth, 21 to 45 are belongs to an ID (The ID contains upto 25 characters, Some time it will contain only 10 characters, some times 20. It depends, So if it contains only 10, the remaining 15 will be spaces ) etc..
    To retrieve ID, I use TRIM(SUBSTR(col, 21, 25)) ID from Table
    The requirement is, we run some validations against the SSN in other databases and update the ID in this table if necessary.
    In the older versions, I
    can achieve the result in the following way.
                      UPDATE table set col = substr(col, 1, 20) || AddSpacesIfLessthan25Characters(newID) || substr(col, 46) where SSN=123456789
    In 11g, how can i achieve the above result, Is there any simpler way? Does regexp_replace function work for me?
    Thanks

    Hi,
    If you really, really must use regular expressions, then one way is:
    UPDATE  table_x
    SET     data = REGEXP_REPLACE ( data
                                  , '^(.{20}).{25}'
                                  , '\1' || RPAD ('THISISTWENTYFOURCHRACERS ', 25)
    WHERE   ssn  = 123456789
    Again, this will be slower than using SUBSTR.  Personally, I find this harder to read, understand, debug and maintain than SUBSTR, even though I'm pretty familiar will regular expressions.  I would use SUBSTR, like you do already.

  • Use of Function Module -FAVOS_EVENT_ADD_TO_USER_SHELF

    Hi Gurus,
    I need help on using this Function Module -FAVOS_EVENT_ADD_TO_USER_SHELF.
    Actually i want to add queries saved in Favorites of one user to other user.Then please let me know step by step how to proceed while executing this module-
    with details like whose id needs to be entered in selection field and other parameters.
    Points will be given surely.Please help.
    Thanks
    Nilesh

    Hi,
    See SAP Notes and SDN,
    Note 632374 - Upload of Favorites - Sorting
    Note 985697 - BW favorites uploaded/downloaded incorrectly
    Note 605909 - Error when executing uploaded URL/File from favorites
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?spaceKey=BI&title=Addworkbookstousermenu+Favorites&decorator=printable
    Recover User Favorites
    Thanks
    Reddy

  • Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Out of the box, to use the function keys as function keys, hold down the fn key when you press the key. Otherwise, you get the picture function on the key. You can reverse this behavior in the Keyboard system prefs.

  • Using a function module in a search help.

    People,
    I make a function module for a search help. Into the function module I call a function 'K_GROUP_SELECT' that show me a screen to make another search but I don't know how can I put the value that this function return me in the field that the user click the button of the search help in my program.
    This is the code that I put in the function module.
    Thanks!
    FUNCTION Z_GROUP_SELECT_ZFINCOKOH1_B.
    *"*"Local Interface:
    *"  TABLES
    *"      SHLP_TAB TYPE  SHLP_DESCT
    *"      RECORD_TAB STRUCTURE  SEAHLPRES
    *"  CHANGING
    *"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
    *"     VALUE(SHLP) TYPE  SHLP_DESCR
    tables: setheader.
    data: setname type setheader-setname.
      CONSTANTS:
                  CLASS         TYPE SETCLASS VALUE '0103',
                  FIELD_NAME    TYPE RGSBS-FIELD  VALUE '*',
                  KOKRS         TYPE TKA01-KOKRS  VALUE 'BPPR',
                  KTOPL         TYPE TKA01-Ktopl VALUE 'CAPI'.
    IF callcontrol-step = 'SELECT'.
    *PERFORM k_group_select USING: CLASS, FIELD_NAME, KOKRS, KTOPL.
    CALL FUNCTION 'K_GROUP_SELECT'
      EXPORTING
       BUTTONS                  = 'X'
       CLASS                    = CLASS
       CRUSER                   = '*'
       field_name               = FIELD_NAME
       SEARCHFLD                = '    '
       SEARCHFLD_INPUT          = 'X'
       SEARCHFLD_REQUIRED       = 'X'
       SET                      = '*'
       START_COLUMN             = 10
       START_ROW                = 5
       TABLE                    = 'CCSS'
       TYPELIST                 = 'BS'
       UPDUSER                  = '*'
       KOKRS                    = KOKRS
       KTOPL                    = KTOPL
    IMPORTING
       SET_NAME                 = setname
    EXCEPTIONS
       NO_SET_PICKED            = 1
       OTHERS                   = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endif.
    ENDFUNCTION.

    Carlos,  Please see the following program. It is working well in my system.  The only difference is that I've implemented you function module as a subroutine instead of in a FM.   You can see that it will return the selected value back to the screen field.
    report zrich_0002 .
    data: setname type setheader-setname.
    parameters: p_val type setheader-setname.
    data: dynfields type table of dynpread with header line.
    data: return type table of ddshretval with header line.
    at selection-screen on value-request for p_val.
      perform f4_help.
      p_val = setname.
    start-of-selection.
    *       FORM f4_help                                                  *
    form f4_help.
      constants: class  type setclass value '0103',
                 field_name    type rgsbs-field  value '*',
                 kokrs  type tka01-kokrs  value 'BPPR',
                 ktopl  type  tka01-ktopl value 'CAPI'.
      call function 'K_GROUP_SELECT'
           exporting
                buttons            = 'X'
                class              = class
                cruser             = '*'
                field_name         = field_name
                searchfld          = '    '
                searchfld_input    = 'X'
                searchfld_required = 'X'
                set                = '*'
                start_column       = 10
                start_row          = 5
                table              = 'CCSS'
                typelist           = 'BS'
                upduser            = '*'
                kokrs              = kokrs
                ktopl              = ktopl
           importing
                set_name           = setname
           exceptions
                no_set_picked      = 1
                others             = 2.
    endform.
    REgards,
    Rich HEilman

  • Workflow Help - Using PRE function

    Hi,
    I need to create a workflow on "when modified record saved" trigger event using PRE function. I am currently using this syntax :
    (FieldValue('<IndexedPick0>')='Central') AND (FieldValue('<SalesStage>')='Qualified') OR (FieldValue('<SalesStage>')= 'Approach') OR (FieldValue('<SalesStage>')= 'Quote') OR (FieldValue('<SalesStage>')='Negotiation')
    What we want this workflow to do is to send an email only when a sales stage is modified or changed to the values above in the syntax, not anything else on the opportunity page.
    Waiting for a response.
    Thanks in advance
    Ahmed

    Hi !
    Try this :
    *&#91;&lt;IndexedPick0&gt;&#93; = 'Central' AND &#91;&lt;SalesStage&gt;&#93; &lt;&gt; PRE('&lt;SalesStage&gt;') AND (&#91;&lt;SalesStage&gt;&#93; = 'Qualified' OR &#91;&lt;SalesStage&gt;&#93; = 'Approach' OR &#91;&lt;SalesStage&gt;&#93; = 'Quote' OR &#91;&lt;SalesStage&gt;&#93; = 'Negotiation')*
    This will trigger only when salestage is modified to 1 of the 4 stages and indexedpick0 = 'Central'.
    Hope this will help, feel free to ask more !
    Max

  • I misplaced my ipad, so I remotely erased it.  Then I found it, but now I cannot use all of the options in the settings.  I have restored from backup, but it still is not letting me use all functionality.  Help!

    I misplaced my ipad, so I remotely erased it.  Then I found it, but now I cannot use all of the options in the settings.  I have restored from backup, but it still is not letting me use all functionality.  Help!

    Would throwing it in Recovery mode and restoring as new clear it up?
    (same for Ipad)
    Step 1: Turn off the iPhone. To do this press and hold the power button till you see the “Slide to Power off” screen. Now slide the button to turn it off.
    In case your iPhone is stuck in an infinite loop and the previous option is unavailable, press and hold the Power and Home button till the screen goes off. Remember to leave both the buttons as soon as the screen goes off and before the Apple logo appears again.
    Step 2: Connect the iPhone’s USB cable to your computer but not to your iPhone yet.
    Step 3: Now hold down the Home button and while you are holding it connect the USB cable. Keep holding the Home button till you see the Connect to iTunes screen on your iPhone(Screenshot shown below). iTunes will show an alert saying a device in recovery mode has been detected.
    Here’s what your iPhone screen will look like once its in the iPhone Recovery Mode.
    Read more: http://www.callingallgeeks.org/15018/how-to-put-iphone-or-ipod-touch-into-recove ry-mode/#ixzz296y04ygX
    Under Creative Commons License: Attribution No Derivatives
    THEN RESTORE THE DEVICE AND SETUP AS NEW. JUST YOU WILL HAVE TO DOWNLOAD YOUR APPS AGAIN(FREE) ETC....
    LEAST THE SECURITY WORKS HAHA!!! I also wouldnt get upset, be thankful you found it.

Maybe you are looking for