Advertisement Jump to content
Sign in to follow this  

SQL and nested strings

This topic is 4912 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...
INSERT INTO anothertable (inToThisColumn) VALUES ('SELECT sometable WHERE somecolumn <> 'somestring' ')

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?

Share this post

Link to post
Share on other sites
Why not just use?

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''' ' )

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!