Need to rebuild string programmatically having '&' in it.

Gurus,
I need to rebuild a string value programmatically which has '&' and insert the same into another table.
this info is being passed to one procedure which will insert the reqd details into one table.
Hence,procedure abc (p_input_id number,p_input_string varchar2) will be 2 input parameters.
The only point where i'm getting stuck is the way to handle multiple '&' in a particular string.
Now the string may contain n no of '&' occurrances.
Hence,can you suggest/modify the existing code so that it can be used in a general way.
Assume creating arrays permission is not granted to the schema.
Logic that i've used is :Find the sub-strings coming in between '&' and concat them with chr(38) which will give a '&'.
My Code :
SQL> declare
2 lv_count number;
3 i number:=1;
4 lv_len_str number;
5 lv_great number:=0;
6 lv_set_first varchar(1000):=null;
7 lv_set_curr varchar2(1000):=null;
8 lv_prev varchar2(1000):=null;
9 lv_set varchar2(1000):=null;
10 begin
11 select length(col2) into lv_len_str from abc where col1=5;
12 for a in 1..lv_len_str
13 loop
14 select instr(col2,'&',1,i) into lv_count from abc where col1=5;
15 exit when nvl(lv_count,0)=0;
16 i:=i+1;
17 end loop;
18 lv_great:=(i-1);
19 --dbms_output.put_line ('Highest occurrance : '||lv_great);
20 i:=1;
21 select substr(col2,1,instr(col2,'&',1,1)-1) into lv_set from abc where col1=5;
22 dbms_output.put_line ('First Set : '||lv_set);
23 lv_set_first:=lv_set||chr(38);
24 i:=1;
25 for a in 1..lv_great
26 loop
27 dbms_output.put_line ('Value of i here : '||i);
28 select substr(col2,instr(col2,'&',1,i)+1,(instr(col2,'&',1,i+1)-instr(col2,'&',1,i)-1)) into lv_set_curr from abc where col1=5;
29 -- dbms_output.put_line (lv_set);
30 i:=i+1;
31 lv_prev:=lv_set_first;
32 lv_set:=lv_prev||chr(38)||lv_set_curr;
33 dbms_output.put_line (lv_set);
34 exit when i>lv_great;
35 end loop;
36 --dbms_output.put_line ('Overall set : '||lv_set);
37 end;
38 /
First Set : filename=oracle.exe
Value of i here : 1
filename=oracle.exe&&filename2=123455
Value of i here : 2
filename=oracle.exe&&filename3=23456
Value of i here : 3
filename=oracle.exe&&
PL/SQL procedure successfully completed.
Desired Output :
filename=oracle.exe&filename2=123455&filename3=23456&filename4=test which is not happening.

Procedure abc (p_input_id number,p_input_string varchar2) will be 2 input parameters.
Input_id will be 1,2,3,4,etc
Input_string will be in the format abc#bcd#cde#def..so on ('#' is parser.. sort of delimiter)
Here 'abc' correspond to 'filename=oracle.exe&filename2=123455&filename3=23456&filename4=test'
'bcd' correspond to 'filename=oracle10g.exe&filename2=12345&filename3=23456'
'cde' correspond to 'filename=Java.zip&filename2=280648119&filename3=null'
'def' correspond to 'filename=c12kprp-boot-mz.120-33.S1.bin&filename2=278725201&filename3=null'
so on and so forth ...
Here is a table abc (col1 number,col2 varchar2(100)) which will store the values.
Now i want the result of procedure to store values find values between '#' and insert them with value of input_id
input_id : 1
input_string : filename=oracle.exe&filename2=123455&filename3=23456&filename4=test#filename=oracle10g.exe&filename2=12345&filename3=23456#filename=c12kprp-boot-mz.120-33.S1.bin&filename2=278725201&filename3=null
So the table abc would contain values filename=oracle.exe&filename2=123455&filename3=23456&filename4=test,
filename=oracle10g.exe&filename2=12345&filename3=23456,filename=c12kprp-boot-mz.120-33.S1.bin&filename2=278725201&filename3=null
against value of 1 in the table.
Now,if suppose, user happens to pass 4 strings for input_id which is 2,which can be
filename=c12kprp-boot-mz.120-33.S1.bin&filename2=278725201&filename3=null#filename=Java.zip&filename2=280648119&filename3=null#filename=oracle10g.exe&filename2=12345&filename3=23456#filename=oracle.exe&filename2=123455&filename3=23456&filename4=test, so all these strings separeted by # would be stored against value of 2 in table abc.
Let me know if you need any thing.

