aspose file tools*
The moose likes Oracle/OAS and the fly likes inserting character strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "inserting character strings" Watch "inserting character strings" New topic
Author

inserting character strings

siva sankar
Ranch Hand

Joined: Jul 13, 2006
Posts: 68
Hi,


I have to insert the following text containing special characters in oracle.can anyone help me on writing this query

The text to insert is "/action/forwardfwdPage=fwdItem&program=item&clearCache=yes"



Thanks in Advance,
Best Regards,
Siva
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
Um, which characters do you consider special? They all seem to be ASCII, so no database should have problems with them.


Ping & DNS - updated with new look and Ping home screen widget
siva sankar
Ranch Hand

Joined: Jul 13, 2006
Posts: 68
Dear Ulf,

SQL> insert into test values('
2 /action/forwardfwdPage=fwdItem&program=item&clearCache=yes');
Enter value for program:
Enter value for clearcache:
old 2: /action/forwardfwdPage=fwdItem&program=item&clearCache=yes')
new 2: /action/forwardfwdPage=fwdItem=item=yes')

1 row created.

SQL> select * from test;


VAL
--------------------------------------------------
/action/forwardfwdPage=fwdItem=item=yes



As shown above,i executed the query and the i got the result as shown.But in the result the special characters ?,& are not getting inserted.
Please look into this.


Thanks in ADvance,
Best Regards,
Siva
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
Hi Siva & Ulf,

This is not a character set problem.

An ampersand (&) is a special character in Oracle and is interpreted as the beginning of a variable name.

To prevent this interpretation of the ampersand, it must be at the end of a string. Thus, to handle the insert shown above properly, do the following:

SQL> insert into test values ('2 /action/forwardfwdPage=fwdItem&'||'program=item&'||'clearCache=yes');

1 row created.

SQL> select * from test;

VAL
--------------------------------------------------------------------------------
2 /action/forwardfwdPage=fwdItem&program=item&clearCache=yes
Chris Hendy
Ranch Hand

Joined: Mar 04, 2006
Posts: 98
As long as it is in SQL*PLUS you can also do the following:

SQL> set define off
SQL> insert into test values('/action/forwardfwdPage=fwdItem&program=item&clearCache=yes');

1 row created.

SQL> select * from test;

COL1
--------------------------------------------------------------------------------
/action/forwardfwdPage=fwdItem&program=item&clearCache=yes

SQL> set define on
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inserting character strings
 
Similar Threads
Game on SQL
handle special characters from text area using
How to handle comma in the text field?
Oracle 10g Clob Datatype Cannot Insert data
Insert a Symbol into a TextArea String