If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > how to treat special characteres

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-03, 06:02
alozano alozano is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
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.
Reply With Quote
  #2 (permalink)  
Old 10-13-03, 14:17
krohit krohit is offline
Registered User
 
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.



Quote:
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.
Reply With Quote
  #3 (permalink)  
Old 10-14-03, 03:30
alozano alozano is offline
Registered User
 
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.

Quote:
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On