How can i LPAD and/or RPAD this query in sql

Hi,
I have a column in a table with value 'True Wheel '. I want the result in the following format:
'True*Wheel*****'
i.e I want to pad '*' on the right as well as at the centre of the two words. Is it possible ?
Please help !

SQL>
SQL> with x as (
  2    select 'True Wheel' as str from dual union all
  3    select 'True  Wheel' from dual union all
  4    select 'True   Wheel' from dual union all
  5    select 'True    Wheel' from dual union all
  6    select 'True     Wheel' from dual union all
  7    select 'True      Wheel' from dual)
  8  --
  9  select str, rpad(replace(str,' ','*'),15,'*') as mod_str
10  from x;
STR                  MOD_STR
True Wheel           True*Wheel*****
True  Wheel          True**Wheel****
True   Wheel         True***Wheel***
True    Wheel        True****Wheel**
True     Wheel       True*****Wheel*
True      Wheel      True******Wheel
6 rows selected.
SQL>
SQL>cheers,
pratz

Similar Messages

  • How can I use lead/lag in this query

    I have written this query which gives me the comparative data based on this week and next week. How can I use Lead/Lag in this query.
       WITH CURRENT_WEEK
              AS (  SELECT   QPAQ.YEAR YEAR,
                             QPAQ.SEASON SEASON,
                             REGEXP_SUBSTR (QPAQ.SERIES_NAME, '[^/]+') ACC_SERIES,
                             TO_NUMBER (QPAQ.WEEK) WEEK,
                             MAX (QPAQ.FAILURES) FAILURES
                      FROM   QAR_PLAN_ACC_QTY QPAQ, QAR_PLAN_THRESHOLD_LST QPTL
                     WHERE       QPTL.CATEGORY_ID = 7
                             AND QPAQ.YEAR = QPTL.YEAR
                             AND QPAQ.SEASON = QPTL.SEASON
                             AND QPAQ.SERIES_NAME = QPTL.MODEL_SERIES
                  GROUP BY   QPAQ.YEAR,
                             QPAQ.SEASON,
                             REGEXP_SUBSTR (QPAQ.SERIES_NAME, '[^/]+'),
                             TO_NUMBER (QPAQ.WEEK)
                  ORDER BY   REGEXP_SUBSTR (QPAQ.SERIES_NAME, '[^/]+')),
           LAST_WEEK
              AS (  SELECT   QPAQ.YEAR YEAR,
                             QPAQ.SEASON SEASON,
                             REGEXP_SUBSTR (QPAQ.SERIES_NAME, '[^/]+') ACC_SERIES,
                             TO_NUMBER (QPAQ.WEEK + 1) WEEK,
                             MAX (QPAQ.FAILURES) FAILURES
                      FROM   QAR_PLAN_ACC_QTY QPAQ, QAR_PLAN_THRESHOLD_LST QPTL
                     WHERE       QPTL.CATEGORY_ID = 7
                             AND QPAQ.YEAR = QPTL.YEAR
                             AND QPAQ.SEASON = QPTL.SEASON
                             AND QPAQ.SERIES_NAME = QPTL.MODEL_SERIES
                  GROUP BY   QPAQ.YEAR,
                             QPAQ.SEASON,
                             REGEXP_SUBSTR (QPAQ.SERIES_NAME, '[^/]+'),
                             TO_NUMBER (QPAQ.WEEK)
                  ORDER BY   REGEXP_SUBSTR (QPAQ.SERIES_NAME, '[^/]+'))
         SELECT   CURRENT_WEEK.YEAR,
                  CURRENT_WEEK.SEASON,
                  CURRENT_WEEK.ACC_SERIES,
                  CURRENT_WEEK.WEEK,
                  CURRENT_WEEK.FAILURES,
                  (CURRENT_WEEK.FAILURES - LAST_WEEK.FAILURES) FAILURES_COMPARE
           FROM   LAST_WEEK, CURRENT_WEEK
          WHERE   CURRENT_WEEK.WEEK = LAST_WEEK.WEEK(+)
       ORDER BY   CURRENT_WEEK.WEEK;Output is like this.
                    YEAR         SEASON     MODEL                     WEEK        FAILURES    Failures_COMPARE
    1     2011     SUMMER     VGP-BMS15     49     10     
    2     2011     SUMMER     VGP-BMS15     50     28       18
    3     2011     SUMMER     VGP-BMS15     51     30       2
    4     2011     SUMMER     VGP-BMS15     52     40       10Edited by: BluShadow on 06-Jan-2012 13:26
    added {noformat}{noformat} tags. Please read {message:id=9360002} to learn to do this yourself in future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You would jettison the entire LAST_WEEK subquery. Then replace your failure calculation with
        current_week.failure - lag(current_week.failure) over (order by current_week.year, current_week.week) as failures_compareI suppose you might want to think about renaming the sub-query as well ....
    Cheers, APC
    Edited by: APC on Jan 6, 2012 1:41 PM

  • How can I darken and clean up this logo?

    I drew this image and scanned it, and as you can tell the lines are very light and not precise. This is my original image:
    I'd like to digitiliaze this image and make it more professional and clean. I've tried image trace in illustator and many adjustments in photoshop. Here is my result:
    Much better than what i started with but still not professional and clean enough for branding. SOMEONE PLEASE HELP!!

    +1 to the Pen Tool.
    Once you have the logo as a well-drawn path, you can manipulate it easily.
    When you're drawing with the pen, try to create a minimum of points, and adjust the bezier handles to get your curves to align with your artwork fairly well.  Then once you've drawn the paths, you can turn the whole thing into a shape layer as described above, disable the artwork layer, then fine-tune it to look really good.
    Use the Control key while adding points with the path tool to move them around to fine tune things.   If you click in the wrong place, use the History to go back to redo one or more steps.
    Once you have the path just as you want it, you can turn it into some pretty amazing stuff...  Here's a 3D extrusion of the path, for example.
    Since I quickly drew the path to illustrate the above, I might as well provide you with a copy.  Click on the path with the direct selection tool to examine the points and bezier handles to get an idea of where I put them.
    After you practice with the pen for a while it will become natural to you, and you'll find you can almost magically match drawn curves.
    Have fun!
    http://Noel.ProDigitalSoftware.com/ForumPosts/RowdyPath.psd
    -Noel

  • My iphone has no pictures on it and my memory usage from photo library is 6.2 Gigs.  How can I reset and get back this lost memory?

    After resetting my phone, I re-installed apps and connected to my computer.  I made sure I didn't sync any pictures.  My iphone has no pictures on it, yet the memory usage on itunes AND the phone tells me that the iphoto database is taking 6.2 Gigs.  Is there a way to zero that and regain that memory?

    I already tried to factory default the phone and restored it.  Same problem.... I have no photo's on my phone and still have 6.2 Gigs memory being used....  Pls help.

  • How can we avoid union all in this query.....

    Dear All,
    I have a query which has union all.I want a query with the same result without using union all.Can anyone help me?Here is my query.............
    SELECT DID,
    DM.DISTRICT_DESCRIPTION "DISTRICT_NAME",
    MID,
    DM.DISTRICT_DESCRIPTION || '(D)' "MANDAL_NAME",
    200706,
    'SD_OB' "EXP_CAT",
    SUM(NVL(AMOUNT,0))-SUM(NVL(AMOUNT1,0)) "AMOUNT" FROM
    (SELECT SUBSTR(AC.PCC_INFO_CODE,3,2) "DID", SUBSTR(AC.TRANSACTION_ID,6,2) "MID",NVL(SUM(AMOUNT),0) "AMOUNT", 0 "AMOUNT1"
    FROM ACCTD_CLAIMS AC
    WHERE TO_CHAR(AC.CLAIM_DATE,'YYYYMM') <= PREV_MONTH(200706)
    AND AC.HOA_ID='18 '
    AND SUBSTR(AC.TRANSACTION_ID,1,3) <> 'CRR'
    GROUP BY SUBSTR(AC.PCC_INFO_CODE,3,2),SUBSTR(AC.TRANSACTION_ID,6,2)
    union all
    SELECT SUBSTR(AC.PCC_INFO_CODE,3,2) "DID", SUBSTR(AC.TRANSACTION_ID,6,2) "MID",0 "AMOUNT" , NVL(SUM(AMOUNT),0) "AMOUNT1"
    FROM ACCTD_CLAIMS AC
    WHERE
    TO_CHAR(AC.PAY_DATE,'YYYYMM') <= PREV_MONTH(200706)
    AND AC.HOA_ID='18'
    GROUP BY SUBSTR(AC.PCC_INFO_CODE,3,2), SUBSTR(AC.TRANSACTION_ID,6,2)), DISTRICT_MASTER DM
    WHERE DM.DISTRICT_ID=DID
    GROUP BY DID, MID, DM.DISTRICT_DESCRIPTION;
    Regards,
    Krishnadeep.

    <I want a query with the same result without using union all>
    You can write a pipelined function, which will be about ten times the work. Its best to use the simples tools; why don't you want to use UNION ALL since its probably the best answer?

  • How can I add reconciled payments to this query

    Select T4.[SlpName] as 'Sales Employee', T0.CardCode, T0.cardname as 'Customer',T0.Docdate as 'Invoice Date', T0.docnum as 'Invoice Number', T0.Taxdate as 'Month Of Service',isnull(T0.U_AIS_DVISFSO,T3.U_AIS_DVISFSO) as 'SO#',T0.NumAtCard as 'PO#', isnull(T0.U_AIS_DVIAdvNm,T3.U_AIS_DVIAdvNm) as 'Advertiser', isnull(T0.U_AIS_DVIOpptyNm,T3.U_AIS_DVIOpptyNm) as 'Campaign',T1.Dscription,-T1.Quantity as 'Impressions',T1.Pricebefdi as 'CPM', Case T0.CurSource When 'C' Then T0.DocCur When 'L' Then T5.MainCurncy When 'S' Then T6.SysCurrncy End As 'Currency DC', Case T0.CurSource When 'C' Then -T1.TotalFrgn When 'L' Then -T1.LineTotal When 'S' Then -T1.TotalSumSy End As 'Total Bef Discount DC', Case T0.CurSource When 'L' Then -T1.[LineVat] When 'C' Then -T1.[LineVatlF] When 'S' Then -T1.[LineVatS] END As 'Vat Tax DC', Case when t1.visorder = 0 Then (Cast(Round((Case T0.CurSource When 'L' Then -T0.DocTotal When 'C' Then -T0.DocTotalFC When 'S' Then -T0.DocTotalSy End), 2) As DECIMAL(18,2))) ELSE 0 END As 'Doc Total DC', Case when t1.visorder = 0 Then (Cast(Round((Case T0.CurSource When 'L' Then -(T0.DocTotal - T0.PaidToDate) When 'C' Then -(T0.DocTotalFC - T0.PaidFC) When 'S' Then -(T0.DocTotalSy - T0.PaidSys) End), 2) As DECIMAL(18,2))) ELSE 0 END As 'Balance after Payment DC', ISNULL(T6.SysCurrncy,'USD') As 'Currency SC', -T1.TotalSumSy As 'Total Bef Discount SC', -T1.[LineVatS] As 'Vat Tax SC', Case when t1.visorder = 0 Then (Cast(Round(-(T0.DocTotalSy), 2) As DECIMAL(18,2))) ELSE 0 END As 'Doc Total SC', Case when t1.visorder = 0 Then (Cast(Round(-(T0.DocTotalSy - T0.PaidSys), 2) As DECIMAL(18,2))) ELSE 0 END As 'Balance after Payment SC', T0.docstatus, 'Credit Memo' AS TransactionType, T0.CurSource,T0.[Comments],T0.[U_InvoiceAdj], T0.[U_DV_AdjustInvReason],T1.[U_DVIInvName], T1.[U_InvoiceAdj], T1.[U_DV_AdjustInvReason] from ORIN T0 left outer join RIN1 T1 on T0.docentry = T1.docentry left outer join RDR1 T2 on T1.Baseentry = T2.docentry and T1.baseline = T2.linenum left outer join ORDR T3 on T2.docentry = T3.docentry left outer join OSLP T4 ON T0.Slpcode= T4.Slpcode Left Join OADM T5 On T0.CurSource = 'L' Left Join OADM T6 On T0.CurSource = 'S' Where T0.cardname  Like '%[%0]%' and T0.docstatus ='O'

    Hi,
    Please check OITR,ITR1 Tables.
    Thanks,
    Nithi

  • How can i view and apply new custom patterns without going to preset manager? i had this facility but have now lost it

    how can i view and apply new custom patterns without going to preset manager? i had this facility but have now lost it.  i design patterns but am fairly new to photoshop. i used to be able to click on the drop down menu in patterns in the 'fill' box but cannot now do this.  have i inadvertently clicked on something to turn this facility off?  i now have to go to 'preset manager' and manually move my new design to the first box and click 'done' so that i can use it.

    Which version of photoshop are you using?
    After you define a custom pattern it should be added to the bottom of whatever patterns are already loaded.
    For example, if you define a custom pattern and then go to Edit>Fill>Pattern, the newly defined pattern should have been added to the existing loaded patterns.

  • I can't update IPhoto, it says "the product distribution file could not be verified it must be damaged or signed in" I bought it on iTunes and have 8,000 photos already. how can I update and correct this??

    I can't update IPhoto, it says "the product distribution file could not be verified it must be damaged or signed in" I bought it on iTunes and have 8,000 photos already. how can I update and correct this??

    You might try resetting the App Store application and clear the cookies via this menu:
    as described in this website: Make use of the Mac App Store debug menu | MacFixIt - CNET Reviews
    OT

  • I cannot locate my cs6 redemption code and I just purchased a new computer because my old one doesn't work anymore. How can I get my photoshop on this computer? All my other products are registerd with a serial number

    I cannot locate my cs6 redemption code and I just purchased a new computer because my old one doesn't work anymore. How can I get my photoshop on this computer? All my other products are registerd with a serial number

    The activation servers for CS and CS2 stopped working and were taken down. You'll need to take a look at this link for your issue: https://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.ht ml
    Benjamin

  • I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    Try cleaning the lens and see if that will restore functionality to the DVD drive.  Use a DVD lens cleaning disk, if you have a can of compressed air, shoot some into the slot or wrap a fine microfiber cloth (eyeglasses cleaning cloth)  around a business card and insert it gently inside the slot.
    If no success, make an appointment at an Apple store genius bar and get a free diagnosis from them.
    Ciao.

  • How can I remove and delete songs that are stored in iCloud? I really dislike this feature.

    I really hate this idea of having all of the songs that aren't on your iPhone being out back in there through I cloud. They aren't on my device for a reason. Thanks a lot iTunes.
    How can I remove and delete these songs from my iTunes account in purchased history.

    Transfer to your PC/Mac
    see here
    iOS: Import personal photos and videos from iOS devices to your computer
    Then copy to Flash drive

  • I'm trying to use a madcatz controller on the mac but it turns on for 2 seconds and turns off. the system profiler picks it up as a xbox 360 gamepad but says its not been configured. how can i allow my self use this with my games.

    i'm trying to use a madcatz controller on the mac but it turns on for 2 seconds and turns off. the system profiler picks it up as a xbox 360 gamepad but says its not been configured. how can i allow my self use this with my games!

    I have exactly the same problem.
    I'm a little peed-off with Microsoft on this. The original wireless controller I have doesn't work either since the cable I'm using is 'just' the charge and play cable, so a direct connection to my Mac won't work with this cable. It's a cable for god's sake. Why on EARTH put any limitations on this!?!?
    Next I learn I need an additional USB wireless receiver from Microsoft to get my original 360 controller to talk to my Mac. As I certainly don't want to fork any more microsoft dollars on this, this is not an option.
    Next I think, yes! I have a MadCatz 360 wired USB controller. This should surely do the trick just plugging it in and the way I go. But oh no, for some reason I plug my MadCatz Xbox360 controller in, it flashes a few times then switches off and can't be turned on again.
    The System Profiles recognizes it as a MadCatz 360 device controller but that is about it, but the ontroller software I download for the System Prefs (360Controller, USBOverdrive etc) don't even recognize the controller as being plugged in.
    What the **** Is The Microsoft Deal with all of this!?!?
    PS: Oh, and I forgot to mention, there are No drivers for device 4716 that I can find on the MadCatz website, or am I going blind?
    If anyone has a link, it would be appreciated.
    Message was edited by: nostrawaggus

  • Does my macbook air have a built in virus scan?  how can I access and use it? also any recommendations of what software if this is not avail ?

    does my macbook air have a built in virus scan?  how can I access and use it? also any recommendations of what software if this is not avail ?

    Contrary to what Geeks on Hugs is telling you, Mac OS X does indeed have a basic malware scanner. It is not a feature that is directly accessible to the user, and works a bit differently than every other malware scanner out there. Gatekeeper, which has been mentioned here, is entirely separate, and provides a different method for helping to protect you against malware.
    The anti-malware scanner in Mac OS X is called XProtect. When you download an application (or any other kind of executable code), it is automatically "quarantined," so that when you open it you're asked if you really want to do that. I'm sure you're very familiar with this aspect of Mac OS X if you have ever downloaded any apps from outside the App Store. What you don't know, though, is that each time you try to open a new app, that app is checked by XProtect. If it is identified as malware, you will not be allowed to open it, and will be warned that it's malware.
    At this time, there is no known malware that can infect a properly up-to-date Mac. All current malware will be blocked by one or more methods.
    For more information, see my Mac Malware Guide.
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com.)

  • Hi There! I have a question on Kernel Task-Threat. How can I clean my computer? This is the message --Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent" has been modified and will not be repaired.

    Hi There! I have a question on Kernel Task-Threat. How can I clean my computer? This is the message that persists when cleaning disc--Warning: SUID file “System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent” has been modified and will not be repaired.

    That's a routine message and it means nothing. Don't waste your time repairing permissions unless you know you have a problem that can be solved that way, which you probably never will.

  • My audiobook is for sale on iTunes, but iTunes is using the wrong "Preview" section.  The section they used is the only 30 sec. in Spanish and the rest of the book is in English. How can I get iTunes to fix this?

    My audiobook is for sale on iTunes, but iTunes is using the wrong "Preview" section.  The section they used is the only 30 sec. in Spanish and the rest of the book is in English. How can I get iTunes to fix this?

    Hello,
    Is your problem solved ? i got exactly the same problem... So boring...
    Thanks

Maybe you are looking for

  • How can I change my iCloud apple id to a different email address?

    I followed the directions in apple id support, but when I go to myappleid on my iMac, it already has my mobileme email address and no "edit" button to change it.  I don't want it as my primary email.  My iPhone is set up with the email account I use

  • How to install a scanner in CS5

    I'm trying to get my Epson V30 scanner working in Photoshop CS5. I had it working in CS3, just wondered what the procedure is for getting it installed to work in CS5. Thanks for the help. Dan

  • Macbook Pro won't see CD as boot option

    I have tried using two different OS install disks but the computer won't see the disks as a startup option. I have tried booting by pressing the option key after the tone and the C key. I have gone in through system prefs to choose the CD to boot fro

  • Tim Machine: no error messages but not backing up

    My Time Machine does not seem to back up any more as it should. There are no error messages, Time Machine is switched on, spinning once an hour, there is enough space on the external HD. I can enter Time Machine and browse through the history. Howeve

  • LDAP and SAP integration

    Hi, As a part of a project requirement, we are trying to integrate Solution manager with LDAP (Lightweight Directory Access Protocol). Using the directory service, we are trying to synchronize the CUA (Central user administration within Solution mana