Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Unanswered: how to treat special characteres

    Hi all,

    I have a jsp with some text boxes. This information will be inserted into the database. The user can type single quotas ' or \n or \r. But Oracle does not support these kind of characteres.


    How can I replace this information (which is the text box) to make then understable to Oracle?

    Is there any function in oracle like replace that I can use it? I haven´t found it.

    I have read that you can use urldecoder but I am not sure.

    Thanks in advance

    Ana.

  2. #2
    Join Date
    Oct 2003
    Posts
    12

    Post Re: how to treat special characteres

    Oracle provides the function DECODE which compares its first argument to one or more search expressions, which are paired with result expressions. Any search or result expression can be null. If a search is successful, the corresponding result is returned. e.g., if the column rating is null, DECODE returns the value 1000:

    SELECT DECODE(rating, NULL, 1000, 'C', 2000, 'B', 4000, 'A', 5000)
    INTO credit_limit FROM accts WHERE acctno = my_acctno;

    Also, one can use the function REPLACE that returns the value of its first argument if its second argument is null, whether the optional third argument is present or not. e.g.,
    new_string := REPLACE(old_string, NULL, my_string);

    - Rohit.



    Originally posted by alozano
    Hi all,

    I have a jsp with some text boxes. This information will be inserted into the database. The user can type single quotas ' or \n or \r. But Oracle does not support these kind of characteres.


    How can I replace this information (which is the text box) to make then understable to Oracle?

    Is there any function in oracle like replace that I can use it? I haven´t found it.

    I have read that you can use urldecoder but I am not sure.

    Thanks in advance

    Ana.

  3. #3
    Join Date
    Oct 2003
    Posts
    2

    Exclamation Re: how to treat special characteres

    Thanks Rohit, it is very helpful

    But what I want is to insert a text (which is taken from an application form) that can have single quotas, break line and other characteres (because this text can be copied to the form for MS Word doing copy and paste) that Oracle does not accept, so I have to convert these special characteres before I insert this text into the database. So I want to convert all this text at the same time.

    Thanks in advance

    Ana.

    Originally posted by krohit
    Oracle provides the function DECODE which compares its first argument to one or more search expressions, which are paired with result expressions. Any search or result expression can be null. If a search is successful, the corresponding result is returned. e.g., if the column rating is null, DECODE returns the value 1000:

    SELECT DECODE(rating, NULL, 1000, 'C', 2000, 'B', 4000, 'A', 5000)
    INTO credit_limit FROM accts WHERE acctno = my_acctno;

    Also, one can use the function REPLACE that returns the value of its first argument if its second argument is null, whether the optional third argument is present or not. e.g.,
    new_string := REPLACE(old_string, NULL, my_string);

    - Rohit.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •