Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2025 12:41 AM
hi ,
I am trying to create a databricks sql unity catalog function which will take table_name as input parameter and returns the full table as output. I am getting error, kindly help
CREATE OR REPLACE FUNCTION catalog.schema.get_table( table_name STRING)
RETURNS TABLE
RETURN
(
select * from IDENTIFIER('catalog.schema.' || get_table.table_name)
)
error ---
[NOT_A_CONSTANT_STRING.NOT_CONSTANT] The expression concat('kdp_bronze_prod.salesforce.', outer(get_table.user_id)) used for the routine or clause IDENTIFIER must be a constant STRING which is NOT NULL. To be considered constant the expression must not depend on any columns, contain a subquery, or invoke a non deterministic function such as rand(). SQLSTATE: 42601
select * from IDENTIFIER('catalog.schema.' || get_table.table_name)
)
error ---
[NOT_A_CONSTANT_STRING.NOT_CONSTANT] The expression concat('kdp_bronze_prod.salesforce.', outer(get_table.user_id)) used for the routine or clause IDENTIFIER must be a constant STRING which is NOT NULL. To be considered constant the expression must not depend on any columns, contain a subquery, or invoke a non deterministic function such as rand(). SQLSTATE: 42601