Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

LOCAL TEMPORARY TABLE in HANA Procedures

$
0
0

Hi experts,

 

I have a question about temporary tables insight SAP HANA Procedures. If I use the local SQL editor in the following way it works:

 

create local temporary table #test_table(mandt VARCHAR(3),type_id VARCHAR(4));

insert into #test_table values('001','Dum');
insert into #test_table values('002','Dum2');

     SELECT
       mandt,
       type_id
     FROM #test_table
     WHERE mandt = '001';

 

But now I want to use the same insight an procedure with edit rights. So I wrote down the following:

 

create procedure "_SYS_BIC"."d052319/DEMO_PROC" ( in MANDT VARCHAR(3) ,
                                                                                    out OUTPUT_TABLE "_SYS_BIC"."d052319/DEMO_PROC/tabletype/OUTPUT_TABLE" )

language SQLSCRIPT sql security definer  as

/*********Begin Procedure Script ************/
BEGIN

create local temporary table #test_table(mandt VARCHAR(3),type_id VARCHAR(4));

insert into #test_table values(mandt,'Dum1');
insert into #test_table values('002','Dum2');

output_table =
     SELECT
       mandt,
       type_id
     FROM #test_table
     WHERE mandt = mandt;

END
;

 

But by execution I got the error that the table #test_table doesn't exist. The same thing comes also if you create a table in the procedure and try to directly access them. But is there any possibility to say use the created table in the line before?

 

The error message if you need it for more details was:

Could not execute 'create procedure "_SYS_BIC"."d052319/DEMO_PROC" ( in MANDT VARCHAR(3) , out OUTPUT_TABLE ...'

SAP DBTech JDBC: [259] (at 353): invalid table name:  Could not find table/view #TEST_TABLE in schema D052319: line 9 col 15 (at pos 353)

 

Best regards and thanks to all of you that have helpfull answears,

Martin


Viewing all articles
Browse latest Browse all 5653

Trending Articles



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