Function to remove stopwords from string

Hello

I would use a very effective feature that eliminates all the empty words of a given string (array of empty words: select distinct spw_word from ctxsys.ctx_stopwords).
Any help will be much appreciated.

Kind regards
MR. R.

Hello

Seems good! I would suggest a few changes in the body:

BEGIN
    mystr := ' ' || str || ' ' ;               -- See note 1

    FOR cr IN c
    LOOP
        mystr := REPLACE ( mystr
                       , ' ' || cr.x || ' '
                       , ' '                    -- See note 2
                );
    END LOOP;                              -- See note 3

    mystr := TRIM ( REGEXP_REPLACE ( mystr          -- See notes 1 and 2
                                  , ' {2,}'     -- 2 or more spaces
                       , ' '     -- 1 space
                       )
             );
    RETURN  mystr;
END f_replace_stopword;

Notes:
(1) not to clutter the code with a lot of unnecessary trimming. Before entering the loop, you must make sure that mystr begins and ends with a space, because of the problem of 'mother is in chemotherapy' as mentioned William. However, if the chain has already spaces here, is not what anyone let them hurt. The same goes for storage mystr each pass through the loop. The amount of resources, it's waste is small (if it's to lose, anyway), but I'm more concerned with having unnecessary code distract people from the real business of the function. All the extra spaces can be picked up at the end, after leaving the loop.

(2) so-called "FUBAR" is one of the empty words that you remove, and the string contains 'A FUBAR B. If you remove just the empty word (with its spaces added), which will leave you with "AB". I guess you want 'A B', with a space between what were originally two different words. This would be particularly important if the empty word "AB" happened to appear later in the list.
This can cause multiple consecutive spaces being left in mystr; additional spaces can be deleted once the loop is completed.

(3) If you do not use an OPEN statement to open the cursor, then you don't need a statement CLOSE to close. Leaving a LOOP FOR cursor automatically closes the cursor.

Tags: Database

