0
update <table> set url="http://www.google.com?a=1&something=so" 

If I'm updating directly my string is updated till ?a=1 from & it is eliminating. can any one help me in this if my url contains any special symbol and how I need to update. I'm working from java

jh314
  • 27,144
  • 16
  • 62
  • 82

2 Answers2

0

To avoid problems with string values consider using PreparedStatement and its setString method which will generate proper query with escaped values (if needed).

So try with

PreparedStatement ps = con.prepareStatement("update table set url=?");
//           +----------------------------------------------------^
//           | represents where we should put value
ps.setString(1, "http://www.google.com?a=1&something=so");

//then execute this statement
Pshemo
  • 122,468
  • 25
  • 185
  • 269
0

use this:-

update [table_name] set url='http://www.google.com?a=1'||'&'||'something=so'

here we are concatenating &, so that it does not create problem while update.

FYI.. if we have & in the string we try to update, oracle consider string following & as a parameter whose value it thinks as if it will be provided at run time, that is the reason why it was troubling you.

Saurabh Juneja
  • 1,187
  • 1
  • 8
  • 12