How to replace the char values into numeric in my string?

Hi Friends,
I would like to Replace the Charecter values with numeric value in my string.
Exp : first in my string I am having the value like this : 'ABCD1234' ( may be any char and num values ), and I want too get it by '99991234'.
I mean How to replace the char values into numeric in my string?
Thanks,
Sridhar

Hi Sridhar,
I would like to Replace the Charecter values with numeric value in my string.
Exp : first in my string I am having the value like this : 'ABCD1234' ( may be any char and num values ), and I want too get it by '99991234'.
So, if i understand you correctly, you want to replace all characters in a string with 9 as in the above example, irrespective of position of the character, if so try with the below code.
DATA: l_str TYPE string.
l_str = 'ASKHSIUDNSBDKJSDH124312431243124saasdfsf'.
REPLACE ALL OCCURRENCES OF REGEX '\D' IN l_str WITH '9'.
IF sy-subrc EQ 0.
  WRITE: l_str. "Result will be 9999999999999999912431243124312499999999
ENDIF.
Regards,
Chen
Edited by: Chen K V on Jun 13, 2011 12:36 PM

Similar Messages

  • How to get the section value into configurator developer page

    Hi,
    I am working on configurator developer, Can I get the section value into the configurator developer page by any setup. If possible means please help me on that.
    Thanks advance,
    Gopi

    I thought the same.Thanks for confirming...I tried with loop approach.but i am unable to get decimal part...
    eg if my values are 12.25 and 123.12....my below code ignores decimal points..i know since i am using Number, it is happening..but could you please let me know how can i get decimal values also..
    OAViewObject vo = (OAViewObject) am.findViewObject("XXXXInvDistributionsVO1");
    vo.first();
    Number grossamount = 0;
    for (int i=0;i< vo.getRowCount();i++) {
    // BigDecimal grossamount1 = new BigDecimal((vo.getRowAtRangeIndex(i).getAttribute("Amount")));
    grossamount = ((oracle.jbo.domain.Number)vo.getRowAtRangeIndex(i).getAttribute("Amount")).intValue();
    System.out.println("grossamount "+grossamount); // it ignores and prints decimal points
    BigDecimal grossamount1 = new BigDecimal(grossamount.intValue());
    System.out.println("grossamount1 "+grossamount1); // it ignores and prints decimal points
    vo.next();
    Thanks
    Raj

  • How to populate the calculated value into screen field.

    I am doing one enhancement in QM.I have added one custom screen to notification transaction ( QM01/QM02/QM03) transaction tab strip control using the enhancement QQMA0001.The Details of the calling and called screens as shown bellow
    The Calling screen: SAPLIQS0
    Screen Number: 7790
    Screen Area :USER0001
    Called Screen: SAPLXQQM
    Screen Number: 0101
    I have developed the Custom Screen in screen 0101 and called in PBO of program SAPLIQS0 7790 screen.
    The Screen in calling perfectly .The Custom screen having different fields like Raw cost, Intermediate cost, Finished cost, SCAR Cost and Sales Order Cost Etc... These fields are out put filed types. No input for these screens.. I have few doubts regarding this
    How to populate the calculated values in Custom screen?
    Where we wrote the code to populate the calculated values in custom screen?
    You have any idea please guide me
    Thanks & Regards,
    Samantula

    As your screen fields should be global variables in SAPLXQQM, you may initialize them by implementing function module EXIT_SAPMIWO0_008 which also belongs to SAPLXQQM (Customer Exit: Transfer Notification Data to User Screen)

  • How to write the char value as is in the CSV file

    Hi Everyone,
    I am creating csv files which contains inventory details for all the products. I am able to create the csv file with utl file concepts. My problem starts after the csv file is being created.
    some of the product numbers(Though I am saying Product number, it is varchar2 data type in the table) is like this 3E-12, 3E-54 and so on. I have totally 23 product numbers like this.
    When the user opens the csv file it is changing to numbers like this 3.00E-12, 3.00E-54. I want to keep the product number as it is like char value. I tried many quoting and concat methods.
    But none of them works for me.
    I am using oracle 9i.
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    Please help me to solve this problem.
    Thanks in advance,
    Vimal...

    Hi Friends,
    Thanks for the immediate response. Here is my code.
    CREATE OR REPLACE PROCEDURE DATA_TO_CSV_FILE
    IS
    l_file_ptr UTL_FILE.file_type;
    l_hdr_text VARCHAR2 (4000);
    l_dynamic_sql_str VARCHAR2 (4000);
    TYPE l_dynamic_sql IS REF CURSOR;
    l_dynamic_cursor l_dynamic_sql;
    l_org_id_select VARCHAR2 (200);
    l_master_org_id NUMBER;
    l_category VARCHAR2 (40);
    l_itemno VARCHAR2 (40);
    l_description VARCHAR2 (240);
    l_brand VARCHAR2 (240);
    l_organization_id NUMBER;
    l_oh NUMBER;
    l_status apps.mtl_system_items.inventory_item_status_code%TYPE;
    BEGIN
    l_file_ptr := UTL_FILE.fopen ('CSV_DIR', 'inventory.csv', 'w');
    l_dynamic_sql_str :=
    'SELECT mc.segment2 CATEGORY, itm.segment1 itemno '
    || 'itm.description description, LOG.brand brand,'
    || 'NVL (m.oh, 0) oh'
    || '(select msi.inventory_item_status_code from apps.mtl_system_items msi'
    || ' where msi.inventory_item_id = itm.inventory_item_id'
    || ' and msi.organization_id = '
    || l_master_org_id
    || ' ) status '
    || ' FROM xxx_custom_table m,'
    || ' apps.mtl_item_categories ic,'
    || ' apps.mtl_categories_b mc,'
    || ' apps.mtl_system_items itm,'
    || ' xxx_custom_table1 LOG,'
    || ' xxx_custom_table2 cap'
    || ' WHERE m.item_id(+) = itm.inventory_item_id'
    || ' AND m.org_id(+) = itm.organization_id'
    || ' AND itm.segment1 = cap.itemno(+)'
    || ' AND itm.inventory_item_id = ic.inventory_item_id'
    || ' AND itm.organization_id = ic.organization_id'
    || ' AND ic.category_id = mc.category_id'
    || ' AND mc.segment2 IS NOT NULL'
    || ' AND itm.inventory_item_id = LOG.inventory_item_id'
    || l_org_id_select
    || ' GROUP BY mc.segment2,'
    || ' itm.segment1,itm.inventory_item_id,itm.description,'
    || ' LOG.brand,LOG';
    OPEN l_dynamic_cursor FOR l_dynamic_sql_str;
    LOOP
    FETCH l_dynamic_cursor
    INTO
    l_category, l_itemno, l_description, l_brand, l_status,l_oh;
    EXIT WHEN l_dynamic_cursor%NOTFOUND;
    UTL_FILE.put_line (
    l_file_ptr,
    l_CATEGORY
    || ','
    || l_itemno
    || ','
    || l_description
    || ','
    || l_status
    || ','
    || l_brand
    || ','
    || l_oh
    END LOOP;
    UTL_FILE.fclose (l_file_ptr);
    END;
    Hey damorgan,
    Can you please give me little more detail about your workaround method. I think I did the ODBC Connection Once for MS ACCESS database. I
    hope you are taking about the same method.
    Thanks
    Vimal....

  • How to Capture the Variables Value into the

    Using JSLT part of the Jdeveloper/Jheadstart, ADF/Struts Framework.
    I'm capturing the value fine using the following,
    <c:set var="CvInformationFirstName" scope="request" value="${bindings.CvInformationFirstName.attributeValue}"/>I can even show the value without any problem,
    <%-- Show the saved values --%>
    <c:out value='${requestScope.CvInformationFirstName}' />Right here, we I try assigning the value of the firstname to a field, I can't accomplish this since I just don't know how to do it,
    <html:text name="CvInformationBean" property="CvInformationFirstName" size="10" maxlength="10"/>
    Any help will be greatly appreciate it.
    Oracle Group

    I am not sure what it is you are trying to accomplish. What do you mean with "assigning"? It is a business rule where the FirstName and LastName fields of the master need to be equal to the FirstName and LastName of the details, or is it the other way around? Anyway, it seems you are trying to get this business rule implemented by playing around with <html:text> elements in the JSP. You can't do it that way. Those <html:text> elemens are "two way". When the page is shown they determine which values get shown. Then, when the user enters new values and submits, they determine where those values are stored. If I understand what you are trying to accomplish correctly, you are trying to show values from one place, but submit them to another place. That can't be done strictly at the JSP level (not unless you use JavaScript anyway).
    But then again, I may be misinterpreting what you are trying to do. Could you provide some more details about what the desired functionality is?
    Finally, may I remark that this is the JHeadstart Forum, where you can communicate with other JHeadstart users all over the world. Also you may have noticed that the JHeadstart Team monitors this forum, and as such it is used as a means of providing some support for JHeadstart users that run into bugs or problems with the JHeadstart Tool (JHeadstart is a Consulting product that does not come with official "Metalink" support). But your problem is obviously not a bug in JHeadstart, you are just wondering how to implement some additional functionality that our Generator does not generate. So I hope you understand that if you get any assistance on this forum with your problem, either from the JHeadstart Team or from other JHeadstart users, it is not because you have a right to it, but because we're a bunch of friendly people out here that like to help out where we can. Demanding a reply like you did with your last two posts (an hour apart!) is really not done.
    Kind regards,
    Peter Ebell
    JHeadstart Team

  • How to check the source value is in between a string range in mapping

    Hi Consultants,
    I am working on IDOC to File scenario. I need to implement a specific requirement of our client. i.e. something like below;
    Vendor number can be any thing like 1AA000000 / 1AA000001/1AB000000/... ect till 1ZZ999999.
    if the vendor number is in between 1AA000000 -1ZZ999999 then the target value should assign as 'Internal' else should assing as 'External'.
    How to compare  that the value of vendor is in between IAA000000 to 1ZZ999999 in mapping?
    Appreciate your help.
    Thanks in advance.
    Regards,
    Nausheen

    You can try creating an UDF and using the varName.substring(); method. Then you can compare in separated pieces the string. For example
    String var = "1AA000000";
    if (var.substring(3).compareTo("000000") < 0 && var.substring(3).compareTo("999999") > 0)
      //compare now the "AA" and "ZZ" with the same logic;
    http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#substring(int, int)
    http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#compareTo(java.lang.Object)
    EDIT: Moreover, those functions are available in the Mapping program creation, but this should give a clue on the order it should be done.
    Edited by: Lucas Santos on Mar 29, 2011 7:38 PM
    Edited by: Lucas Santos on Mar 29, 2011 7:53 PM

  • How to pupup the calendar value into text box ?

    Hi
    I want to use the calendar for my text field .
    The calendar will popup when I click a button /image. This image will appear next to text box . when click the calendar. The values should come to into text box.
    Please give me any idea how to write a code in jsp for handling the value from calendar.
    Thanks
    Merlin Roshina

    I am assuming u have popupcalendar.js and stylesheets.
    Include the javascript in your jsp.
    <script type="text/javascript" src="scripts/popcalendar.js"/>
    and call the method popUpCalendar on some event like onclick as shown below.
    <img border="1" src="images/calendaricon.jpg" title="Open calendar" onClick="popUpCalendar(this,<object to be populated>,'mm/dd/yyyy')" alt="Calendar"/>
    <object to be populated> u can give it like this for your text box. U can define an id attribute for your text box and call document.getElementById("<id name>")
    and rest the javascript will take care.

  • How to make the Decimal values into Round off value

    Hi Experts,
    I have an internal table with 3 columns, the 3rd column having decimal values, Now i want to convert the values in to whole number, Ex: 15.67 will be 15.7
    Anyone plz help this.
    Mohana

    hii
    use following code
    DATA:
      wa_val type p decimals 2,
      L_ANDEC     like T006-ANDEC value 1,
      wa_val2 type p decimals 1.
      wa_val = '15.67' .
      CALL FUNCTION 'ROUND'
        EXPORTING
         DECIMALS            = L_ANDEC
          input              = wa_val
          SIGN                = '+'
       IMPORTING
         OUTPUT              = wa_val2
       EXCEPTIONS
         INPUT_INVALID       = 1
         OVERFLOW            = 2
         TYPE_INVALID        = 3
         OTHERS              = 4
    WRITE:/ wa_val2.
    regards
    twinkal

  • How to replace the Losing fonts with scrip in photoshop,by script

    Frequently,I Receive some PSD files, It is did by Other people.
    When I open it with my computer,I find it missed a lot of fonts.
    Some times,I have this fonts, but the name is not  like with the fonts of the PSD file.
    So,I need to replae the Losing fonts, but it  always have a lot, It wast my much times.
    In Indesign, it is Very easy~~
    Could you help me Achieve it by scrip in Photoshop?
    Thank you very much

    Hi Sridhar,
    I would like to Replace the Charecter values with numeric value in my string.
    Exp : first in my string I am having the value like this : 'ABCD1234' ( may be any char and num values ), and I want too get it by '99991234'.
    So, if i understand you correctly, you want to replace all characters in a string with 9 as in the above example, irrespective of position of the character, if so try with the below code.
    DATA: l_str TYPE string.
    l_str = 'ASKHSIUDNSBDKJSDH124312431243124saasdfsf'.
    REPLACE ALL OCCURRENCES OF REGEX '\D' IN l_str WITH '9'.
    IF sy-subrc EQ 0.
      WRITE: l_str. "Result will be 9999999999999999912431243124312499999999
    ENDIF.
    Regards,
    Chen
    Edited by: Chen K V on Jun 13, 2011 12:36 PM

  • How to display the xml content into my datagrid

    Hi Experts,
                     i have created a webservice for sales quotation through DI-Server.iam able to add a new sales quotation through my coding & iam able to get the sales quotation based on the DOcEntry in an *XML file*.
              The xml file that i got using DOCENTRY is in this way:--
    <?xml version="1.0" encoding="utf-8" ?>
    - <BOM>
    - <BO>
    - <AdmInfo>
      <Object>oRecordset</Object>
      </AdmInfo>
    - <OQUT>
    - <row>
      <DocEntry>8</DocEntry>
      <DocNum>8</DocNum>
      <DocDate>20080715</DocDate>
      <DocDueDate>20080815</DocDueDate>
      <CardCode>C0003</CardCode>
      <CardName>HP India</CardName>
      <DocTotal>14500.000000</DocTotal>
      <ItemCode>A00006</ItemCode>
      <Dscription>HP Officejet 7310 All-in-One</Dscription>
      <Quantity>1.000000</Quantity>
       <Price>14500.000000</Price>
      <Currency>INR</Currency>
       <DiscPrcnt>10.000000</DiscPrcnt>
      <LineTotal>14500.000000</LineTotal>
       </row>
      </OQUT>
      </BO>
      </BOM>
    Now the problem is from this xml content i should display the values in my datagrid like:
    DocEntryCardCodeDocDueDateItemCodeDscriptionQtyTotal
         8--C000320081116--A00006-HP-off jet-2 ---                     1000
    can anybody suggest me some ideas that how to get the SPECIFIED values into my datagrid...........
    regards,
    shangai.

    hi vincent,
                    Thanks for your reply.iam unable to understand these lines in your code..iam working in vb.net
    public static DataSet GetDataSetFromXML(XmlNode XMLNode)
    grid.DataSource = GetDataSetFromXML(Result.SelectSingleNode(xpath_string));
    this is my coding....it's throwing an error when i declare like this
    Public Sub GetDataSetFromXML(ByVal XmlNode)
            Dim ds As New DataSet
            Dim reader As XmlNodeReader
            reader = New XmlNodeReader(XmlNode)
            ds.ReadXml(reader)
            reader.Close()
            'Return ds --->(error with syntax)
        End Sub
    DataGrid1.DataSource = GetDataSetFromXML(oXmlReply.SelectSingleNode("//DocDueDate"))
                DataGrid1.DataBind()
    regards,
    shangai

  • How can we include the property value into the News RSS?

    We have defined object property u201CDepartmentu201D that is used in News XML creating form. How can we include the property value into the News RSS (set value of the particular RSS XML tag)?

    We have solved the issue with NWDS

  • How to update table J_1IPART1,without replacing the old values

    Helllo Friends
    Problem:
    When I capture the  excisable document in T-code J1IEX, the table J_1IPART1 does not  get updated ,but when I do the good receipts by 101,then entry in the above table get updated ,by replacing the  previous entry.
    What should I do so that table J_1IPART2 hold all the captured values without replacing the old values.
    And after what time of interval do I need to update the register, is it on daily bases or on monthly bases

    Try these steps:
    1. Post MIGO without excise entry
    2. J1I5 - Update register for RG23A Part1 with classification ROP.
    3. Post excise Invoice through J1IEX
    You should update the register on daily basis.

  • How to avoid the duplicate values, I do not want the duplicate............

    i have one database table called "sms1" that table is updated every day or on daily basis it has the following fields in it:
    SQL> desc sms1;
    Name Null? Type
    MOBILE NUMBER
    RCSTCNATCNATCNATCNAWTHER VARCHAR2(39 CHAR)
    SNO NUMBER
    INDATE DATE
    From this table the is one column "RCSTCNATCNATCNATCNAWTHER VARCHAR2(39 CHAR)" . I am splitting it into different columns like :
    SQL> desc smssplit;
    Name Null? Type
    R VARCHAR2(2 CHAR)
    C VARCHAR2(2 CHAR)
    S VARCHAR2(1 CHAR)
    TC VARCHAR2(3 CHAR)
    NA VARCHAR2(3 CHAR)
    TC2 VARCHAR2(3 CHAR)
    NA2 VARCHAR2(3 CHAR)
    TC3 VARCHAR2(3 CHAR)
    NA3 VARCHAR2(3 CHAR)
    TC4 VARCHAR2(3 CHAR)
    NA4 VARCHAR2(3 CHAR)
    WTHER VARCHAR2(10 CHAR)
    SNO NUMBER
    INSERTDATA VARCHAR2(25 CHAR)
    Now I am written a procedure to insert the data from "Sms1" table to smssplit table...
    CREATE OR REPLACE PROCEDURE SPLITSMS
    AS
    BEGIN
    INSERT INTO scott.SMSSPLIT ( R,C,S,TC,NA,TC2,NA2,TC3,NA3,TC4,NA4,WTHER,SNO)
    SELECT SUBSTR(RCSTCNATCNATCNATCNAWTHER,1,2) R,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,3,2) C,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,5,1) S,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,6,3) TC,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,9,3) NA,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,12,3) TC2,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,15,3) NA2,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,18,3) TC3,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,21,3) NA3,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,24,3) TC4,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,27,3) NA4,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,30,10) WTHER, SNO
    FROM scott.SMS1 where SNO=(select MAX (sno) from SMS1);
    END;
    Now in order to update the second table with data from first table on regular basis I have written a job scheduler and I am using oracle 9.0. version...
    DECLARE
    X NUMBER;
    JobNumber NUMBER;
    BEGIN
    SYS.DBMS_JOB.SUBMIT
    job => X
    ,what => 'scott.SPLITSMS;'
    ,next_date => SYSDATE+1/1440
    ,interval => 'SYSDATE+1/1440 '
    ,no_parse => FALSE
    :JobNumber := to_char(X);
    END;
    Now this job scheduler is working properly and updating the data for every one minute but it is taking or updating the duplicate values also ..like example:
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:49:16
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:49:16
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:50:17
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:50:17
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:51:19
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:51:19
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:52:20
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:52:20
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:53:22
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:53:22
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:54:45
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:54:45
    Now I do not want the duplicate values to be updated ...and want them to ignore them.....
    please I need a help on this query........How to avoid the duplicate values............

    Look at the posts closely:might not be needed if formatted ;)
    create or replace procedure splitsms as
    begin
      insert into scott.smssplit (r,c,s,tc,na,tc2,na2,tc3,na3,tc4,na4,wther,sno)
      select substr(rcstcnatcnatcnatcnawther,1,2) r,
             substr(rcstcnatcnatcnatcnawther,3,2) c,
             substr(rcstcnatcnatcnatcnawther,5,1) s,
             substr(rcstcnatcnatcnatcnawther,6,3) tc,
             substr(rcstcnatcnatcnatcnawther,9,3) na,
             substr(rcstcnatcnatcnatcnawther,12,3) tc2,
             substr(rcstcnatcnatcnatcnawther,15,3) na2,
             substr(rcstcnatcnatcnatcnawther,18,3) tc3,
             substr(rcstcnatcnatcnatcnawther,21,3) na3,
             substr(rcstcnatcnatcnatcnawther,24,3) tc4,
             substr(rcstcnatcnatcnatcnawther,27,3) na4,
             substr(rcstcnatcnatcnatcnawther,30,10) wther,
             sno
        from scott.sms1 a
       where sno = (select max(sno)
                      from sms1
                     where sno != a.sno
                   ); ---------------> added where clause with table alias.
    end;Regards
    Etbin

  • How to replace the string in a file

    Hi, I have a file which contains the following data
    File.dat
    <file>
    <filenum>
    W10
    </filenum>
    <hello>Heading </hello>
    </file>
    I need to replace the contents of file.dat
    database sequence value (for example xx_seq.nextval)
    Can some one please tell me how to search this <filenum>
    W10</filenum>
    and replace this with xx_seq.nextval
    and write the entire contents of the file to new file
    I am doing some thing like this
    suppose if my database value returns 11 from the above sequence then
    the output should be in file2.dat as
    <file>
    <filenum>
    11</filenum>
    <hello>Heading </hello>
    </file>
    declare f_in utl_file.file_type;
    s_in varchar2(10000);
    string1 varchar2(32000);
    x number;
    begin
    f_in := utl_file.fopen('SAMPLEDIR','input.txt','R');
    f_in1 := utl_file.fopen('SAMPLEDIR','input1.txt','W');
    select xx_seq.nextval into x from dual;
    loop
    begin utl_file.get_line(f_in,s_in);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    string1:= string1 || s_in;
    utl_file.put_line( (f_in1,s_in);
    end;
    end loop;
    utl_file.fclose(f_in);
    end;
    In this case it is reading and writing as it is, but unable to replace the sequence value
    Can some one please tell me how to do using replace function
    Thanks

    Hi, I have tried this but getting error
    step 1: create table test_dept(dno number, dname varchar2(20))
    insert into test_dept values(10,'10-Sourcing dept');
    insert into test_dept values(20,'20-Audting dept');
    insert into test_dept values(30,'30-Computer dept');
    select * from test_dept;
    DNO DNaME
    10     10-Sourcing dept
    30     30-Computer dept
    20     20-Audting dept
    step 2:
    create table test_web (name varchar2(60), xml_col xmltype) ;
    step 3:
    create sequence test1_seq start with 100 increment by 1
    step 4:
    test.out has the following contents (it is not .xml file) and i dont have <?xml version="1.0" ?> tag at the begining
    <File>
    <File_Type>Type1</File_Type>
    <File_Header_Record>
    <file_num>WP10</file_num>
    </File_Header_Record>
    <Transaction>
    <Transaction_Type>TR 1</Transaction_Type>
    <Amount>
    <Amounts>100</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Sourcing</Dept_Type>
    <Dept>10</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 2</Transaction_Type>
    <Amount>
    <Amounts>200</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Auditing</Dept_Type>
    <Dept>20</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 3</Transaction_Type>
    <Amount>
    <Amounts>300</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Computer</Dept_Type>
    <Dept>30</Dept>
    </Depts>
    </Transaction>
    </File>
    step 5:
    DECLARE
    v_check_file_exist BOOLEAN;
    v_file_length NUMBER;
    v_block_size NUMBER;
    v_file_path VARCHAR2 (100);
    v_file_name VARCHAR2 (100);
    v_file_type UTL_FILE.FILE_TYPE;
    v_str varchar2 (32760);
    v_cnt number;
    v_seq number;
    --check whether file exists and has data in it
    BEGIN
    v_file_path := '/usr/tmp';
    v_file_name := 'test.xml.out';
    -- initailise the variables
    v_cnt := 0;
    UTL_FILE.FGETATTR (v_file_path,
    v_file_name,
    v_check_file_exist,
    v_file_length,
    v_block_size);
    if v_check_file_exist
    then
    DBMS_OUTPUT.put_line (' File exists');
    IF v_file_length > 0 AND v_block_size > 0
    THEN
    BEGIN
    select test1_seq.nextval into v_seq from dual;
    insert into test_web values(v_seq,v_file_name);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    DBMS_OUTPUT.put_line ('No data found '||SQLERRM);
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('others '||SQLERRM);
    END;
    commit;
    ELSE
    DBMS_OUTPUT.put_line ('No Data in File');
    END IF;
    ELSE
    DBMS_OUTPUT.put_line (' File Not Available');
    END IF;
    END;
    I am getting below error
    File exists
    others ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML
    processing
    LPX-00210: expected '<' instead of 't'
    Error at line 1
    My requirement is to replace the
    1. contents of the file WP10 from <file_num>WP10</file_num>
    with sequence value 'WP101' because sequence is starting at 100
    2. Replace all Dept tag <Dept>30</Dept> with Dname value from test_dept table
    for example
    <Dept>10</Dept> should be replaced with <Dept>10-Sourcing dept</Dept>
    update the
    when i say select * from test_web;
    It should contain this row
    101 <File>
    <File_Type>Type1</File_Type>
    <File_Header_Record>
    <file_num>WP101</file_num>
    </File_Header_Record>
    <Transaction>
    <Transaction_Type>TR 1</Transaction_Type>
    <Amount>
    <Amounts>100</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Sourcing</Dept_Type>
    <Dept>10-Sourcing dept</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 2</Transaction_Type>
    <Amount>
    <Amounts>200</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Auditing</Dept_Type>
    <Dept>20-Audting dept</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 3</Transaction_Type>
    <Amount>
    <Amounts>300</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Computer</Dept_Type>
    <Dept>30-Computer dept</Dept>
    </Depts>
    </Transaction>
    </File>
    Can you please check
    Thanks

  • Replacing the same value in a string with varying values

    If I have a string:
    "%s is the %s I am referring to"
    and - I want to replace the %s occurrences with DIFFERENT values... what's the best way to do this.
    I was thinking parsing it into seperate strings using substr and instr but, I'm not sure if that's overkill or not.
    Replace is ideal but - it replaces every occurrence so - you can state just replace the first occurrence with one value and the second with another (i.e. if the desired result after replacing the above string was supposed to be "This is the string I am referring to"
    Any help is appreciated.
    Thanks

    Hi,
    wtlshiers wrote:
    If I have a string:
    "%s is the %s I am referring to"
    and - I want to replace the %s occurrences with DIFFERENT values... what's the best way to do this.Whenever you have a question, please post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data.
    Explain how you get those results from that data.
    Always say which version of Oracle you're using (e.g. 11.2.0.3.0).
    See the forum FAQ {message:id=9360002}
    I was thinking parsing it into seperate strings using substr and instr but, I'm not sure if that's overkill or not.Depending on your requirements, you might need to do that.
    Replace is ideal but - it replaces every occurrence so - you can state just replace the first occurrence with one value and the second with another (i.e. if the desired result after replacing the above string was supposed to be "This is the string I am referring to"As you said, REPLACE changes all occurrences. There's no way to tell it (for example) to change only the first one.
    REGEXP_REPLACE, is a lot more flexible. It does have an option for giving a specific occurrence, but you may not even need that feature. You might just want something like
    REGEXP_REPLACE ( '%s is the %s I am referring to'
                , '(.*)%s(.*)%s(.*)'
                , '\1This\2string\3'
                )It all depends on your data and your requirements.
    Are the new values (such as 'This' and 'string') fixed, or can they change from row to row?
    Will you always have 2 (or some known number) of '%s's in the original string?
    Does '%' always signal something that is to be replaced? If not, how can you tell when it does and when it doesn't?
    Does 's' always come right after '%'? If not, what are the possibilites, and what do the different characters signify?

Maybe you are looking for

  • Receiving error "disk could not be read from or written to" during synch.

    When I try to synchronize my iPod to iTunes, I get the following error: "Attempting to copy to the disk [ipod name] failed. That disk could not be read from or written to." This error occurs only when I have put about 0.5 GB onto my 4.0 GB model, so

  • Internet access from Solaris 10 server

    HI we have Sparc T-4 servers running solaris 10. i need one of the servers to be able to reach to Internet. However i am not able to even ping 8.8.8.8 . i am able to browse internet using firefox after i changed the proxy settings in the browser. can

  • Apache + Tomcat - Can't run xsql demos

    I have the following setup - Apache 1.3.9 Tomcat 3.1 XSQL 1.0.4.3 JDK 1.3 HPUX 11.0 Oracle 8.1.6 I have followed the instructions in the XQL release notes on installation and configuration but I am having a problem running the demos. When I try the h

  • Help with my eraser tool please

    I got a new laptop and installed a copy of fireworks on it. It seems to work differently on this new computer than my older one. The Eraser tool is all jittery and jumpy and will even continue on after I have released the mouse button. This sure make

  • Accepted Appointments not visible in Room

    Dear all We have configured Groupware in our Portal. And created Meeting rooms with Calendar But for some Room members the Meeting's related to their room is not visible, even though they accept the Meeting Request. For some users the everything is c