How to split numbers in a string with a single SQL on 10.2?

Is it possible to to below action with a single SQL on 10.2?
input > '3abc4de5f'
output > '3,abc,4,de,5,f'
Thank you.

It might be a NLS issue. Follow the suggestion of Karthick_Arp and use [[:alpha:]] instead:Is is
SQL> with t as (select 'a' l from dual union all
           select 'b' l from dual union all
           select 'A' l from dual)
select * from t
order by nlssort(l, 'NLS_SORT=GERMAN')
L
a
A
b
3 rows selected.
SQL> with t as (select 'a' l from dual union all
           select 'b' l from dual union all
           select 'A' l from dual)
select * from t
order by nlssort(l, 'NLS_SORT=DANISH')
L
A
a
b
3 rows selected.You could also do a case insensitive match (As in TXT3)
SQL> alter session set NLS_SORT=DANISH
Session altered.
SQL> with t as (select 'aADSFF3332abc4342de5Df' txt from dual
           union all
           select '3abc4de5f' from dual)
select txt, regexp_replace(txt, '([0-9]{1,}|[a-z]{1,})', '\1,') txt2
           ,regexp_replace(txt, '([0-9]{1,}|[a-z]{1,})', '\1,', 1, 0, 'i') txt3
  from t
TXT                            TXT2                           TXT3                         
aADSFF3332abc4342de5Df         a,ADSFF,3332,abc,4342,de,5,Df, aADSFF,3332,abc,4342,de,5,Df,
3abc4de5f                      3,abc,4,de,5,f,                3,abc,4,de,5,f,              
2 rows selected.
SQL> alter session set NLS_SORT=GERMAN
Session altered.
SQL> with t as (select 'aADSFF3332abc4342de5Df' txt from dual
           union all
           select '3abc4de5f' from dual)
select txt, regexp_replace(txt, '([0-9]{1,}|[a-z]{1,})', '\1,') txt2
  from t
TXT                            TXT2                         
aADSFF3332abc4342de5Df         aADSFF,3332,abc,4342,de,5,Df,
3abc4de5f                      3,abc,4,de,5,f,              
2 rows selected.Regards
Peter