Similar Messages

  • Do I need to rebuild my podcast?

    Hi, I am trying to post some weekly talks through a podcast using Blogger. I have been doing this for a little over a year now, and it has been working beautifully...up until a few weeks ago. Whether or not this has anything to do with transferring the feed to Google, I am not sure... I deleted a couple of the most recent episodes, thinking that would help, but it didn't.
    Here are the basics for what you need to know:
    a) The URL of the blog is http://www.umdnewman.blogspot.com
    b) There are two URLs of that site's feed: http://www.umdnewman.blogspot.com/feeds/posts/default
    and http://www.umdnewman.blogspot.com/feeds/posts/default?alt=rss
    c) The URL of the FeedBurner feed is http://feeds2.feedburner.com/homilies3
    d) I am using Blogger as my publishing software.
    For whatever reason, if I try to subscribe to my podcast through
    iTunes, it will let me subscribe, but my episodes will not come up. The new episodes appear and I can download the podcast episodes individually through the iTunes store, but if I try to refresh the podcast in the podcast library, it won't work. The little orange circle with two arrows appears next to the title of the podcast appears, but the arrows inside of it are not working, which tells me something isn't getting through. Eventually a little gray exclamation point shows up, and if I double click on it, it says "the network connection timed out."
    In Feedburner, I click on the "Homilies" feed, and I click on the "Troubleshootize" tab. I click on the FeedMedic, and it gives me a list of the errors that have occurred in the past few weeks. Right now it says everything
    is "ALL CLEAR", and yet I still can't get iTunes to work with it. Under "Actions you can take" it says to check the validity of the feed. I click on "Tips and Tools." If I click on the link for Originial Feed Validity, it says it's a valid Atom 1.0 feed, and then it says, "This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following
    recommendations." It lists off 5 different things that look like theymight need fixing, but I really don't want to touch the XML, and even if I could touch it I don't know how to, as I really don't want to screw things up entirely and make a mistake that cannot be reversed.
    So in that link it tells me the feed is valid, but if I click on
    FeedBurner Feed Validity, it tells me that:
    This feed does not validate. line 2, column 3169: Undefined item
    element: app:edited (65 occurrences) [help]
    .. spot.com'/></description><app:edited
    xmlns:app="http://ww ...
    ^
    And then it gives me three other things that could improve
    interoperability. Am I just supposed to go through and delete all of
    the times it says "app:edited"? If so, how do I do this?
    Or do I just need to rebuild the podcast altogether? I have looked through some of the posts and I have seen mentionings of "Podcast Maker". Is this something I should switch to?
    If someone could please assist me with this problem soon, I would
    really appreciate it! Thanks!
    Sincerely, Mary Hazuka

    A podcast feed is a plain text file containing various tags: you can see an example on my page at
    http://www.wilmut.org.uk/pc
    You will notice that each tag begins a new line. Your feed does not have any line returns between the tags. This doesn't matter to iTunes or other feed readers, but if you put the URL into FireFox and choose View>Page Source you get a single very long line, which you have to scroll through: it makes it almost impossible to read. Other readers may wrap the feed to the page, but it's still difficult to find anything. However if you are using Blogger to make your feed you probably don't have any method of controlling this.
    As to iTunes, I can't suggest anything. except that a reinstall won't affect your music library, which is stored separately from the application. You could try in the iTunes Forum.

  • Need to rebuild Outlook 2011 for mac identity for exporting data file.

    I was exporting outlook for mac data file (to import it into apple mail), and suddenly Outlook email client crashed and when I tried again it said that I need to rebuild the Outlook for mac database using rebuild utility. I took help from some professional technicians but it was a dead end. They said that my outlook for mac database was corrupt and they could not help me any further. I had years of emails in outlook for mac that I needed to move to apple mail as I was fed up of these frequently occuring outlook 2011 errors. Please if anyone could help me in this case then it will be very helpful.
    Thanks

    Outlook for mac stores archives its data in .olm format and it originally stores its mails in .OLK format. If everything has failed then you can seek help of a tool that can recover these .olk14 messages. One tool I know that is capable of doing so is http://www.outlookmacdatabaserecovery.com/.
    Look for the trial version first and see of it works and recovers you emails.

  • My computer crashed and I need to rebuild my site on a different computer

    My computer crashed and I need to rebuild my iweb site on another computer. What do I need to do?

    I take it that you didn't backup your domain.sites file?  If not, then on the Mac that you are re-building your site on, just open iWeb and start re-building.
    If you did, then attach the hard drive that you want to restore from to the Mac that you are using and restore the relevant domain.sites file to that computer and then double click it to open it and iWeb should open it.

  • Accessing a JSTL variable in a JSP Scriptlet (need to replace string )

    I have
    <c:set var="myVar" value="..." />
    I need to replace single quotes and double quotes to be escaped because I pass them into javascript functions and set them as ID for div sections
    ... onclick ="func('${myVar}')" ..
    <div id="${myVar}">
    but if the string contains ' single quotes it messes up the javascript or double quotes messes up the ID portion of the HTML tag
    I know there is the JSTL function fn but I can't figure out how to do it properly in JSTL
    <c:set var="myVar"
    value="${fn:replace(myVar, "'", "\"")"/>
    But that gets tricky since the value portion is enclosed in quotes
    So I was thinking of using a Scriptlet part instead.

