INSERT INTO anothertable (inToThisColumn) VALUES ('SELECT sometable WHERE somecolumn <> 'somestring' ')
SQL and nested strings
I have an issue with sending an oracle database a key value with substrings in it.
For example:
String 1: "SELECT sometable WHERE somecolumn <> 'somestring'"
Now I need to store string 1 in one of the fields in my table, so I do the following...
The issue with this is the way it scans for the beginning and end of a string value. It gives me an error saying that Im missing commas because it assumes the value im passing it is actually two:
'SELECT sometable WHERE somecolumn <> '
and somestring''
Anyone know of how I can fix this?
Why not just use?
Unless you need the select statement stored in the table, if this is the case then you will need to double quote your strings:-
INSERT INTO anothertable (inToThisColumn) VALUES ('SELECT * from sometable WHERE somecolumn <> '''somestring''' ' )
insert anothertable (inToThisColumn)select someColumn from sometable where somecolumn <> 'somestring'
Unless you need the select statement stored in the table, if this is the case then you will need to double quote your strings:-
INSERT INTO anothertable (inToThisColumn) VALUES ('SELECT * from sometable WHERE somecolumn <> '''somestring''' ' )
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement