<?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: How can i pass one of the values from one function to another as an argument in Databricks SQL? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24350#M16919</link>
    <description>&lt;P&gt;@Hubert Dudek​&amp;nbsp;, How will it work if func_multiply() also returns a table? Can i write such a select statement in that case?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2022 08:21:50 GMT</pubDate>
    <dc:creator>Sudeshna</dc:creator>
    <dc:date>2022-03-30T08:21:50Z</dc:date>
    <item>
      <title>How can i pass one of the values from one function to another as an argument in Databricks SQL?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24348#M16917</link>
      <description>&lt;P&gt;For eg - &lt;/P&gt;&lt;P&gt;CREATE OR REPLACE TABLE table2(a INT, b INT);&lt;/P&gt;&lt;P&gt;INSERT INTO table2 VALUES (100, 200);&lt;/P&gt;&lt;P&gt;CREATE OR REPLACE FUNCTION func1() RETURNS TABLE(a INT, b INT)&amp;nbsp;RETURN&amp;nbsp;&lt;/P&gt;&lt;P&gt;(SELECT a+b, a*b from table2);&lt;/P&gt;&lt;P&gt;create or replace function calc(p DOUBLE) RETURNS TABLE(val DOUBLE) RETURN (SELECT a from func1());&lt;/P&gt;&lt;P&gt;select calc(a) from func1();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This throws me an error -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1989i7BEB591F36956174/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;Now, i understand the way i am trying to do this is wrong. Is there any way to do this? If so, then how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 18:27:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24348#M16917</guid>
      <dc:creator>Sudeshna</dc:creator>
      <dc:date>2022-03-29T18:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can i pass one of the values from one function to another as an argument in Databricks SQL?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24349#M16918</link>
      <description>&lt;P&gt;Yes, it is possible, but with different logic. For scalar, so calc(a) in &lt;B&gt;select calc(a) from func1(); &lt;/B&gt;it can only be a query as a table for a scalar is not allowed. So please try something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE OR REPLACE FUNCTION func_table() RETURNS TABLE(a INT, b INT) RETURN (SELECT a+b, a*b from table2);
&amp;nbsp;
CREATE OR REPLACE FUNCTION func_multiply(p INT) RETURNS INT RETURN SELECT p * 2;
&amp;nbsp;
select func_multiply(a), a FROM func_table();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1984i1B1E96AD057D8A7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 22:18:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24349#M16918</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-03-29T22:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can i pass one of the values from one function to another as an argument in Databricks SQL?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24350#M16919</link>
      <description>&lt;P&gt;@Hubert Dudek​&amp;nbsp;, How will it work if func_multiply() also returns a table? Can i write such a select statement in that case?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 08:21:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-pass-one-of-the-values-from-one-function-to-another-as/m-p/24350#M16919</guid>
      <dc:creator>Sudeshna</dc:creator>
      <dc:date>2022-03-30T08:21:50Z</dc:date>
    </item>
  </channel>
</rss>