A: Accessing a JSTL variable in a JSP Scriptlet (need to replace string )

escaping quotes within quotes within quotes.... ARGH!
Recipe for a headache if ever there was one.
However you must be strong and resist the temptations of the dark side (Scriptlet code)
My suggestion for cleaning this up - write your own static function for escaping javascript strings.
public static String escapeJavascriptString(String s){
  return .......
}Then define the function in a tld:
<function>
    <description>
      Escapes a string for javascript purposes
    </description>
    <name>escapeJavascript</name>
    <function-class>com.mypackage.ELFunctions</function-class>
    <function-signature>java.lang.String escapeJavascript(java.lang.String)</function-signature>
    <example>
      <c:out value="${myfunc:escapeJavascript(name)}">
    </example>
  </function>Cheers,
evnafets

escaping quotes within quotes within quotes.... ARGH!
Recipe for a headache if ever there was one.
However you must be strong and resist the temptations of the dark side (Scriptlet code)
My suggestion for cleaning this up - write your own static function for escaping javascript strings.
public static String escapeJavascriptString(String s){
  return .......
}Then define the function in a tld:
<function>
    <description>
      Escapes a string for javascript purposes
    </description>
    <name>escapeJavascript</name>
    <function-class>com.mypackage.ELFunctions</function-class>
    <function-signature>java.lang.String escapeJavascript(java.lang.String)</function-signature>
    <example>
      <c:out value="${myfunc:escapeJavascript(name)}">
    </example>
  </function>Cheers,
