4

According to the documentation here

In a syntax statement, the question mark indicates the element preceding it is optional. You may omit the element or include one.

I've never seen a SOQL statement using the ? and in my tests with the Query Editor in the Developers Console only results in errors.

Can anybody tell me how to use the ? in a SOQL, and what it might be good for?

  • These are typographical conventions to read the document. – Ashwani Oct 1 '14 at 18:35
4

You wouldn't use "?" in a query. They're saying it marks an optional query element. Here's an example from the documentation:

[ORDER BY fieldExpression ASC | DESC ? NULLS FIRST | LAST ?]

So if you include an "Order By" in your query, the "ASC | DESC" and "FIRST | LAST" elements are optional.

(You appear to be quoting from the SOQL Typographical Conventions which relate to documentation syntax rather than SOQL syntax.)

3

These are typographical conventions to read the document. So, you could understand it better and implement in example.

Ex:

SELECT fieldname FROM objectname

In an example or syntax statement, italics represent variables. You supply the actual value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.