<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling a function with parameters via Spark ODBC driver in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142661#M51997</link>
    <description>&lt;P&gt;Thank you for the swift and informative answer.&lt;BR /&gt;That is a little disappointing, but does provide me with a path forward.&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Dec 2025 21:55:18 GMT</pubDate>
    <dc:creator>CHorton</dc:creator>
    <dc:date>2025-12-29T21:55:18Z</dc:date>
    <item>
      <title>Calling a function with parameters via Spark ODBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142605#M51980</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am having an issue with calling a Databricks SQL user defined function with parameters from my client application using the Spark ODBC driver.&lt;/P&gt;&lt;P&gt;I have been able to execute a straight SQL statement using parameters e.g.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;SELECT * FROM Customer WHERE CustomerId = ?&lt;/LI-CODE&gt;&lt;P&gt;But if I try to execute a statement that contains a parameterised function it will not work e.g.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;SELECT * FROM GetCustomerData(?)&lt;/LI-CODE&gt;&lt;P&gt;I always get an&amp;nbsp;[UNBOUND_SQL_PARAMETER] error.&amp;nbsp; I suspect that Databricks needs named parameter binding, but ODBC doesn't support that, so I am a bit stuck.&lt;/P&gt;&lt;P&gt;Has anyone come across this issue before, or have a solution?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 05:21:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142605#M51980</guid>
      <dc:creator>CHorton</dc:creator>
      <dc:date>2025-12-29T05:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a function with parameters via Spark ODBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142615#M51981</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/202260"&gt;@CHorton&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is a known limitation when calling Databricks SQL user defined functions with parameters through the Spark ODBC driver. Positional parameters using question marks are supported in standard SQL statements, but they are not supported when used inside function calls, which is why the unbound SQL parameter error occurs. Databricks SQL currently expects parameters to be resolved before function evaluation and does not support parameter binding for UDF arguments through ODBC. A common workaround is to avoid parameterized function calls and instead rewrite the logic inline in the SQL query or use a view or table valued function that does not require runtime parameters. Another option is to construct the SQL string dynamically in the client application with the parameter value substituted, taking care to handle escaping safely.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 09:15:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142615#M51981</guid>
      <dc:creator>mukul1409</dc:creator>
      <dc:date>2025-12-29T09:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a function with parameters via Spark ODBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142622#M51985</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/202260"&gt;@CHorton&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The Databricks SQL engine does not support positional (?) parameters inside SQL UDF calls.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When Spark SQL parses GetCustomerData(?), the parameter is unresolved at analysis time, so you get [UNBOUND_SQL_PARAMETER]. This is not an ODBC bug, it’s a Spark/Databricks SQL limitation. Parameters work only in expressions like WHERE, JOIN, etc.&lt;BR /&gt;&lt;BR /&gt;you can use&amp;nbsp;Stored procedure which supports parameters and work correctly from ODBC.&lt;BR /&gt;1) Create a Stored procedure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CREATE OR REPLACE PROCEDURE GetCustomerDataSP (cust_id INT)
RETURNS TABLE
LANGUAGE SQL
AS
BEGIN
RETURN
SELECT *
FROM Customer
WHERE CustomerId = cust_id;
END;&lt;/LI-CODE&gt;
&lt;P&gt;2)&amp;nbsp;Call it from SQL&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALL GetCustomerDataSP(123);&lt;/LI-CODE&gt;
&lt;P&gt;or Call it via ODBC (parameterized)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALL GetCustomerDataSP(?);&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 29 Dec 2025 09:32:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142622#M51985</guid>
      <dc:creator>iyashk-DB</dc:creator>
      <dc:date>2025-12-29T09:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a function with parameters via Spark ODBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142661#M51997</link>
      <description>&lt;P&gt;Thank you for the swift and informative answer.&lt;BR /&gt;That is a little disappointing, but does provide me with a path forward.&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 21:55:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-a-function-with-parameters-via-spark-odbc-driver/m-p/142661#M51997</guid>
      <dc:creator>CHorton</dc:creator>
      <dc:date>2025-12-29T21:55:18Z</dc:date>
    </item>
  </channel>
</rss>

