Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Teams
, (opens new window)

One Appfire Support Knowledge Base
Results will update as you type.
  • How to improve the display of SQL source - 10.x
  • How to index SQL data
  • How to use SQL data with inline macros
  • How to resolve a Listener refused connection error - 10.x
  • How to log SQL activity
  • Pro tips
  • How to publish SQL queries on Atlassian Cloud
  • How to run SQL queries securely without page edit restrictions
  • Sample Queries - Confluence Labels
  • How to resolve the Unable to load database driver error
  • How to use Confluence metadata in SQL queries
  • How to use HTML in queries
  • How to use SQL case statement to improve the visual appeal
  • How to use SQL macros securely
  • Using the SQL macro with Markup - 9.x and earlier
  • How to resolve an Oracle validation query throwing exception - 10.x
  • UI caching problem with SQL for Confluence
  • How to create a temporary MySQL table using the SQL for Confluence (Pro edition) app
  • Using SQL File with Markup - 9.x and earlier
  • How to use MySQL functions in SQL macro
  • How to get usage information about the SQL for Confluence app
  • How to create a database profile with read-only access using the SQL for Confluence app
  • How to set SSL connection for SQL server with SQL for Confluence (Pro Edition)
  • Connect SQL macro to MS SQL database using Windows authentication
  • Unable to see table views in SQL macro
  • How to use the Expand array option in SQL for Confluence to view values with line break
  • Use SQL Macro with Markup - 10.x
  • Use SQL File Macro with Markup - 10.x
  • Create a Bar chart using SQL macro
  • Create a Pie chart using the SQL macro
  • Create an xyArea chart using the SQL macro
  • Create an xyLine chart using the SQL macro
  • How to resolve a network error due to invalid database port - 10.x
  • How to resolve isValid exceptions - 10.x
  • How to resolve a Cannot load JDBC driver error - 10.x
  • How to resolve a Permission denied error - 10.x
  • How to resolve a Validation query exception - 10.x
  • How to implement role based security for Postgre SQL database - 10.x
  • How to limit active database connections
  • How to use SQL macro in a Confluence user macro
  • How to use macros parameter within nested SQL queries
  • How to resolve the Unable to connect to database error
  • How to create a chart with SQL - 8.x
  • How to implement role based security for Postgre SQL database - 8.x
  • User Macro with sql-query failed after Confluence upgrade to 7.7 version
  • SSL connection to Oracle DB setup issues in SQL for Confluence
  • Unable to load database driver: com.xxx.jdbc.Driver
  • How to Create a Chart From SQL Data
  • How to Automatically Create a Formatted Table From SQL Data
    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    How to use macros parameter within nested SQL queries
    Updated Feb 28, 2020

    How to use macros parameter within nested SQL queries

    Feb 28, 2020

    The macros=true parameter has a limitation when used in nested SQL queries.

    For example, consider the following use case where the output of an outer query is fed as an input to the inner SQL query:

    select ap.directory_id, CONCAT('{sql-query:dataSource=SQLSERVER|table=false} use jiradbnew; select user_name, directory_id, display_name, email_address, dir.directory_position from cwd_user usr join cwd_directory dir on dir."id" = usr."directory_id" and dir."id"= ', ap.DIRECTORY_ID, ' {sql-query}') as "JiraVal" from cwd_group ap

    In this case, if macros is set to true, the inner query executes first, thus, substitution values for directory_id is not available. Therefore, this query is not executed successfully.

    {"serverDuration": 15, "requestCorrelationId": "0cb026f303e44a2d8bed51edc33f9ab7"}