Jump to content
  • Advertisement
Sign in to follow this  
ju2wheels

SQL and nested strings

This topic is 4844 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
Advertisement
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!