<?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 stored procs using identifier function in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149383#M53085</link>
    <description>&lt;P&gt;Ah that's a shame, I don't suppose you know whether CALL would be supported in the future? I think I can work around it by using EXECUTE IMMEDIATE instead but IDENTIFIER would be cleaner.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Feb 2026 15:20:44 GMT</pubDate>
    <dc:creator>hobrob_ex</dc:creator>
    <dc:date>2026-02-26T15:20:44Z</dc:date>
    <item>
      <title>Calling stored procs using identifier function</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149381#M53083</link>
      <description>&lt;P&gt;hi folks&lt;/P&gt;&lt;P&gt;I'm hitting an error when trying to call a stored procedure using the identifier function, potentially looks like it could be a bug.&lt;BR /&gt;&lt;BR /&gt;Calling the proc with a normal reference as follows works just fine.&lt;/P&gt;&lt;P&gt;`&lt;SPAN&gt;call&lt;/SPAN&gt; &lt;SPAN&gt;my_catalog&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;my_schema&lt;/SPAN&gt;&lt;SPAN&gt;.my_proc(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;2026-01-01&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;);`&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As soon as I try to use the identifier function so I can use variables to point at different procedure versions for a procedure I get the error further below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;`&lt;/SPAN&gt;&lt;SPAN&gt;call&lt;/SPAN&gt;&lt;SPAN&gt; identifier(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;my_catalog.my_schema.my_proc&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;)(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;2026-01-01&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;);`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;SPAN&gt;&lt;SPAN&gt;'PlanWithUnresolvedIdentifier my_catalog.my_schema.my_proc, org.apache.spark.sql.catalyst.parser.AstBuilder$$Lambda$29635/0x00007f56d3f7d8d8@340ce335 (of class org.apache.spark.sql.catalyst.analysis.PlanWithUnresolvedIdentifier)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I only get this problem with stored procedures, using identifier() for tables, views etc doesn't yield any errors.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2026 14:40:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149381#M53083</guid>
      <dc:creator>hobrob_ex</dc:creator>
      <dc:date>2026-02-26T14:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calling stored procs using identifier function</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149382#M53084</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/153311"&gt;@hobrob_ex&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This is expected behavior. According to documentation &amp;nbsp;IDENTIFIER clause is limited to the following statements:&lt;/P&gt;&lt;P&gt;"The table, view, or function subject name of a CREATE, ALTER, DROP, or UNDROP statement.&lt;/P&gt;&lt;P&gt;The target table name of a MERGE, UPDATE, DELETE, INSERT, COPY INTO statements.&lt;/P&gt;&lt;P&gt;The target of a SHOW or DESCRIBE statement.&lt;/P&gt;&lt;P&gt;USE of a schema or catalog&lt;/P&gt;&lt;P&gt;A function invocation&lt;/P&gt;&lt;P&gt;A column, table or view referenced in a query. This includes queries embedded in a DDL or DML statement."&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2026 14:54:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149382#M53084</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-02-26T14:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling stored procs using identifier function</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149383#M53085</link>
      <description>&lt;P&gt;Ah that's a shame, I don't suppose you know whether CALL would be supported in the future? I think I can work around it by using EXECUTE IMMEDIATE instead but IDENTIFIER would be cleaner.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2026 15:20:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149383#M53085</guid>
      <dc:creator>hobrob_ex</dc:creator>
      <dc:date>2026-02-26T15:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calling stored procs using identifier function</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149386#M53086</link>
      <description>&lt;P&gt;Unfortunately, I don't know. But good idea with using Execute Immediate as a workaround &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2026 15:52:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/149386#M53086</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-02-26T15:52:43Z</dc:date>
    </item>
    <item>
      <title>Hi @hobrob_ex, The IDENTIFIER() clause does not currently...</title>
      <link>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/150335#M53371</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/153311"&gt;@hobrob_ex&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The IDENTIFIER() clause does not currently support the CALL statement for stored procedures. The IDENTIFIER clause documentation lists its supported contexts: DDL operations (CREATE, ALTER, DROP, UNDROP), DML operations (MERGE, UPDATE, DELETE, INSERT, COPY INTO), query operations (SELECT), SHOW/DESCRIBE, and function invocations in expressions. CALL is not among them, which is why you are seeing the PlanWithUnresolvedIdentifier error.&lt;/P&gt;
&lt;P&gt;This is consistent with what you observed: IDENTIFIER() works for tables, views, and functions in SELECT/DDL contexts, but not for procedure names in CALL.&lt;/P&gt;
&lt;P&gt;WORKAROUND: EXECUTE IMMEDIATE&lt;/P&gt;
&lt;P&gt;You can use EXECUTE IMMEDIATE to dynamically construct and run a CALL statement. This lets you parameterize the procedure name while keeping things SQL-injection safe with proper variable handling.&lt;/P&gt;
&lt;P&gt;Option 1: Build the full CALL string dynamically&lt;/P&gt;
&lt;PRE&gt;DECLARE proc_name STRING DEFAULT 'my_catalog.my_schema.my_proc';
DECLARE call_sql STRING;
SET call_sql = 'CALL ' || proc_name || '(\'2026-01-01\')';
EXECUTE IMMEDIATE call_sql;&lt;/PRE&gt;
&lt;P&gt;Option 2: Use parameter markers for the procedure arguments (keeps the argument values parameterized, though the procedure name itself is still concatenated)&lt;/P&gt;
&lt;PRE&gt;DECLARE proc_name STRING DEFAULT 'my_catalog.my_schema.my_proc';
DECLARE call_sql STRING;
DECLARE run_date STRING DEFAULT '2026-01-01';
SET call_sql = 'CALL ' || proc_name || '(:dt)';
EXECUTE IMMEDIATE call_sql USING run_date AS dt;&lt;/PRE&gt;
&lt;P&gt;Option 3: If you are doing this from a notebook with Python/Scala, you can also use string formatting to build the SQL&lt;/P&gt;
&lt;PRE&gt;catalog = "my_catalog"
schema = "my_schema"
proc = "my_proc"
run_date = "2026-01-01"
spark.sql(f"CALL {catalog}.{schema}.{proc}('{run_date}')")&lt;/PRE&gt;
&lt;P&gt;DOCUMENTATION REFERENCES&lt;/P&gt;
&lt;P&gt;IDENTIFIER clause (supported statements):&lt;BR /&gt;
&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-names-identifier-clause.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-names-identifier-clause.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;EXECUTE IMMEDIATE:&lt;BR /&gt;
&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-aux-execute-immediate.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-aux-execute-immediate.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;CALL statement:&lt;BR /&gt;
&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-aux-call.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-aux-call.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;
&lt;P&gt;If this answer resolves your question, could you mark it as "Accept as Solution"? That helps other users quickly find the correct fix.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2026 05:47:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/calling-stored-procs-using-identifier-function/m-p/150335#M53371</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-03-09T05:47:20Z</dc:date>
    </item>
  </channel>
</rss>