evnafets

  • Keep getting error message that iphoto has detected inconsistencies and needs to rebuild

    while adding photos to library keep getting error message that iphoto has detected inconsistencies and needs to rebuild the library..how do I fix?

    By rebuilding your library.
    Back up your iPhoto library before you do that.
    If iPhoto is open, quit it.
    Hold down the Option and Command keys while you open iPhoto (click the iPhoto icon in the Dock).
    The Photo Library First Aid window opens.
    Click "Rebuild database" and click the "rebuild" button.
    If this does not solve the problem, see "option 2" in Terence Devlin's post here:
    Re: i keep getting the message iPhoto has detected inconsistencies in your library but after repairing it it just quits
    Regards
    Léonie

  • Need to find out department having maximum total salary among all depts

    Hi,
    I am new to oracle. I was wondering how would I create a query for following condition.
    I have a employee table. There are columns like emp_id, emp_name, emp_dept, emp_sal
    I need to find out department having maximum total salary among all departments .......
    This was asked in one of the interviews.............
    Thanks in davance,
    Abhijit
    Edited by: 833515 on Feb 3, 2011 4:11 AM

    Hi,
    You can use aggregate functions, analytic functions etc. Read up aggregate functions from the docs and try to write the query yourself. If you face any problems, post it in the forums.
    Happy learning!!
    Regards,
    Sujoy

  • Do I need to rebuild the operating concern once again.

    Hi,
    I have added extra field to the COPA data soruce (1_CO_PA_XXX) and written CMOD code to populate the data. But I am not able to see the newly added field while trying to fill the data through RSA3.
    1. Why am I not able to see the newly added field.
    2. Do i need to rebuild the operating concern once again? If yes, Do i need to resbuilt in every system or can it be transported?
    3. I am also seeing another data source (1_co_pa_xxx_oc). What's the difference between data sources 1_CO_PA_XXX and 1_co_pa_xxx_oc?

    When you're doing a test extraction in RSA3, is the column there but with no data or is the column not even showing up (you may have to right-click on the columns and click on Show... to get the new column to show in RSA3)? Try deugging the 1_CO_PA_XXX DataSource in RSA3 on your R3/ECC source system to determine why the code in CMOD isn't being invoked, or not providing the data. We have been able to modify our 1_CO_PAXXX DataSource by enhancing the extraction structure with an append and then creating code in CMOD, so you shouldn't have to recreate it.
    As for the 1_CO_PA_XXX_CO DataSource, it appears that someone has created a second COPA DataSource. It could be that one was created opposite of the 1_CO_PA_XXX DataSource in that it's account-based v. cost-based or it could be the same basis with different fields.

  • Do I need to rebuild ?

    My application is already build, tested and validated. I want to upgrade my ni-switch and ni-dmm drivers from version 1.5 to version 1.6.
    Do I need to rebuild my application or it will use the new drivers without the need to rebuild ?

    The new versions for NI-Switch and NI-DMM were minor fixes and not major revisions of the 1.5 driver. Therefore you should have no problem upgrading to the new 1.6 version and using your previously built application. If you run into any snags, please consult our Technical Support at our web site.

  • I have partitioned my tables, do I need to rebuild the indexes of the table

    Hello,
    I have partition very huge tables, by using rage partition method. After that few queries taking more time than before. Does the old indexes needs to rebuild?
    Thanks

    929941 wrote:
    Hello,
    I have partition very huge tables, by using rage partition method. After that few queries taking more time than before. Does the old indexes needs to rebuild?
    ThanksWhat do you think?
    By the way, how did you partition existing tables? Did you use dbms_redefinition, or did you use CTAS, or some other method?
    I love RAGE partitions. You should always always partition your rage.

  • Library needs daily rebuilding?

    My Library started acting funny a few weeks ago, and rebuilding and trashing the preferences seemed to fix the weirdness.
    Now, adding images to projects, making smart albums and changing ratings (pretty much all I use Aperture for) doesn't work consistently. Quitting or Force Quitting will bring the particular image or album back, but eventually I need to rebuild the library to make Aperture work properly.
    If I use Aperture more than a few hours, I need to rebuild. Other Apple programs run fine (Mail, iTunes, Safari) and I've no problem with the other applications I use (PS and Illustrator CS3.)
    Any thoughts?
    55,000 images, 25 GB Library size, 10.4.11, Aperture 2.1, 16 GB RAM, Mac Pro 2.66, Library is kept on a 6TB external RAID.

    One more thing to add - I ran the "Consistency Check" on the library a few weeks ago too. It seemed to crash Aperture the first few times I tried it; I would Force Quit after a couple of hours. I wasn't sure, so I let it run over the weekend, from Friday night to Monday morning, and it never made any progress.

  • Need to rebuild my new HD from old HD with my iTunes

    I need to rebuild my newly installed iTunes, on my new HD, with the data, music, iPhone history, iPhone apps, on my old iTunes which is now on an external HD that might fail soon.  I have tried moving folders from the old iTunes to the new one but I have not achieved a complete rebuild.  Where are all the files stored for a complete rebuild.

    http://support.apple.com/kb/ht1751

  • Linux 3.2.8 - older nvidia driver needs a rebuild

    For those still using an older nvidia driver - this version needs a rebuild, eg.  NVIDIA-Linux-x86-285.05.09

      In the search link I gave above: b43-firmware-latest is for kernel 3.2+ and b43-firmware is for <3.2.  That is the, ahem, AUR search link good sir.   If someone is using b43-firmware however, they may not catch that they need to remove that and migrate to b43-firmware-latest when kernel 3.2 hits.
    I actually have a Broadcom 4311 in my laptop.  I never use it and use a wired connection instead simply because no driver I've tried has been stable enough - mostly frequent disconnects/non-responsive - so when 3.2 hits I may just try it again with b43-firmware-latest and see if it's better!

  • Need help in String operations

    HI all,
    I need help in String operations.I am getting file path of an image as
    c:\test\img\abc.gif"
    I need to convert it in to c:/test/img/abc.gif".
    Can any one suggest the solution for this.
    Thanks,
    Durga.

    [email protected] wrote:
    I used String replace method but I am not able to do it because "/" is a special character."/" is not a special character, "\" is a special character, which needs to be escaped by "\" itself.

  • Says to update to ios7 need 2.9gb I show having 3.1 avail but won't let me update

    Says to update to ios7 need 2.9gb I show having 3.1 avail but won't let me update

    Try upgrading through iTunes. The difference between 3.1 and 2.9 isn't much. You may need to free up some room. Try the iTunes approach and maybe that will work.

  • Maybe you are looking for