Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

What's wrong with my procedure

$
0
0

Hi all,

 

I write a simple procedure like below, but an error occur.

Could someone point me how to solve it? This has bothered me for nearly 2 hours.

Thanks in advance!

 

 

drop procedure create_tables;

create procedure create_tables (IN end_index int)

language SQLSCRIPT

as

my_counter int := 0;

tbname varchar(10) := '';

v_sql varchar(100);

begin

          while my_counter < end_index

          do

                    tbname := to_char(my_counter);

                    v_sql := 'create table '''|| :tbname || '''(id int)';

                    exec :v_sql;

                    my_counter := my_counter + 1;

          end while;

end;

 

call create_tables(5) ;

 

Could not execute 'call create_tables(5)' in 64 ms 874 µs .

SAP DBTech JDBC: [257]: sql syntax error:  [257] SYSTEM.CREATE_TABLES: line 14 col 3 (at pos 340): [257] (range 3) sql syntax error exception: sql syntax error: incorrect syntax near "0": line 1 col 14 (at pos 14)

 

 

Thanks.

 

Regards,

Kai


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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