REGEXP_REPLACE and CONNECT BY

I have table1 with the following columns:
pk, col1;
with data:
1, PP;
2,P;
3,PPPPP;
How do I get it to show so that I repeat the records as many P there are in col1, like:
1,PP;
1,PP;
2,P;
3,PPPPP;
3,PPPPP;
3,PPPPP;
3,PPPPP;
3,PPPPP;
I have the following query, which works for the first record, meaning that it returns
1,PP;
1,PP;
but for 2, and 3, it shows a pattern that I can't recognize. What am I missing in the query?
Thanks.
SELECT LEVEL as n, pk, col1 FROM table1,
(SELECT pk as i, LENGTH(REGEXP_REPLACE(col1,'+[^P]')) l FROM table1) s
where pk = s.i
connect by level <= s.l

SQL> with t as (select 1 pk, 'PP' col1 from dual union all
  2             select 2 pk, 'P' col1 from dual union all
  3             select 3 pk, 'PPPPP' col1 from dual)
  4             --
  5             select * from t
  6              connect by level<=length(col1)
  7                and prior pk=pk
  8                and prior dbms_random.value is not null
  9  /
        PK COL1
         1 PP
         1 PP
         2 P
         3 PPPPP
         3 PPPPP
         3 PPPPP
         3 PPPPP
         3 PPPPP
8 rows selected
SQL>