Similar Messages

  • How Can I replace newScale Text Strings with Custom Values?

    How Can I replace newScale Text Strings with Custom Values?
    How can I replace newScale text strings with custom values?
    All  newScale text is customizable. Follow the procedure below to change the  value of any text string that appears in RequestCenter online pages.
    Procedure
    1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
    a) Navigate to the RequestCenter.ear/config directory.
    b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
    c) Save the file.
    d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
    e) Stop and restart the RequestCenter service.
    f) Log  in to RequestCenter and browse to the page that has the text you want  to overwrite. In front of the text you will now see the String ID.
    g) Note down the String ID's you want to change.
    2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
    3. Create the following sub-directory: res/resources
    4. Create the following empty text files in the directory you just created:
    RequestCenter_0.properties
    RequestCenter_1.properties
    RequestCenter_2.properties
    RequestCenter_3.properties
    RequestCenter_4.properties
    RequestCenter_5.properties
    RequestCenter_6.properties
    RequestCenter_7.properties
    5. Add the custom text strings to the appropriate  RequestCenter_<Number>.properties file in the following manner  (name-value pair) StringID=YourCustomTextString
    Example: The StringID for "Available Work" in ServiceManager is 699.
    If you wanted to change "Available Work" to "General Inbox", you  would add the following line to the RequestCenter_0.properties file
         699=General Inbox
    Strings are divided into the following files, based on their numeric ID:
    Strings are divided into the following files, based on their numeric ID:
    String ID  File Name
    0 to 999 -> RequestCenter_0.properties
    1000 to 1999 -> RequestCenter_1.properties
    2000 to 2999 -> RequestCenter_2.properties
    3000 to 3999 -> RequestCenter_3.properties
    4000 to 4999 -> RequestCenter_4.properties
    5000 to 5999 -> RequestCenter_5.properties
    6000 to 6999 -> RequestCenter_6.properties
    7000 to 7999 -> RequestCenter_7.properties
    6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
    7. Restart RequestCenter.
    Your customized text should be displayed.

    I've recently come across this information and it was very helpful in changing some of the inline text.
    However, one place that seemed out of reach with this method was the three main buttons on an "Order" page.  Specifically the "Add & Review Order" button was confusing some of our users.
    Through the use of JavaScript we were able to modify the label of this button.  We placed JS in the footer.html file that changes the value of the butt

  • How to encrypt column of some table with the single method ?

    How to encrypt column of some table with the single method ?

    How to encrypt column of some table with the single
    method ?How to encrypt column of some table with the single
    method ?
    using dbms_crypto package
    Assumption: TE is a user in oracle 10g
    we have a table need encrypt a column, this column SYSDBA can not look at, it's credit card number.
    tha table is
    SQL> desc TE.temp_sales
    Name Null? Type
    CUST_CREDIT_ID NOT NULL NUMBER
    CARD_TYPE VARCHAR2(10)
    CARD_NUMBER NUMBER
    EXPIRY_DATE DATE
    CUST_ID NUMBER
    1. grant execute on dbms_crypto to te;
    2. Create a table with a encrypted columns
    SQL> CREATE TABLE te.customer_credit_info(
    2 cust_credit_id number
    3      CONSTRAINT pk_te_cust_cred PRIMARY KEY
    4      USING INDEX TABLESPACE indx
    5      enable validate,
    6 card_type varchar2(10)
    7      constraint te_cust_cred_type_chk check ( upper(card_type) in ('DINERS','AMEX','VISA','MC') ),
    8 card_number blob,
    9 expiry_date date,
    10 cust_id number
    11      constraint fk_te_cust_credit_to_cust references te.customer(cust_id) deferrable
    12 )
    13 storage (initial 50k next 50k pctincrease 0 minextents 1 maxextents 50)
    14 tablespace userdata_Lm;
    Table created.
    SQL> CREATE SEQUENCE te.customers_cred_info_id
    2 START WITH 1
    3 INCREMENT BY 1
    4 NOCACHE
    5 NOCYCLE;
    Sequence created.
    Note: Credit card number is blob data type. It will be encrypted.
    3. Loading data encrypt the credit card number
    truncate table TE.customer_credit_info;
    DECLARE
    input_string VARCHAR2(16) := '';
    raw_input RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(input_string,'AL32UTF8','US7ASCII'));
    key_string VARCHAR2(8) := 'AsDf!2#4';
    raw_key RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(key_string,'AL32UTF8','US7ASCII'));
    encrypted_raw RAW(2048);
    encrypted_string VARCHAR2(2048);
    BEGIN
    for cred_record in (select upper(CREDIT_CARD) as CREDIT_CARD,
    CREDIT_CARD_EXP_DATE,
    to_char(CREDIT_CARD_NUMBER) as CREDIT_CARD_NUMBER,
    CUST_ID
    from TE.temp_sales) loop
    dbms_output.put_line('type:' || cred_record.credit_card || 'exp_date:' || cred_record.CREDIT_CARD_EXP_DATE);
    dbms_output.put_line('number:' || cred_record.CREDIT_CARD_NUMBER);
    input_string := cred_record.CREDIT_CARD_NUMBER;
    raw_input := UTL_RAW.CAST_TO_RAW(CONVERT(input_string,'AL32UTF8','US7ASCII'));
    dbms_output.put_line('> Input String: ' || CONVERT(UTL_RAW.CAST_TO_VARCHAR2(raw_input),'US7ASCII','AL32UTF8'));
    encrypted_raw := dbms_crypto.Encrypt(
    src => raw_input,
    typ => DBMS_CRYPTO.DES_CBC_PKCS5,
    key => raw_key);
    encrypted_string := rawtohex(UTL_RAW.CAST_TO_RAW(encrypted_raw)) ;
    dbms_output.put_line('> Encrypted hex value : ' || encrypted_string );
    insert into TE.customer_credit_info values
    (TE.customers_cred_info_id.nextval,
    cred_record.credit_card,
    encrypted_raw,
    cred_record.CREDIT_CARD_EXP_DATE,
    cred_record.CUST_ID);
    end loop;
    commit;
    end;
    4. Check credit card number script
    DECLARE
    input_string VARCHAR2(16) := '';
    raw_input RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(input_string,'AL32UTF8','US7ASCII'));
    key_string VARCHAR2(8) := 'AsDf!2#4';
    raw_key RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(key_string,'AL32UTF8','US7ASCII'));
    encrypted_raw RAW(2048);
    encrypted_string VARCHAR2(2048);
    decrypted_raw RAW(2048);
    decrypted_string VARCHAR2(2048);
    cursor cursor_cust_cred is select CUST_CREDIT_ID, CARD_TYPE, CARD_NUMBER, EXPIRY_DATE, CUST_ID
    from TE.customer_credit_info order by CUST_CREDIT_ID;
    v_id customer_credit_info.CUST_CREDIT_ID%type;
    v_type customer_credit_info.CARD_TYPE%type;
    v_EXPIRY_DATE customer_credit_info.EXPIRY_DATE%type;
    v_CUST_ID customer_credit_info.CUST_ID%type;
    BEGIN
    dbms_output.put_line('ID Type Number Expiry_date cust_id');
    dbms_output.put_line('-----------------------------------------------------');
    open cursor_cust_cred;
    loop
         fetch cursor_cust_cred into v_id, v_type, encrypted_raw, v_expiry_date, v_cust_id;
    exit when cursor_cust_cred%notfound;
    decrypted_raw := dbms_crypto.Decrypt(
    src => encrypted_raw,
    typ => DBMS_CRYPTO.DES_CBC_PKCS5,
    key => raw_key);
    decrypted_string := CONVERT(UTL_RAW.CAST_TO_VARCHAR2(decrypted_raw),'US7ASCII','AL32UTF8');
    dbms_output.put_line(V_ID ||' ' ||
    V_TYPE ||' ' ||
    decrypted_string || ' ' ||
    v_EXPIRY_DATE || ' ' ||
    v_CUST_ID);
    end loop;
    close cursor_cust_cred;
    commit;
    end;
    /

  • How to encrypt column of some table with the single method  on oracle7/814?

    How to encrypt column of some table with the single method on oracle7/814?

    How to encrypt column of some table with the single method on oracle7/814?

  • String with embedded single quote

    Hi, all. We're trying to pass a string from one procedure to another, which will then do an EXECUTE IMMEDIATE on it. However, there are single quotes withing the string, and they're driving us nuts! This is what the concatenated string should look like when passed to the pw_execDDL procedure:
    insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values ('MEAG', to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
    Here's the concatenation process that doesn't work, and there are functions being called within the string:
    chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (' || '''' || prm_inoc_id || '''' || ', ' || 'to_date(' || '''' || prm_proof1 || ''''||','||'''' ||'DD-MMM-YY'||''''||')' || ', ' || '''' || fw_is_proof_valid(prm_birth_date, prm_proof1) || '''' || ',1);';
    pw_execDDL(chr_sql); /* call the procedure to do the EXECUTE IMMEDIATE */
    Help! We've tried every combination -- using two single quotes together, three, and four, and still no luck. Thanks.

    insert into appimmunization.wsrprfs (inoc_id, proof,
    is_valid,proof_num) values ('MEAG',
    to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
    This statement can be made in a string with the following affectation:
    chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (''MEAG'', to_date(''02-OCT-05'',''DD-MMM-YY''), ''Y'',1)';
    Note please that each single quote in your original string must be specified using two single quotes and that is all. It is more readable and more easy to do it this way.
    Michel.

  • How to Handle Dynamic Pivoting with a single SQL?

    I was searching for a single SQL who can dynamically understands the pivoting members in the data, I saw several ways of doing Pivoting depending on the version, some are really hard to understand but just two options upto now seams to be flexable enough to do dynamic pivoting, right?
    1- For this option you have to write PL/SQL block to build up the dynamic single SQL query, I also find this approach very easy to understand. :)
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:766825833740
    2- 11.1 's PIVOT new feature with PIVOT XML and ANY clause, a SINGLE SQL and easy to understand but returns XMLTYPE data, another step to parse to produce the report is needed.
    http://www.oracle-developer.net/display.php?id=506
    Below is a 10g Model Clause example, but here instead of pivoting by A1-A2-A3 staticly I want to have these values by a distinc subquery for example;
    create table test(id varchar2(2), des varchar2(4), t number);
    INSERT INTO test values('A','a1',12);
    INSERT INTO test values('A','a2',3);
    INSERT INTO test values('A','a3',1);
    INSERT INTO test values('B','a1',10);
    INSERT INTO test values('B','a2',23);
    INSERT INTO test values('C','a3',45);
    commit;
    SELECT * FROM test;
    ID DES T
    A a1 12
    A a2 3
    A a3 1
    B a1 10
    B a2 23
    C a3 45
    select distinct i, A1, A2, A3
    from test c
    model
    ignore nav
    dimension by(c.id i,c.des d)
    measures(c.t t, 0 A1, 0 A2, 0 A3)
    rules(
    A1[any,any] = t[cv(i),d = 'a1'],
    A2[any,any] = t[cv(i),d = 'a2'],
    A3[any,any] = t[cv(i),d = 'a3']
    I A1 A2 A3
    C 0 0 45
    B 10 23 0
    A 12 3 1 Any advice is appreciated, thank you.

    Hi,
    You can do dynamic SQL in SQL*Plus, also.
    [Thid thread|http://forums.oracle.com/forums/thread.jspa?messageID=2744039&#2744039] shows how to pivot a table with a dynamic number of columns.

  • How do I replace multiple consecutive spaces with a single space?

    I need to convert any occurrence of multiple consecutive spaces in a string to a single space. How do I create the regex pattern to do that?

    r9973 wrote:
    Sorry, more like: String test = "Some        Text       Here"Want to convert to String test = "Some Text Here"
    Post the code that you used to test the regex. I just tried it and it worked fine for me. All you need to do is apply the regex replaceall to your string variable that holds the string
    String test = "Some        Text       Here";
    test = test.replaceAll(" +", " ");
    System.out.println(test);And thats it.

  • HT1495 how to use multiple apple id's with a single itunes account

    I am looking to set up two iphones and a two ipads (one for me and one for my fiance) to a single itunes account to allow us to load music and apps from the same itunes account but be able to have seperate accounts for facetime on our phones and ipads.  Any recommendations on the best way to do this?

    You cannot do that. Each Apple ID needs to be tied to each separate account. Each of you must purchase your own copies of music and apps and sync to separate iTunes Libraries on the computer. The computer must have to user accounts set up - one for you and one for your fiance.
    Sharing Stuff From Different iTunes Accounts (or Computers)
    Here's how to do so using different computers:
    Transfer what content you want to the separate iTunes library on each computer. To transfer content from your library to another library do the following. We'll assume this is between husband and wife separate accounts and different Apple IDs.
    Launch iTunes under your wife's login;
    Sign her out of iTunes, then you sign in;
    Select iTunes -> Preferences -> Devices -> Disable auto-sync when an iPod/iPhone is connected;
    Connect your phone, DO NOT SYNC;
    Select Store -> Authorize this Computer (only have to do this once);
    Select File -> Transfer Purchases (all of the purchased content on your phone will be transferred to your wife's library);
    When complete eject your phone, sign out of iTunes, sign your wife back in.
    You can now sync whatever content you want to your wife's phone. Just remember all updates to apps obtained using your account must be done while signed in using your account: sign wife out, you sign in, update apps, you sign out, sign wife in, sync her phone.
    This way you can share content (permitted under the EUSLA) and still maintain your separate logins. Do the same on your computer if you want to share content from your wife's library.
    Just load whatever content you want to share on each others phones, transfer the content, then delete it from the respective phone if you don't want to keep it there.
    Contributed by user wjosten and modified by me.
    iTunes- How to share music between different accounts on a single computer

  • How to compare numbers in a string variable?

    I have a powershell script that is grabbing the output of a website and storing it into a string variable. What I would like to do is check a line in the output which contains two numbers - the number of emails sent out of the total number of emails.
    I have not come up with a way to do this that works. I was thinking of maybe using a regex, but there are other numbers I don't care about that keep getting caught.
    Here is a sample of what is contained in the string variable:
    Email ID: 46862270 : Succeded. Time Taken: 00:00:00.0924511
    Email ID: 46862272 : Succeded. Time Taken: 00:00:00.0493887
    -- Sent 250 of 250 emails successfully. Total Dispatch Time: 00:00:08.1406995
    --State Written to DB. Time Taken for DB Write: 00:00:00.4611053
    Here is another sample:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 17 of 17 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    So if I have the above contained in a variable called $httpResponse how can I find only the line that starts with -- Sent
    and then subtract the first number from the second number?
    So for example if I have this:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    I would want the check to return 10. Is this even possible?
    Any help is appreciated!

    Sure.
    $String = @'
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    if ( $string -match 'Sent (\d+) of (\d+) emails .+' )
    { $FailedEmailCount = [int]$matches[2] - $matches[1] }
    $FailedEmailCount
    10
    Each set of parens will designate a capture group, and those can be referenced from $Matches after a successful -match.
    Just remember that they will all be strings, and to do a math operation you have to cast at least the one on the LH side to a numeric type first.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How can I perform validation of String withing TableCell to get red outline

    I have two columns in a JTable, one is defined to be an Integer and one as a String, when they edit the Integer field add enter an non-integral value the DefaultCellEditor outlines the cell in red and prevents them leaving the cell until they have either entered a valid value or cancel the operation (by pressing 'Esc' on Windows).
    Where is this behaviour I cant find it in the Java source code, I want to replicate it for a String to do the same thing if the String does not match a regular expression. I have tried subclassing DefaultCellEditor, and and passing an InputVerifier to the text component used to in the construction of the editor degate, but this has had no effect. I also tried overiding stopCellEditing() this had the effect of preventing leaving the cell until they have entered a correct value, but it does not outline it in red
    public class ExcelRefCellEditor extends DefaultCellEditor
        public ExcelRefCellEditor(JTextField textfield)
            //@TODO seems to have no effect
            super(textfield);
            textfield.setInputVerifier(new ExcelRefInputVerifier());       
        public boolean stopCellEditing()
            if(!AQExcelRef.isValidForm((String)delegate.getCellEditorValue()))
                return false;
            else
                return delegate.stopCellEditing();
    class ExcelRefInputVerifier extends InputVerifier
        public boolean verify(JComponent input)
            return AQExcelRef.isValidForm(((JTextField)input).getText());
    class AQExcelRef implements Serializable
        public static boolean isValidForm(String cellRef)
            return cellRef.matches("[A-Z]+[1-9]+");
    tc.setCellEditor(new ExcelRefCellEditor(new JTextField()));

    Thanks that works perfectly
    But I would be interested to know how it it is done for Integer columns as I cant find any code to do this in the DefaultCellEditor, and I took a quick look at the plaf packages and suns internal packages as well.

  • How to split an array (*not String*) into smaller arrays?

    Hello,
    let's say you have an array of bytes whith length (for example) 5000B. Now you want to split this array into smaller ones, for example 1500B. Then you will have 3 arrays of 1500B and another one of 500B. What I try to do then is the following:
    pointer = 0;
    size = source.length; // For example, size = 5000
    maxsize = 1500;
    while ((size - pointer) > maxsize) {
       byte[] dest = new byte[maxsize];
       System.arraycopy(src, pointer, dest, pointer, maxsize);  // <--- Errors here!
       pointer += maxsize;
       // Do some stuff here with the dest array
    }There's no errors at compile time. But at runtime, the first iteration everything works OK (the 1500 first bytes are copied to the dest array). However, in the second iteration, the java interpreter claims:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
            at java.lang.System.arraycopy(Native Method)And I don't know what I'm doing bad. I guess there's a stupid question I can't see by myself... Help wanted, please!

    > System.arraycopy(src, pointer, dest, pointer, maxsize);should be
    System.arraycopy(src, pointer, dest, 0, maxsize);Since you're copying to the first position in the destination array.

  • How to split Numbers (U32 to U8)

    Hello,
    how can i split a number into its Byte-values (U8)? I found the "Split Number"-thing in labview. Do i have to use this twice for U32? (first U32-> 2x U16 and then U16 -> 2xU8).
    Or is there also a faster /more elegant way to do this?
    Thanks for help
    Solved!
    Go to Solution.

    You can just use the Type Cast function to convert to an array of U8.
    Attachments:
    Example_VI.png ‏15 KB

  • How to replace part of a String with another String :s ?

    Got a String
    " Team_1/Team_2/Team_3/ "
    And I want to be able to rename part of the string (they are seperated by '/'), for example I want to rename "Team_3" to "Team C", and "Team_1" to "Team A" while retaining the '/' character how would I do this?
    I have tried using String.replace(oldValue, newValue); but this doesnt work, any ideas?

    What do you mean that it doesn't work? You do know that the method returns the modified string? The actual string that you invoke the method on is not altered.
    /Kaj

  • How to extract a clob xml string with multiple row of table tag. in 10g

    i have a xml value like:
    <table><c1>0</c1><c2>Mr</c2><c3>abc</c3><c4>Sharma</c4></table>
    <table><c1>0</c1><c2>Mrs</c2><c3>abcd</c3><c4>Sharma</c4></table>
    <table><c1>0</c1><c2>Mr</c2><c3>sabc</c3><c4>Sharma</c4></table>
    <table><c1>0</c1><c2>Mrs</c2><c3>sdabc</c3><c4>Sharma</c4></table>
    <table><c1>0</c1><c2>Mr</c2><c3>dabc</c3><c4>Sharma</c4></table>
    <table><c1>0</c1><c2>Mr</c2><c3>adbc</c3><c4>Sharma</c4></table>
    i want to insert each of <c> value in a table with respective columns according c1,c2,c3,c4
    pls suggest me what to do
    I use extract(xml, '/table) tab but it just read first one line & return error for other

    Can you plz explain to me thisIt is because you did not provide us with a valid xml structure so I used 11g's xmlparse function to create a xmltype even with the xml not being valid (no root tag).
    With a valid xml structure I could use the xmltype constructor instead and go on the same way as before:
    SQL> select *
      from xmltable (
             'table'
             passing xmltype ('
                            <root>
                            <table><c1>0</c1><c2>Mr</c2><c3>abc</c3><c4>Sharma</c4></table>
                            <table><c1>0</c1><c2>Mrs</c2><c3>abcd</c3><c4>Sharma</c4></table>
                            <table><c1>0</c1><c2>Mr</c2><c3>sabc</c3><c4>Sharma</c4></table>
                            <table><c1>0</c1><c2>Mrs</c2><c3>sdabc</c3><c4>Sharma</c4></table>
                            <table><c1>0</c1><c2>Mr</c2><c3>dabc</c3><c4>Sharma</c4></table>
                            <table><c1>0</c1><c2>Mr</c2><c3>adbc</c3><c4>Sharma</c4></table>
                            </root>').extract ('root/table')
             columns c1 number path 'c1', c2 varchar2 (4) path 'c2', c3 varchar2 (6) path 'c3', c4 varchar2 (6) path 'c4')
            C1 C2     C3        C4      
             0 Mr     abc       Sharma  
             0 Mrs    abcd      Sharma  
             0 Mr     sabc      Sharma  
             0 Mrs    sdabc     Sharma  
             0 Mr     dabc      Sharma  
             0 Mr     adbc      Sharma  
    6 rows selected.

  • Inserting a string with apostrophe to SQL Server

    Hi,
    I develop a windows application using C#. I try to take a value from the textbox and put it in the table on SQL server. I create a connection string and the command string (ODBC). The value I want to insert surrounded with apostrophes. The problem occurs when user wants to insert apostrophe in the textbox. It is inserted to the string value and SQL server recognizes it as an end of string.
    Does anybody know how to resolve this problem?
    thank you.

    string someVal = TextBox1.Text;
    someVal = someVal.Replace("'", "''");
    This code should double up the value entered by some user in TextBox1
    and then you can pass these values to sql command like this
    var sb = new StringBuilder();
    sb.AppendFormat("SELECT project_id,project_name" + " FROM dbo.TableName");
    sb.Append(" WHERE " + someVal);
    var select = new SqlCommand(sb.ToString(), conn))
    Product Lifecycle Development |
    Backlinks |
    Get Twitter Followers

Maybe you are looking for