Certified Pega Robotics System Architect v8.0 — Question 19
You have a requirement that must return the OrderDate, OrderStatus, and OrderAmount for all orders for a given customer account in a SQL database.
How should the SQL query be specified in the CommandText property of the SqlQuery component?
Answer options
- A. SELECT OrderDate, OrderStatus, OrderAmount FROM Orders where AccountNumber={accountNumber}
- B. SELECT OrderDate, OrderStatus, OrderAmount FROM Orders where AccountNumber=?accountNumber
- C. SELECT OrderDate, OrderStatus, OrderAmount FROM Orders where AccountNumber={0}
- D. SELECT OrderDate, OrderStatus, OrderAmount FROM Orders where AccountNumber=@accountNumber
Correct answer: A
Explanation
The correct answer A uses the appropriate format for directly embedding a variable into the SQL command, which is suitable for the CommandText property. Options B, C, and D use different placeholder formats that are not applicable for this specific scenario. B uses a question mark which is not standard for this context, C uses a positional placeholder that may not work here, and D uses an '@' syntax which is not applicable for direct embedding in this case.