Help needed with sql function

Hi,
i have a function like below. basically what it does is, check whether first 2 places of a column_name is *'N_'*. if yes then i am replacing column_name which has *'N_' to ''*
CASE WHEN SUBSTR(column_name,1,2) = 'N_' THEN
*':NEW.'||REPLACE(column_name,'N_','')*
i designed this based on the requirement. now i am facing a small issue. i have a column name 'RGN_ID'. so the above function replaces the RGN_ID as RGID as N_ comes in the middle of the column_name the above function accidentally replaces this as well. wherein i need to replace the first 2 position of column_name which starts like 'N_'
can you please suggest any solution for this?
Edited by: user13178284 on Jun 29, 2010 6:11 AM

Thanks!. But i am afraid if this would help.
there may be many column names having 'N_' at whatever position. for eg., TRAN_ID. here N_ comes at 4th and 5th position.
i understand i need to place some kind of check above this function.so that if 'N_' comes anywhere in between the column_name i shouldnt replace it instead i should just replace column_name starting wtih 'N_'.
any idea about this?

Similar Messages

  • Help needed with printf function!!!!

    public class Try
    {public static void main (String[] args)
    {int a;
    String b;
    a = 000002;
    b = "JSmith";
    System.out.printf(b + "%d", a);
    }}I need a help with the printf function.
    The result of this small excercise that I just made is:
    Jsmith2
    How do I make it so that the zeros is also displayed? (using the printf)
    I want it to look like this: Jsmith000002
    Thank you in advance

    TrySystem.out.printf(b + "%06d", a);(I don't have a compiler here so I haven't tested this).
    The "6" is the width - the minimum number of characters that will be
    printed and the "0" (it's a zero) is a flag indicating that the output should
    be padded with zeros.
    You should also note that the value of a is two. It doesn't matter whether
    you say a=2; or a=0002; - a is still just plain two.

  • Expert Help needed with Sql Loader !

    Hello Friends...I am using one .dat file that contains several values in a
    particular column and I need to load those values in different tables with
    sqlloader.....For example: in column 3 there are values 0001, 0004, 0007, 9999
    ..> values 0001 and 0004 need to be loaded into table1 and value 0007 is
    loaded into table2 and value 9999 needs to be loaded into table3.
    I can successfully use the when clause to load one value at a time but
    cannot load a range or multiple values during the sqlloader load. I can
    call and run separate .ctl files but less complexity and fewer files would
    be better. Tried everything I know but no luck, can't do loads in same
    .ctl file......Does the when clause have limitations whereby only one value
    at a time can evaluated as True or False ?
    I would like to do a Not or InBetween evaluations if possible on that
    single coulmn and then do the loads in the specific tables.
    Any help would be appreciated as I can see my hair turn grayer by the
    minute..My thanks in advance..

    You're asking sql*load to perform an unnatural act.
    Load in you dat file as-is. Create a pl/sql procedure to do the rest.
    Your batch script calls sql*load, then sql*plus to run the proc.
    Must simpler. sql*load is not a procedural language.

  • Help needed with analytical function

    I want to get the employee details of the highest and 2nd highest salaried employee in a particular department. But also the department should have more than 1 employee.
    I tried the query and it gave me proper results. But I'm wondering if there is some other alternative than using the subquery.
    Here is the table and the result query :
    with t as
    select 1 emp_id,3 mgr_id,'Rajesh' emp_name,3999 salary,677 bonus,'HR' dpt_nme from dual union
    select 2 ,3 ,'Gangz',4500,800,'Finance' from dual  union
    select 3 ,4 ,'Sid',8000,12000,'IT' from dual  union
    select 4 ,null,'Ram',5000,677,'HR' from dual  union
    select 5 ,4,'Shyam',6000,677,'IT' from dual union
    select 6 ,4 ,'Ravi',9000,12000,'IT' from dual  
    select * from
    (select emp_id, mgr_id, emp_name, dpt_nme, salary, row_number() over (partition by dpt_nme order by salary desc) rn from t where dpt_nme in
    (select dpt_nme from t group by dpt_nme having count(*) > 1)) where rn < 3

    Hi,
    You need a sub-query, but you don't need more than that.
    Here's one way to eliminate the extra sub-query:
    WITH     got_analytics     AS
         SELECT  emp_id,     mgr_id,     emp_name, dpt_nme, salary
         ,     ROW_NUMBER () OVER ( PARTITION BY  dpt_nme
                                   ORDER BY          salary     DESC
                           )         AS rn
         ,     COUNT (*)     OVER ( PARTITION BY  dpt_nme
                                       )         AS dpt_cnt
         FROM     t
    SELECT  emp_id,     mgr_id,     emp_name, dpt_nme, salary
    ,     rn
    FROM     got_analytics
    WHERE     rn     < 3
    AND     dpt_cnt     > 1
    ;Analytic functions are computed after the WHERE clause is applied. Since we need to use the results of the analytic ROW_NUMBER function in a WHERE clause, that means we'll have to compute ROW_NUMBER in a sub-query, and use the results in the WHERE clause of the main query. We can call the analytic COUNT function in the same sub-query, and use its results in the same WHERE clause of the main query.
    What results would you want if there's a tie for the 2nd highest salary in some department? For example, if you add this row to your sample data:
    select 7 ,3 ,'Sunil',8000,12000,'IT' from dual  union? You may want to use RANK instead of ROW_NUMBER.

  • Help needed with SQL

    I have to create a join of two tables with the following fields:
    User_x
    Full_Name
    Login_Name
    Group_List
    Group_x
    Group_name
    Groupid
    In User_x table grouplist comprises of list of groups a user belongs to separated by a semi colon. e.g. 12;78;65
    Now I need to create a join where I get a list of all the users with the group they belong to.
    The result set should look like this
    User Groupname
    Tom Group1
    Peter Group2
    Kathy Group2
    and so on...
    Actual SQL wil be appreciated.
    Thanks

    Hi
    Try this:
    select use_name, group_name
    from user_x u, group_x g
    where instr(group_list, ';'||group_id||';') <> 0
    or substr(group_list, 1, instr(group_list, ';')-1) = group_id
    or substr(group_list, instr(group_list, ';', -1)+1) = group_id;
    Ott Karesz
    http://www.trendo-kft.hu

  • Help needed with sql long names

    i need help bringing in column names as the short name. currently my select statment is bringing in the sql longname. is there a way to bring in the short name specified in my db2 database. my code for my connection is as follows:
    driver      =(Driver) Class.forName "com.ibm.as400.access.AS400JDBCDriver");
    DriverManager.registerDriver(driver);
    conn = DriverManager.getConnection("jdbc:as400://system;date format=iso;", props);

    Try setting the sys property on the properties object.
    You can set a '.' or '/' for system or sql naming conventions!

  • Help needed with Map function in Lumira

    Hi,
    I've bee using Luira for lots of great tile charts and bar charts, but now I am looking to make use of the mapping visulization in Lumira.
    Bascially I want to get a count of the number of retail stores by state. 
    I uploaded my data , and some have been populated and looks nice (see first screenshot) , but for others the state is not found (see second screenshot).
    I have looked in the help documents, and some of the training, but have yet to find a solution.
    What I'd like to know is how I can fix the "unfound" states, or at least find out what is the source file which stores all the states?
    Above is the results so far, below is the missing states that I need to resolve. How can I fix for these "not found" states  or compare the format of my original excel data vs the data from Lumira.
    Alteratively if there is a way to match via post-code / zip-code please tell me how.
    Thanks,
    Paul

    Hi Paul,
    the geo-hierarchies take all cities that are greater than 100.000 for the name resolution and for the smaller ones you would need to use latitude/longitude information to get them resolved by Lumira.
    You can find mre information on how to use latitude/ longitude information from here:
    https://scn.sap.com/docs/DOC-33118
    Regards,
    Clarissa

  • Help needed with cfcalendar function

    I have a Coldfusion application which requires the user to select a date to sign up for a class. The problem that I am having is that the available dates are within a pre-determined range (i.e. from current date until end of year) and are Wednesdays only. I thought I could use the cfcalendar function, but do not understand how to use it with the conditions mentioned. Is this possible to do with cfcalendar, and if so, could someone please give me an example of how to do this? If there is an easier way to do this, I would really appreciate any ideas.
    Thanks in advance!  

    TrySystem.out.printf(b + "%06d", a);(I don't have a compiler here so I haven't tested this).
    The "6" is the width - the minimum number of characters that will be
    printed and the "0" (it's a zero) is a flag indicating that the output should
    be padded with zeros.
    You should also note that the value of a is two. It doesn't matter whether
    you say a=2; or a=0002; - a is still just plain two.

  • Help needed with SQL to split huge data into two excel or text files.

    Hi,
    I have a table which has around 1850000 records. I want to split the data into two sets and import the data in .txt or execl file.
    How can i break upthe records using rownum or any thing
    select * from tablename where rownum<940000 fetched some records
    but
    when i gave select * from tablename where rownum>940000 it was not fetching records.
    Guideme

    when i gave select * from tablename where rownum>940000 it was not fetching records.try this
    select * from (select tablename.*, rownum rn from tablename) where rn >940000

  • HELP NEEDED WITH SLEEP FUNCTION

    Sometimes when I hold the play button the backlight turns on instead of sleeping.
    Do you know whats wrong?

    mabey try a reset/
    Nano 4GB black,Moto RAZR V3 black, PSP, all kinds of cases for nano,radio/remote   Windows XP   <img src="http://i36.photobucket.com/albums/e13/superman5656/s.gif"align="right"</span>

  • Help needed with Vista 64 Ultimate

    "Help needed with Vista 64 UltimateI I need some help in getting XFI Dolby digital to work
    Okay so i went out and I bought a yamaha 630BL reciever, a digital coaxial s/pdif, and a 3.5mm phono plug to fit perfectly to my XFI Extreme Music
    -The audio plays fine and reports as a PCM stream when I play it normally, but I can't get dolby digital or DTS to enable for some reason eventhough I bought the DDL & DTS Connect Pack for $4.72
    When I click dolby digital li've in DDL it jumps back up to off and has this [The operation was unsuccessful. Please try again or reinstall the application].
    Message Edited by Fuzion64 on 03-06-2009 05:33 AMS/PDIF I/O was enabled under speakers in control panel/sound, but S/PDIF Out function was totally disabled
    once I set this to enabled Dolby and DTS went acti've.
    I also have a question on 5. and Vista 64
    -When I game I normally use headphones in game mode or 2. with my headphones, the reason for this is if I set it on 5. I get sounds coming out of all of the wrong channels.
    Now when I watch movies or listen to music I switch to 5. sound in entertainment mode, but to make this work properly I have to open CMSS-3D. I then change it from xpand to stereo and put the slider at even center for 50%. If I use the default xpand mode the audio is way off coming out of all of the wrong channels.
    How do I make 5. render properly on vista

    We ended up getting iTunes cleanly uninstalled and were able to re-install without issue.  All is now mostly well.
    Peace...

  • HELP NEEDED WITH ADDAPTER-DVI TO VGA.

    PLEASE ...HELP NEEDED WITH WIRING CROSS OVER....CAN YOU HELP WITH BACK OF PLUG CONNECTIONS...I SORTA UNDERSTAND THE PINOUTS BUT CANT MAKE AN EXACT MACH...WOULD LIKE TO BE 100% SURE...
    ......THIS ENSURES NO SMOKE!!!                                                                                           
    THE CARD IS AN ATI RADEON RX9250-DUAL HEAD-.........ADDAPTER IS DVI(ANALOG)MALE TO VGA(ANALOG)FEMALE.
    ANY HELP VERY MUCH APPRECIATED........ SEEMS YOU NEED TO BE ROCKET SCI TO ATTACH A BLOODY PICTURE...SO THIS HAS BEEN BIG WASTE OF FING TIME!

    Quote from: BOBHIGH on 17-December-05, 09:21:31
    Get over it mate !
    I find it easy t read CAPS...and if you dont like it ...DONT READ IT!
    And why bother to reply...some people have nothing better to do.
    Yes there chep and easy to come by...Ive already got a new one.
    All I wanted was to make a diagram of whats inside the bloody thing...it was a simple question and required a simple answer.
    NO NEED TO A WANKA !!
    I feel a bann comming up.
    Have you tryed Google ? really.. your question is inrelevant. No need to reply indeed.
    Why do you come here asking this question anyway ? is it becouse you have a MSI gfx card ? and the adapter has nothing to do with this ?
    You think you can come in here yelling.. thinking we have to put up with it and accept your style of posting. This is not a MSI tech center.. it's a user to user center.. Your question has nothing to do with MSI relavant things anyway's.
    Google = your friend.
    Quote from: BOBHIGH on 17-December-05, 09:21:31
    it was a simple question and required a simple answer
    Simple for who ? you (buying a new one) ? me ? we ?   .really...........
    Quote from: Dynamike on 16-December-05, 04:11:48
    1: There are allot of diffrent types of those adapters.
    If any of the mods have a problem about my reply.. please pm me.

  • Help needed with itunes

    help needed with itunes please tryed to move my itunes libary to my external hard drive itunes move ok and runs fin but i have none of my music or apps or anything all my stuff is in the itunes folder on my external hard drive but there is nothing on ituns how do i get it back help,please

    (Make sure the Music (top left) library is selected before beginning this.)
    If you have bad song links in your library, hilite them and hit the delete button. Then locate the folder(s) where your music is located and drag and drop into the large library window in iTunes ( where your tracks show up). This will force the tunes into iTunes. Before you start, check your preferences in iTunes specifically under the"Advanced" tab, general settings. I prefer that the 1st 2 boxes are unchecked. (Keep iTunes Music folder organized & Copy files to iTunes Music folder when adding to library). They are designed to let iTunes manage your library. I prefer to manage it myself. Suit yourself. If there is a way for iTunes to restore broken links other than locating one song at a time I haven't found it yet. (I wish Apple would fix this, as I have used that feature in other apps.) This is the way I do it and I have approx. 25,000 songs and podcasts and videos at present. Hope this helps.

  • Urgent help needed with un-removable junk mail that froze Mail!!

    Urgent help needed with un-removable junk mail that froze Mail?
    I had 7 junk mails come in this morning, 5 went straight to junk and 2 more I junked.
    When I clicked on the Junk folder to empty it, it froze Mail and I can't click on anything, I had to force quit Mail and re-open it. When it re-opens the Junk folder is selected and it is froze, I can't do anything.
    I repaired permissions, it did nothing.
    I re-booted my computer, on opening Mail the In folder was selected, when I selected Junk, again, it locks up Mail and I can't select them to delete them?
    Anyone know how I can delete these Junk mails from my Junk folder without having to open Mail to do it as it would appear this will be the only solution to the problem.

    Hi Nigel
    If you hold the Shift key when opening the mail app, it will start up without any folders selected & no emails showing. Hopefully this will enable you to start Mail ok.
    Then from the Mail menus - choose Mailbox-Erase Junk Mail . The problem mail should now be in the trash. If there's nothing you want to retain from the Trash, you should now choose Mailbox- Erase Deleted Messages....
    If you need to double-check the Trash for anything you might want to retain, then view the Trash folder first, before using Erase Junk Mail & move anything you wish to keep to another folder.
    The shift key starts Mail in a sort of Safe mode.

  • Help needed with this form in DW

    Hi, i have created this form in dreamweaver but ive got this problem.
    In the fields above the text field, the client needs to fill in some info such as name, email telephone number etc.
    But the problem is when ill get the messages. Only the text from the large text field is there.
    What did i do wrong??
    http://www.hureninparamaribo.nl/contact.html
    Thank you
    Anybody??

    Thank you for your response. So what do i have to do to fix this?
    Date: Sun, 20 Jan 2013 07:57:56 -0700
    From: [email protected]
    To: [email protected]
    Subject: Help needed with this form in DW
        Re: Help needed with this form in DW
        created by Ken Binney in Dreamweaver General - View the full discussion
    You have several duplicate "name" attributes in these rows which also appears in the first row
    Telefoon:
    Huurperiode:
    Aantal personen:
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5008247#5008247
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5008247#5008247
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5008247#5008247. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver General by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

Maybe you are looking for

  • Connecting Cinema Display with mini display port to macbook pro with thunderbolt port

    I am trying to connect a 27" cinema display (2010) that has a mini display port cable out of the back, into my macbook pro (2013) with thunderbolt ports.  The mini display port cord fits into the thunderbolt port on the Macbook Pro, however the macbo

  • Installing adobe photoshop cs4 on a windows 8.1 pc

    I am trying to install Photoshop CS4 o a new Windows 8.1 PC, but keep getting a message "The Installer Database is corrupt.  Please contact Adobe Customer Service"  Adobe no longer support CS4 and referred me to this forum.  I have already deactivate

  • Reducing Plot Size of Large PDFs

    I have a large format plotter and a PDF that is 157 inches long x 36 inches wide.  The plotter will handle the plot, but we do not need a plot that long.  I need to reduce the plot size so that text is "readable" - I think about 50% will work.  Howev

  • How  to post interest on Security deposit from customer

    Dear all I want to Cauclate the interest on Security deposite  whcih i received from customer. for different customer i have different deposite amount. for eg for customer A i have 50000/- and for customer B i have 100000/-. how to calculate the inte

  • Simple Automated batch video transcoding

    Hi, I am very new to FCS, all I want to do is have it scan my S3 mounted drive on my desktop, if there is content present grab that video and transcode it to MPEG4-webcasting, then place it into another S3 mounted drive (using expand drive to mount S