Similar Questions

  • How to remove duplicates from comma separated string


    Hi all

    I have an obligation to remove duplicates of string separated by commas:

    Some examples of code (real data can be in millions)

    {code}

    create table test_dup_del (num number (10), dup_val varchar2 (100));

    insert into test_dup_del values (1234, '1, 2, 3, 4, 3, 1');
    insert into test_dup_del values (4567,'1, 2, 2, 4, 4, 1');
    insert into test_dup_del values (7894,'1, 2, 1, 3, 3, 1');
    insert into test_dup_del values (1478, '1, 2, 4, 4, 3, 2');
    insert into test_dup_del values (2589, '1, 2, 1, 2, 1, 2');
    commit;

    (code}

    my output would be:

    1234, 1, 2, 3, 4'

    4567, '1, 2, 4'

    7894, '1, 2, 3'

    1478, 1, 2, 3, 4'

    2589, 1, 2'

    Thank you

    Rachid

    If there is a real need to split the data so that it could be corrected (before split to store correctly... Tip tip!) ...

    SQL > ed
    A written file afiedt.buf

    1 with test_dup_del (num, dup_val) as)
    2 Select 1234, 1, 2, 3, 4, 3, 1' Union double all the
    3 select 4567, 1, 2, 2, 4, 4, 1' Union double all the
    4 Select 7894, 1, 2, 1, 3, 3, 1' Union double all the
    5 Select 1478, 1, 2, 4, 4, 3, 2' of all the double union
    6 select 2589, 1, 2, 1, 2, 1, 2' of the double
    7      )
    8  --
    9. end of test data
    10-
    11, split as)
    12. Select num
    13, trim (regexp_substr(dup_val,'[^,]+',1,level)) as val
    14 from test_dup_del
    15 connect by num = num prior
    16 and level<=>
    17 and prior sys_guid() is not null
    18                )
    19, dist in (select distinct)
    20                      num
    21                      ,val
    22 split
    23              )
    24 select num
    25, listagg (val, ',') within the Group (order by val) as vals
    dist 26
    27 * group by num
    SQL > /.
    NUM OF VALS
    ---------- ------------------------------
    1234 1,2,3,4
    1478 1,2,3,4
    2589 1.2
    4567 1,2,4
    7894 1,2,3

    5 selected lines.

  • Removing spaces from a string

    I have a string where there is a particular sequence, I want to replace.

    The sequence is ' / p e r.

    I tried replaceAll ("-p e r," ""); Tried to replace the charsequence, but doesn't have too much work.

    I am able to replace / by replaceAll("\\\","")

    Somehow if I put string a = "/ p e r ' and

    a.Replace ("" p e r ", pr) then came out / pr.

    But I read this to a BLOB field and there spaces between the two string operations fail somehow.

    Can someone help me on this please. I'm stuck for some time

    Please also let me know if this isn't the right group, because I don't have an answer during my last post here

    See Delete white spaces from strings in Java - Stack Overflow

  • How to remove photos from my iPhone without deleting icloud photo library?

    My iPhone is full and I wanted to remove some photo to release some spaceso I supported the up to iCloud and I started to remove photos. ***? They are endangered to iCloud! Now, they're just gone. It's crazy! Image capture you can import to everywhere, but the function "delete after importing" seems to have disappeared. I'm sure this question has been beat to death, but how you remove photos from their phone without removing them from their photo library iCloud?

    So frustrating.

    Does anyone know of a solution to this?

    iCloud is a synchronization system, not just external storage.  Once you turn on photo library all you do with a photo is on ALL of your devices (including remove them).  See the last section in this article on how to recover pictures that you inadvertently deleted:

    iCloud: use iCloud photo library on your iOS device

    It is also here:

    Get help with your photo library - Apple Support iCloud

    How to remove pictures and videos from a camera using iCloud photo library?

    If you want to delete the pictures and videos of all your iOS, Mac and iCloud.comdevices, you can delete them in the Photos app.

    When you delete a photo or video of your Photos app, also will not delete your photo library and iCloud iCloud storage. You can retrieve your photos and videos from the album recently deleted for 30 days.

  • How to remove "Installers" from my hard drive

    Recently, when Safari was a problem with the search function I used Bitdefender to do an analysis of the system deep before I knew how to fix Safari re: search suggestions I thought I had some kind of virus.

    However, when I did this analysis thoroughly for Malware it appeared he had Bitdefender issues cannot be resolved and it is mainly to do with the installers and the remains of Mac OS x. GENIEO. D

    This has happened originally a day after I bought and put my computer in December 2014. However, I managed to remove part of it at the time with the help of the support community, but today when I was on the side of my wife of my computer that Java wanted to do an update and blow me if she has not tried to reinstall this little devil installers.

    That's why my writing to ask for advice on how to avoid it in the first place and secondly how remove this from my two hard drives and backup.

    Thanks in advance for the help I know I'll be getting.

    Justin

    Have you tried to remove with Malwarebytes app?

    Free use Malwarebytes Anti-Malware for Mac / AdwareMedic to remove the adware

    http://www.adwaremedic.com/index.php

    Download, install, open and run by clicking on the "Scan for Adware" button to remove the adware.

    Once this is done, exit Malwarebytes Anti-Malware.

  • best way to remove Norton from my IMac

    I want to remove Norton from my Mac. What is the best way to do it. I will download another anti virus application.

    So the instructions to do this are:

    https://support.Norton.com/SP/en/us/home/current/solutions/kb20080427024142EN_En dUserProfile_en_us

    It is extremely UNWISE to install any antivirus on any Mac application. It is not virus for OS X, so, at best, it's useless and at worst causes more problems than it solves. OS X needs no maintenance third party such as the antivirus utilities, cleaning or maintenance tools. Although there are zero viruses for OS X there is a VERY small amount of malware that is easy to avoid:

    If you follow these simple guidelines your system should function without problem for years!

  • What is "a lot of widgets", and how do I remove it from my computer?

    Original title: "alotwidgets".

    What is "a lot of widgets", and how do I remove it from my computer?  I tried to download the latest version of Adobe Flash Player and he told me that I had to close this program... It is not listed in Add/Remove, but if I search in windows Explorer, it says it's in my program files...  There is no program running that I know...

    Please help that it left me speechless!

    Thanks in advance for any help.

    Hello

    Follow these steps and check if that helps:

    Step 1:

    I suggest that refer you to this article to remove the program add or remove programs and check if it helps.

    How to change or remove a program in Windows XP

    http://support.Microsoft.com/kb/307895

    Step 2:

    If you are not able to remove the program from Add or remove programs follow the steps in the article and check if that helps.

    How to manually remove programs from the add tool / remove programs

    http://support.Microsoft.com/kb/314481

    Step 3:

    There is a 'Rapid Product Removal Tool' from Microsoft which can be used to remove the programs that we are not able to remove it by using the functionality of the program.

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall

  • How to uninstall and remove programs from the list of programs.

    I'm trying to remove a program, but I get a message that I don't have the privileges to remove the program.  is there another way to delete other than using the uninstall feature in the control panel?

    Hello

    Remember logon as administrator.

    Other good choices is Revo Uninstaller, which will eliminate all traces of a program of MyUninstaller which provides additional information, or CCleaner.

    Revo Uninstaller - free
    http://www.revouninstaller.com/revo_uninstaller_free_download.html

    MyUninstaller is a standard utility alternative to the Add/Remove applet of windows operating
    System. It displays a list of all installed applications and allows you to uninstall an application,
    delete an entry to uninstall, and then save the list of all applications installed in a text or HTML file.
    MyUninstaller also provides additional information for installed applications more than the standard
    Add/Remove the applet does not appear: the product name, company, version, uninstall string, installation
    folder and much more.

    MyUninstaller - free
    http://www.NirSoft.NET/utils/myuninst.html

    CCleaner - Tools - uninstall section

    CCleaner - free
    http://www.CCleaner.com/

    To install one of these download - SAVE - go to where you put them - click on - RUN AS ADMIN

    How to remove an uninstall entry in programs and features for Vista and Windows 7
    http://www.Vistax64.com/tutorials/86721-programs-features-remove-uninstall-entry.html

    How to manually remove programs from the add tool / remove programs
    http://support.Microsoft.com/default.aspx?scid=kb;en-us;314481
    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Is there a downside to remove programs from 'Start-Up '.

    original title: startup programs

    Is there a downside to remove programs from 'Start-Up '.

    As missing update notifications?

    Hello

    The clean boot method can help identify what is happening when you start or stop programs
    or services. Some programs which have automatic updaters on startup may always be updated
    manually if removed. Startup does not control the Windows updates.

    Be careful that a lot of these programs and services really needs to run and often remove
    a few fact little to accelerate the machine while making the less easy to use machine.

    How to troubleshoot a problem by performing a clean boot in Windows Vista
    http://support.Microsoft.com/kb/929135
    How to troubleshoot performance issues in Windows Vista
    http://support.Microsoft.com/kb/950685

    Optimize the performance of Microsoft Windows Vista
    http://support.Microsoft.com/kb/959062
    To see everything that is in charge of startup - wait a few minutes without doing anything - then right click on the task - bar
    The task manager - take a look at stored by - Services - process - it is a quick reference (if you have
    a small box in the lower-left - show for all users can check only).

    How to check and change Vista startup programs
    http://www.Vistax64.com/tutorials/79612-startup-programs-enable-disable.html

    A quick check to see that load method 2 is - using MSCONFIG and then display a list of the people here.

    Method 1 using Windows Defender will tell you more specific information about each program.

    ---------------------------------------------

    It's a little more complicated that you might have a few running services that you can do without.

    Also some programs add services that might not really need to start automatically.

    To view these compare those to start - type in the search box-> find Services upstairs run right click on it
    As an ADMINISTRATOR as the default in Vista as indicated here by BlackViper. Ignore and on people with disabilities
    (that don't work) or manual (which work only on request) - for any automatic or automatic delayed
    Start, you can post them here if you need help to decide if you should run. Some of those who might
    be set to manual and stop so that the calling program can run them as needed.

    BlackViper made also some improvements to default windows services but I wouldn't do those
    If you really understand the full meaning of change a default service. In order to use it as a tool for
    compare.

    Windows Services - list by default.
    http://www.blackviper.com/WinVista/servicecfg.htm

    WhatInStartup - free - disable/enable/remove of programs at Windows startup
    http://www.NirSoft.NET/utils/what_run_in_startup.html

    -----------------------------------------------------------

    Here are some tools that will help in the future that gain you experience even if the above methods will be
    do what you have to do for now.

    Window Watcher - free - do you know what is running on your computer? Maybe not. The window Watcher says it all, reporting of any window created by all running programs, if the window is visible or not.
    http://www.KarenWare.com/PowerTools/ptwinwatch.asp

    Many excellent free tools and an excellent newsletter at Karenware
    http://www.KarenWare.com/

    Process Explorer - free - find out which files, key of registry and other objects processes have opened.
    What DLLs they have loaded and more. This exceptionally effective utility will show you even who has
    each process.
    http://TechNet.Microsoft.com/en-us/Sysinternals/bb896653.aspx

    Autoruns - free - see what programs are configured to start automatically when you start your system
    and you log in. Autoruns shows you the full list of registry and file locations where applications
    can configure Auto-start settings.
    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspx
    Process Monitor - Free - monitor the system files, registry, process, thread and DLL real-time activity.
    http://TechNet.Microsoft.com/en-us/Sysinternals/bb896645.aspx

    There are many excellent free tools from Sysinternals
    http://TechNet.Microsoft.com/en-us/Sysinternals/default.aspx

    -Free - WhatsInStartUP this utility displays the list of all applications that are loaded automatically
    When Windows starts. For each request, the following information is displayed: Startup Type
    (Registry/Startup folder), Command - Line String, product name, Version, company name, location
    in the registry or file system and more. It allows you to easily disable or remove unwanted programs that
    runs in your Windows startup.
    http://www.NirSoft.NET/utils/what_run_in_startup.html

    There are many excellent free tools to NirSoft
    http://www.NirSoft.NET/utils/index.html

    ===========================================

    Refer to these discussions because many more excellent advice however don't forget to check your antivirus
    programs, the main drivers and BIOS update and also solve the problems with the cleanboot method
    first.

    Problems with the overall speed of the system and performance
    http://support.Microsoft.com/GP/slow_windows_performance/en-us

    Performance and Maintenance Tips
    http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/19e5d6c3-BF07-49ac-a2fa-6718c988f125

    Explorer Windows stopped working
    http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/6ab02526-5071-4DCC-895F-d90202bad8b3

    Hope these helps.

  • How to get the query of the region "PL/SQL function body returns the query string"?

    Hello

    is it possible to get the query string from the region of type "PL/SQL function body returns the query string"?

    I can get the definition of the region as a PL/SQL procedure, but I am interested in the returned query. I tried to write something like

    < pre > v_return_query: = «...» » ;
    : P49_QUERY: = v_return_query;
    Return v_return_query; < / pre >

    to save the return on hidden item P49_QUERY string, but it does not work. I get the error message: ERR-1002 cannot find the item for the "P49_QUERY" element ID in the application '4000 '.

    Kind regards
    Przemek

    If you need to make reference to a page element in the block then you can use this type of control to avoid having to use generic column names:

    if apex_application.get_current_flow_sgid(:APP_ID) = apex_application.get_sgid then-- runtime  :P9_SQL := vSQL;else-- design time  null;end if;
    

    But if all you want to do is capture the SQL debugging you can take all the references element in the block and use the insert statement (in a debug table) as I showed earlier.

    Scott

  • How to remove photos from my iphone6s after their importation?

    How to remove photos from my iphone6s after their importation?

    Hello KConstant,

    I understand that you're looking to remove photos from your iPhone, after you import the to your Mac. It depends largely on how the images are imported into your Mac.

    If you use iCloud photo library, remove photos from your iPhone, after they have synched to the Photos on your Mac afterwards would remove these photos on your Mac as well, like iCloud photo library is designed to synchronize your iPhone with iCloud and Mac.

    However, if you are importing photos via the USB port of the Photos app, you should be prompted to delete pictures from your device once the import is complete:

    Once the import is complete, a message asks if you want to delete or keep the photos on your device. Click on remove items to remove photos or click on keep items to keep them on the device.

    Import photos and videos from your iPhone, iPad or iPod touch
    https://support.Apple.com/en-us/HT201302

    You can also (it not allowed you iCloud photo library on your iPhone), you can use the image capture on your Mac app to delete images from your iPhone. This can also be useful to remove the last images that have already been imported into the Photos on your Mac. Once you have selected the images you want in the Image Capture, you can click on the prohibitive red symbol () to delete the selected items.

    Image capture: transfer images and other elements of your device
    https://support.Apple.com/kb/PH17894

    Concerning

  • How can I remove photos from my iPad without deleting them from my iPhone

    Can I remove photos from my iPad without deleting them from my iPhone?

    Can I remove photos from my iPad without deleting them from my iPhone?

    Depends on how you put Photos in place, and where is that you remove them.

    You have iCloud as library lit? If you do, then the answer is no.

    If you do not have library on iCloud and if you try to delete your photo stream, then no..

    If you try to remove the film, then Yes, you can do it.

    See you soon,.

    GB

  • How to remove Photos from the iPhone/iPad/iCloud and no pictures

    How to take a photo with my iPhone/iPad, allow it to synchronize with Photos on my Mac via iCoud, then delete from my iPhone/iPad/iCloud and removes any Photos on Mac? I want to save the photo on your computer and save space on small devices?

    I keep seeing articles on the iCloud market turn but it seems the photos all return on the devices once restarted. I want to iCloud on use as a conduit to get the photos to my computer, not as a large storage space. I want the Photos app on my Mac where all the photos are filled and stored and choose those which is left each device.

    Right now they are all in the pictures on the Mac, but I'm worried if I remove it from my iPhone/iPad that they will disappear from Photos on the Mac. I don't understand the new Photos app with all the missing features of iPhoto.

    Thank you!

    You can not that's not how works iCloud photo library - it is not a conduit but a total synchronization service whose entire raison d'etre is to keep libraries connected identical - all changes made on any device (addition, deletion or modification) are made on all devices. For devices with limited memory, using optimized photos

    If this isn't what you want then use another service - USB import, iTunes sync, MyPhotoStream for example each do different things and everyone can move photos from one device to another

    And Photos lack a lot of features iPhoto form - in fact much more features than iPhoto including iCloud library there like a bigger and better editing capability and better external editing capability and so on

    LN

  • How to remove photos from a photo stream on the iPhone, but keep them on Mac?

    Hello world

    I tried to find the answer to my question in the FAQ, but so far I've failed. I'd be really grateful if someone could help me.

    I have an iPhone (5s) and a MacBook Air (13 inch, early 2015). I have not activated the iCloud photo library, but I use the photo gallery on both devices. Because I often take pictures with my phone, I'm running out of memory space on my phone.

    In regards to this and photo stream feature, I have several questions:

    1. If I want to make more room on my iPhone, I have to delete some pictures. Assuming that I do this, these pictures are deleted from my Mac after 30 days?

    2. How can I remove photos from my iPhone without deleting them from my Mac (because I turned on the feature of photo stream)?

    3. If I import the photos from my iPhone in the Photos App on my Mac (when it is connected to my Mac with a USB cable), they are 'safe '?

    I hope that my questions are understandable and I would appreciate all the help I can get.

    Thanks to all and best wishes,

    Lars

    1. no - as long as you have allowed MyPhotoStream to import photos - if they have not been imported yet then they will be gone

    2. after importation of pictures you can delete them from the iPhone, and they will remain in Photos of the moments / pictures

    3 - Yes - but if you import several times, you will have duplicates - you should use USB or PHM import

    LN

  • I downloaded an application from my iphone and then deleted. Now when I open AppStore I purchased apps and its still there. How can I remove it from there though even I have no more app?

    I downloaded an application from my iphone and then deleted. Now when I open AppStore I purchased apps and its still there. How can I remove it from there even if I have no more app?

    The applications that you have downloaded will be available for re - download also a practice.

    Apps y cannot be removed, you can hide only.

    Read here: hide and expose the purchases made on the iBooks Store - Apple Support, App Store or iTunes Store

Maybe you are looking for