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
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: 42598
    
  65
Um, which characters do you consider special? They all seem to be ASCII, so no database should have problems with them.


Ping & DNS - my free Android networking tools app
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