Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: Using dymanic table name for running select queries

$
0
0

Hello. Thx for response.

 

I have tried something like

 

exec 'INSERT INTO "tuser"."dam.test.db::tuser.procedures.search_result" SELECT '''||table_name||''' AS TABLE_NAME, '||column_name||' AS ID, SCORE() AS SCORE  FROM '||table_name||' WHERE contains(*, '''||keyword||''', fuzzy(0.5))';

 

but here i have "tuser"."dam.test.db::tuser.procedures.search_result" created before the execution. What i really want is to make it as a local variable. Something like:

 

DECLARE schema_name NVARCHAR(300) := 'tuser';

indexed_tables = SELECT DISTINCT "TABLE_NAME" FROM "SYS"."FULLTEXT_INDEXES" WHERE "SCHEMA_NAME" = :schema_name ;

 

but i can not transform the top 'exec ...' statement into 'result = SELECT ...' because it always says that it can not pass the scalar value into the 'FROM ...' part.


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>