BMQL Tutorial: A Beginner's Guide to BigMachines Query Language
BMQL Tutorial: A Beginner's Guide to BigMachines Query Language
BMQL (BigMachines Query Language) is one of the most powerful features in Oracle CPQ Cloud. It allows you to query data from Commerce tables and Data Tables, enabling dynamic pricing, lookups, and complex business logic. This tutorial will get you started with BMQL fundamentals.
What is BMQL?
BMQL is a SQL-like query language specific to Oracle CPQ Cloud. It lets you:
- Query Data Tables for pricing, product data, and business rules
- Look up Commerce data from transactions and quotes
- Filter, aggregate, and transform data within BML scripts
- Create dynamic, data-driven configurations
BMQL Syntax Basics
Basic SELECT Query
Query with Variables
Multiple Conditions
Working with Results
BMQL returns a Record Set that you iterate through:
Checking for Empty Results
Common BMQL Operations
Aggregations
LIKE Operator for Pattern Matching
IN Operator
ORDER BY
Data Tables vs Commerce Tables
Data Tables
Data Tables store reference data that doesn't change per transaction:
- Pricing matrices
- Product catalogs
- Discount rules
- Regional settings
Commerce Tables
Commerce tables store transaction-specific data:
- Quote headers
- Quote lines
- Configuration attributes
Best Practices
1. Use Indexes Wisely
Query on indexed columns for better performance:
2. Limit Result Sets
Only select columns you need:
3. Avoid BMQL in Loops
Execute BMQL outside loops when possible:
4. Use String Escaping
Prevent BMQL injection by escaping user input:
Common Errors and Solutions
Error: "Column not found"
Cause: Typo in column name or querying wrong table
Solution: Verify column names in Data Table definition
Error: "Invalid BMQL syntax"
Cause: Missing quotes, parentheses, or invalid operators
Solution: Check SQL syntax, especially string literals
Error: "Query timeout"
Cause: Unindexed query or too much data
Solution: Add indexes, limit results, optimize query
Example: Dynamic Pricing Lookup
Here's a complete example of using BMQL for tiered pricing:
Next Steps
Now that you understand BMQL basics:
- Practice with simple queries on Data Tables
- Explore Commerce table schemas in your environment
- Build reusable BML functions for common queries
- Optimize queries for production performance
For more Oracle CPQ tutorials, check out our Oracle CPQ training services.
Need Expert CPQ Help?
Our certified CPQ consultants can help you implement best practices and optimize your quote-to-cash process.
Get in Touch