Unity
SQL To MCPS Converter
Table of Contents
SQL TO MCPS CONVERTER ................................................................................................................................ 1
INTRODUCTION ............................................................................................................................................... 2
CONVERT SQL TO MCPS IN EXPERT CONFIG ....................................................................................................... 2
LIMITATIONS & USAGE GUIDELINES ................................................................................................................................... 3
Supported Functions ............................................................................................................................................. 4
ERROR REPORTING & TROUBLESHOOTING .......................................................................................................................... 5
USER ROLES ..................................................................................................................................................... 5
LEARN MORE ................................................................................................................................................... 5
1 Oracle Unity
Copyright © 2025, Oracle and/or its affiliates / Public
Unity
Introduction
Unity users can now seamlessly convert SQL queries into MCPS queries using the Expert Config
interface. The generated MCPS can be reused across multiple features, including external
segments, DSVs for intelligent attributes and 360 profile explorer. This feature simplifies usage
by allowing users to work with familiar SQL instead of MCPS queries and accelerates adoption
by making advanced features more accessible to technical teams.
This guide outlines the step-by-step process to convert SQL queries into MCPS queries using
Expert Config.
Convert SQL to MCPS in Expert Config
Follow these steps to convert a SQL query into MCPS via the Expert Config interface in Oracle
Unity:
• Open Expert Config
Navigate to the following URL:
[Link]
• Set Request Type
o Select POST from the HTTP method drop-down
o Select api-data as the target API
• Enter Endpoint
In the /data/ input field, enter:
query/sql2mcps
• Input SQL Query
In the Request text area, paste your SQL query. The SQL-to-MCPS converter supports
only SQL written in the MySQL dialect.
Please ensure your queries follow MySQL syntax to avoid parsing errors or unexpected
results.
• Run the Request
Click Run to initiate the conversion.
• View the Result
The corresponding MCPS query will be displayed in the Response text area.
2 Oracle Unity
Copyright © 2025, Oracle and/or its affiliates / Public
Unity
Limitations & Usage Guidelines
To ensure accurate and consistent conversion, the following limitations and best practices apply
1. Only transitive joins are supported
Only standard join chains (transitive joins) are supported in conversion
2. Use explicit Aliases to avoid ambiguity
Avoid potentially ambiguous statements by always using table aliases.
• ✅ OK:
SELECT [Link] FROM mcpsdw_Customer cust JOIN mcpsdw_Event event ON
[Link] = [Link]
• ❌ Not OK:
SELECT ID FROM mcpsdw_Customer cust JOIN mcpsdw_Event event ON
[Link] = [Link]
3. Only explicit equi-joins are supported
Implicit joins using comma-separated tables are not allowed.
• ✅ OK:
SELECT [Link] FROM mcpsdw_Customer cust JOIN mcpsdw_Event event ON
[Link] = [Link]
• ❌ Not OK:
SELECT [Link] FROM mcpsdw_Customer cust, mcpsdw_Event event WHERE
[Link] = [Link]
3 Oracle Unity
Copyright © 2025, Oracle and/or its affiliates / Public
Unity
4. Avoid single letter aliases
Use meaningful aliases for clarity and compatibility.
• ✅ OK:
SELECT [Link] FROM mcpsdw_Customer cust
• ❌ Not OK:
SELECT [Link] FROM mcpsdw_Customer c
5. Case sensitivity applies
Table names, aliases and column names are case sensitive. Ensure consistent usage.
6. Use ANSI_QUOTES for reserved keywords like Date, Order, Primary, Sequence etc.
When referring to reserved keywords, wrap them in double quotes.
• ✅ OK:
SELECT ev."Date" FROM mcpsdw_Event ev
• ❌ Not OK:
SELECT [Link] FROM mcpsdw_Event ev
Supported Functions
Row-Level Functions
Includes most common scalar and date/time functions
ABS, ACOS, ASIN, ATAN, ATAN2, CEIL, CEILING, CONCAT, COS, CURRENT_DATE,
CURRENT_TIMESTAMP, DATEDIFF, DATE_ADD, DATE_SUB, DAY, EXP, FLOOR,
HOUR, IFNULL, INSTR, LEFT, LENGTH, LN, LOG, LOWER, LPAD, LTRIM, MINUTE,
MOD, MONTH, POWER, REPLACE, REVERSE, RIGHT, ROUND, RPAD, RTRIM, SIGN,
SIN, SQRT, SUBSTRING, TAN, TIMESTAMP, TIMESTAMPADD, TIMESTAMPDIFF,
TRIM, TRUNCATE, UPPER, YEAR
Window Functions
Following window functions are supported
• ROW_NUMBER(<val>) OVER (PARTITION BY <val> [ORDER BY <val>
ASC|DESC]*)
• DENSE_RANK(<val>) OVER (PARTITION BY <val> [ORDER BY <val>
ASC|DESC]*)
• FIRST_VALUE(<val>) OVER (PARTITION BY <val> [ORDER BY <val>
ASC|DESC]*)
• LAST_VALUE(<val>) OVER (PARTITION BY <val> [ORDER BY <val>
ASC|DESC]*)
• LEAD(<val> [, offset, default]) OVER (PARTITION BY <val> [ORDER BY <val>
ASC|DESC]*)
• LAG(<val> [, offset, default]) OVER (PARTITION BY <val> [ORDER BY <val>
ASC|DESC]*)
• SUM(<val>) OVER (PARTITION BY <val>)
4 Oracle Unity
Copyright © 2025, Oracle and/or its affiliates / Public
Unity
Aggregate Functions
Following aggregate functions are supported
SUM, MAX, AVG, COUNT, MIN, GROUP_CONCAT, STD, STDDEV, STDDEV_POP,
STDDEV_SAMP, VAR_POP, VAR_SAMP, VARIANCE
Error Reporting & Troubleshooting
SQL Convertor Errors
• Example: Query parse exception on line 10, column 4
• Causes:
o Invalid MySQL syntax
o Missing aliases in expressions (e.g. MAX([Link]) without alias)
o Use of unquoted reserved words as
identifiers [Link]
o Invisible whitespace (tab/space) at error position
User Roles
Users with any of the following roles can use the SQL to MCPS endpoint in Expert config
• Instance Admin
Learn More
User Roles
External Segments
5 Oracle Unity
Copyright © 2025, Oracle and/or its affiliates / Public