Similar Messages

  • Connection ==null and Connection is closed, difference

    Hi experts,
    I wonder what are the differences between "Connection==null" and "Connection is closed"?
    I closed a connection on one JSP page after a bean has retrieved data. Then, on the same page I call another bean to connect to the database. Because the Connection object has been created earlier, therefore Connection is not NULL, but it is closed. So, the second bean has to initiate another connection(if I knew how to test the "closed" status)
    Is it true that if the Connection is closed, then it should become null?
    I think I must have make quite a few mistakes in above statement:). Please help. Thanks a lot.

    connection.isClosed() will tell you if the connection object is closed or not. If it is closed, then the connection object can be dropped because you will not be able to create any new statements from that connection object. Just recreate another connection to use when this occurs.

  • Connection pool and Connection factory difference?

    Hi,
    Can someone clarify the difference between connection pool and connection factory.
    I know connection pool is some thing like a pool of database connection manitained at one place so that an application or client can use it when it requires.
    Then wat exactly is connection factory..say in 10g we always put a connection factory name in all adapters and acces the data sources like DB ,FTP,AQ ..etc
    can someone clarify??
    regards,

    To conserve system resources and to improve the performance of transactional applications, WebLogic allows you to define a pool of client connections (generally database but may be a FTP,FILE etc. as well)
    A Connection Factory object encapsulates a set of connection configuration parameters that has been defined by an administrator. A client uses it to create a connection with a service provider (generally JMS).
    Regards,
    Anuj

  • Printer offline when it is on and connected to wifi

    We have a HP Officejet Pro 8100 that says it is offline when connected to the wifi. Everything was fine until recently. Now when you try to print it says the printer is offline when there is power and connection. Any help would be great!

    Hi,
    Download and run HP print and Scan Dr utility from link below to diagnose the issue.
    www.hp.com/go/tools
    Although I am an HP employee, I am speaking for myself and not for HP.
    --Say "Thanks" by clicking the Kudos Star in the post that helped you.
    --Please mark the post that solves your problem as "Accepted Solution"

  • Cisco Jabber for Windows in Extend and Connect mode and making outbound calls

    Hi guys,
    I've set up Cisco Jabber for Windows to use Extend and Connect to control a remote PBX endpoint. I've configured the required CTI-RD device, remote destinations, associated the users to the line and added the devices to end-user controlled device. The extend and connect part is working flawlessly without any issues. I'm able to receive inbound calls on the remote PBX endpoint and control the call (hold, resume, transfer etc.) using the Jabber call window that pops up.
    However, I'm unable to make any outbound calls via the Jabber client when in extend and Connect mode. Reading the Extend and Connect guide, I need to configure Dial Via Office (DVO) Reverse. So when the user initiates a Dial-Via-Office reverse call, CUCM calls and connect to the Extend and Connect device (CTI-RD). CUCM then calls and connects to the number the user dialled and finally connects the two call legs.
    After attempting to configure DVO-R for Jabber for Windows in Extend and Connect mode following the CUCM feature services guide, i'm unable to get any outbound calls working. From RTMT, i am receiving the following Termination Cause Code: (27) Destination out of order. What i also notice is that there is no calling number for that trace either. I would've thought that the calling party would've been the Enterprise Feature Access (EFA) number.
    Has anyone got this working or can provide some guidance?
    Thanks.

    Hi guys,
    I've set up Cisco Jabber for Windows to use Extend and Connect to control a remote PBX endpoint. I've configured the required CTI-RD device, remote destinations, associated the users to the line and added the devices to end-user controlled device. The extend and connect part is working flawlessly without any issues. I'm able to receive inbound calls on the remote PBX endpoint and control the call (hold, resume, transfer etc.) using the Jabber call window that pops up.
    However, I'm unable to make any outbound calls via the Jabber client when in extend and Connect mode. Reading the Extend and Connect guide, I need to configure Dial Via Office (DVO) Reverse. So when the user initiates a Dial-Via-Office reverse call, CUCM calls and connect to the Extend and Connect device (CTI-RD). CUCM then calls and connects to the number the user dialled and finally connects the two call legs.
    After attempting to configure DVO-R for Jabber for Windows in Extend and Connect mode following the CUCM feature services guide, i'm unable to get any outbound calls working. From RTMT, i am receiving the following Termination Cause Code: (27) Destination out of order. What i also notice is that there is no calling number for that trace either. I would've thought that the calling party would've been the Enterprise Feature Access (EFA) number.
    Has anyone got this working or can provide some guidance?
    Thanks.

  • I have pluged a portable battery to the USB and my macbook pro stopped working after that, right before it shut down there was a message on the screen that said something like " USB device is withdrawing so much power, please disconnect and connect again?

    I have plugged a portable battery to the USB and my macbook pro stopped working after that, right before it shut down there was a message on the screen that said something like " USB device is withdrawing so much power, please disconnect and connect again?
    if the device I connected have caused this, shouldn't the macbook itself have some type of protection that should prevent this from happening.
    because when I took it to an apple certified maintenance shop, the guy said that now it could only run while connected to the power. it won't run on batteries. and that I have to change the motherboard.
    can I just replace the damaged part only, would apple consider this as a design issue and they could pay for it, or should I just buy a new motherboard for 800$.
    Help.

    BB1B2,
    The problem is in finding a tech shop that will/can do board level repairs on Macs. They are few. And I certainly wouldn't spend $800 on a new logic board - I would replace the computer if I had to pay that much!
    You could call around to a few repair shops and see if they feel competent to isolate the problem and do a board level repair - but I'm afraid, in the end, that your search will be futile.
    Sorry,
    Clinton

  • When I had a PC I simply took the wire going to my monitor and connected to my big screen TV to watch Netflix movies...How do I take them from my IMAC and connect them to my TV now?

    When I had a PC I simply took the wire going to my monitor and connected to my big screen TV to watch Netflix movies...How do I take them from my IMAC and connect them to my TV now?

    This could be problematic.
    It will depend on what model of iMac you have.
    You may want to post machine info.
    blue apple > about this mac > more info button. Click on the hardware line. It has a little triangle in front of the work hardware.
    Leave out the serial number.
    Example:
    Machine Name: iMac
    Machine Model: PowerMac4,1
    CPU Type: PowerPC 750 (33.11)
    Number Of CPUs: 1
    CPU Speed: 600 MHz
    L2 Cache (per CPU): 256 KB
    Memory: 768 MB
    Bus Speed: 100 MHz
    Boot ROM Version: 4.1.9f1
    Most of the iMac's have sometype of video output port on the back.  You will problably need a converter.
    The 'hollywood' industry has been making it more difficult to get video out over time to prevent copying.
    Robert

  • How do I connect my new (purchased last week) macbook air to my samsung smart tv? I purchased the adapter at the apple store and connected to the TV via HDMI cable.  The TV says "no signal.  I do not see TV as an option in the display tab of system prefer

    how do I connect my new (purchased last week) macbook air to my samsung smart tv? I purchased the adapter at the apple store and connected to the TV via HDMI cable.  The TV says "no signal.  I do not see TV as an option in the display tab of system preferences.  what else do I need to do?

    First, make sure your TV is tuned to display the correct input signal. Most TVs have several inputs (multiple HDMIs, cable connections, RCA etc) so double-check that you're using the correct one - HDMI1, HDMI2 or whatever is written next to the port.
    I assume that you have a mini-Displayport to HDMI adaptor? If you open displays preferences, first tick the box that says "show display preferences in menu bar" then locate the menu and click Detect Displays. See if that helps.
    Matt

  • Does anyone know how to connect an older 20" cinema display with the (ADC) adapter end and connect it to a MacBook Pro 17" 2008 model (DVI) ?????

    Does anyone know how to connect an older 20" cinema display with the (ADC) adapter end and connect it to a MacBook Pro 17" 2008 model (DVI) ?????

    I believe you naeed the Apple ADC to DVI adapter.

  • I have an IPA2 wifi 3g working fine with wifi up for 3 monthes then from two weeks it get connection but after 1 minutes stop to serf/download with signal and connection always present. With the same router are still connected others 3 pc working!

    I all, 
    the scenario is the following:
    WIFI connection with TISCALI operator. Encryption made by WPA2 EAS with router SITECOM or tested also with another router DIGICOM with WPA TPK.
    From December up to end of March the IPAD2 working perfectly serfing and downloading.
    By two weeks it has a very strange behavour without have changed any configuration on IPAD or network: 
    with WIFI turned on it discover about 4 different ntw among them the mine, I successfully authenticate with psw the my ntw,
    the IPAD2 start to run with Safari without problems, but after about 1 minutes, it stop to serf or download and answer that the Server cannot be reached or the page cannot be open, at the same time the signal is present on the icon of WIFI and it is strong.
    This problem is systematic: If I dissasociate the ntw and then authenticate again I start to serf again for 1 minutes (more or less) and then it stops again, this occurs every time I authenticate the ntw after a disassociation.
    I made some test changing the encryption from WPA2, WPA and also without encryption but the result was always the same, after about one minute the server seems to be for the IPAD2 no more reachable while the others PC and netbook connected to the same router continue to serf/download without problems!
    I also tried to change the router with a DIGCOM that I did not use generally, but the behavour is always the same.
    Since the IOS was the 4.3 revisin, I made the upgrade by means Itunes to IOS 5.1 succesfully installed.
    But unfortunatelly all test repeted have had the same negative result with the same behavour!
    Yesterday I tried to do the complete restore of the System but the tests had the same rsult. 
    I really don't know how to proceed, the problem started suddenly without any action from my side....is there someone that can help me?
    Thanks Massimo

    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Change the channel on your wireless router. Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
     Cheers, Tom

  • Safari is not working on the Mac. Internet is fine, mail, App Store etc all working and connecting to Internet fine. Done the latest software update, still not working. When selecting a web address from bookmarks or typing in search bar, partial blue bar.

    Safari is not working on the Mac. Internet is fine. mail, App Store etc all working and connecting to Internet fine. Done the latest software update, still not working. When selecting a web address from bookmarks or typing in search bar, partial blue bar only and coloured wheel appears.

    From the Safari menu bar, select
    Safari ▹ Preferences ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
    If you wish, you may be able to salvage the malfunctioning extension by uninstalling and reinstalling it. That will revert its settings to the defaults.
    If extensions aren't causing the problem, see below.
    Safari 5.0.1 or later: Slow or partial webpage loading, or webpage cannot be found

  • Creating a share in 10.5 and connecting  with XP or Vista - My Experience

    Here was my situation.
    Client has a machine now running 10.5 on it that is sharing an external drive on the network for other mac users in the office to use as well as 3 Windows machines. I tested with an xp machine as well as a vista machine.
    The problem I was facing was that I had to set up the windows machines to be able to access the shared drive on the machine running 10.5. On 10.4 this was done with sharepoints, which breaks in 10.5. Luckily, Apple incorporated a lot of sharepoints functions into 10.5.
    First I had to create a Standard or Admin user for each unique user that will be connecting to the share, on the machine that the external drive is connected to. You have the option of creating a "share only" user, but that seems to only be for mac sharing because those accounts do not show up as available when you enable accounts to access the SMB.
    Once I had the new accounts made, I had to go to "Sharing" in the System Preferences and click on "File Sharing". When selected you see "Shared Folders" and "Users" panes. I clicked the + symbol and pointed it to the shared drive, since one of the accounts will have access to the whole drive. In the user pane I clicked the + and added the user I created for that access.
    Note at this point. If you use the same username and password of the user account in windows (case sensitive I believe) you will not have to specify a special username and password for access to the share. I did this with the first machine with complete access because he was the owner of the share.
    So after I gave that user access to the whole drive he was able to find the 10.5 machine on the network and connect to the share without prompt of a password.
    I then tried to set up the other two users who were not on the same subnet so they had to use "map network drive" on their PCs.
    Again I added the target folder that they would have access to on the shared drive. I added their user as having permission to access it. But when I went to map the network drive, it could see the folder if I entered \\ip.add.res.s\foldername and clicked "browse" but when I tried to add it, the system said it was not found. I also made sure to click "change user name" and entered the username and password for the account with access to the folder.
    So after tinkering a while I finally found that you must add the users to the main share drive list of users, even if they are set to "read only (dropbox)" or else they will not be able to access the subfolder assigned to them. It also did not make a difference if I removed the share drive completely and added just the subfolders and users individually.
    I hope this might help somone out there who might be having a similar issue with getting xp or vista to use shared folders in 10.5.

    Was not a question.

  • I have OS 10.8.2 and connected the scanner Canoscan Lide110. I downloaded the drivers, looked installed, the scanner appears in the system preferencies, but it doesn't open!!! what i have to do? thanks in advance for your kind advice!

    I have OS 10.8.2 and connected the scanner Canoscan Lide110. I downloaded the drivers, looked installed, the scanner appears in the system preferencies, but it doesn't open!!! what i have to do? thanks in advance for your kind advice!

    Thanks for your help Karen Serena. Obviously, it appears in the list of printers and scaners on the left, into the "Print and Scan" with system preferencies. Then i click it , it appears on the right, then i click "open scanner" below the name and opens a window writing "open device failed". When i connect the scanner, it makes a sound but that's all...the scanner is dead, even if I push any button...Also there isn't any window opened to prove the function of the scanner, only is shown in the scanner list, that's all.

  • Firefox won't open/connect tp the internet. Explorer opens and connects. Windows firewall turned off. No other antivirus program running. Happened when I downloaded new Firefox update.

    Firefox won't open/connect tp the internet. Explorer opens and connects. Windows firewall turned off. No other antivirus program running. Happened when I downloaded new Firefox update.

    I had the same problem when i dl-ed a new anti-virus softward, but what I did help me reconnect Firefox again!
    Here is what I did,
    Go to open firefox browser-->option-->advanced-->network-->settings-->and change it to auto-detect proxy settings for this network!
    It worked for you, hope it will work for you too =)!
    Cheers

  • My iPod touch 5th Gen iOS 8.1 won't turn on, charge and CONNECT TO iTUNES. Maybe this is because of the new release ios 8.1 where after the update it went recovery mode then i didn't restore, i set up a new ipod. What's wrong? Is ths bcoz of ios 8.1?

    My iPod touch 5th Gen iOS 8.1 won't turn on, charge and CONNECT TO iTUNES.
    Maybe this is because of the new release ios 8.1 where after the update it went
    recovery mode then i didn't restore, i set up a new ipod.
    What's wrong? Is ths bcoz of ios 8.1?

    How do you do that
    lllaass wrote:
    Try:                                               
    - iOS: Not responding or does not turn on          
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable              
    - Try on another computer                                                       
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar                              

