How can i pass one of the values from one function to another as an argument in Databricks SQL?

Sudeshna
Databricks Partner

For eg -

CREATE OR REPLACE TABLE table2(a INT, b INT);

INSERT INTO table2 VALUES (100, 200);

CREATE OR REPLACE FUNCTION func1() RETURNS TABLE(a INT, b INT) RETURN 

(SELECT a+b, a*b from table2);

create or replace function calc(p DOUBLE) RETURNS TABLE(val DOUBLE) RETURN (SELECT a from func1());

select calc(a) from func1();

This throws me an error -

imageNow, i understand the way i am trying to do this is wrong. Is there any way to do this? If so, then how?