1

Can any one please help me out with below query..

String query = 'SELECT ID FROM Account WHERE Name = '\+Test+\'';

database.query(query);

getting error:-

line breaks not allowed in string literals

tried this as well

String query = 'SELECT ID FROM Account WHERE Name = '\+Test+\'';

1 Answer 1

6

Try a query like this:

String query = 'SELECT ID FROM Account WHERE Name = \'Test\'';
database.query(query);

If you find this string modification difficult, then use an online tool.

Select javascript and enter your query like SELECT ID FROM Account WHERE Name = 'Test' and click submit. The output will be:

var myvar = 'SELECT ID FROM Account WHERE Name = \'Test\'';

Just change var to String and use in your query.

0

You must log in to answer this question.