Maybe you are looking for

  • Unable to enter my youtube channel w IPAD,why? using Safari the youtube doesnt open,*** ?

    I am unable to enter my youtube channel with IPAD, using Safari the you tube doesnt even open! IM SERIOUSLY DISSAPOINTED w APPLE IPAD..and getting any help from this site is a seriously frustrating experience this will be my LAST Apple product unless

  • Help! -- Safari, etc. crash when I verify a signed Applet for Party Poker

    I need help. I am trying to make an Applet run from the Party Poker website. Every time I try to verify the certificate, Safari, Firefox, and Camino browsers "quit unexpectedly". I have submitted numerous reports, but nothing has been resolved. Can s

  • N bridge between two 1252an in bridge mode at 5GHz

    I've read in some of the cisco documentation on the 1250 series that root bridge or non root bridge modes are "not tested". They don't say "not supported". I have a client that could use a high bandwidth link between two buildings that are 100' or so

  • RADIUS and Vendor-Specific attributes

    Hi, I'm trying to add a vendor specific attribute (Cisco AV Pair) to BMAS (NMAS 3.1.2 on NetWare 6.5 SP6). I can add any generic attribute I want, but any of the vendor-specific attributes are not sent back in the radius access-accept packet. Is ther

  • Smart Volume on Zen Mi

    what exactly does the Smart Volume option on my Zen Micro do? Does it take up more battery if i have it on/off? thanks