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

SAP HANA - Dynamic SQL for altering table causes run time error

$
0
0

Hello Experts,

 

I am trying dynamic SQL to add partition to a non partitioned table. I am doing this in a hana procedure because i want to iterate over all schemas and add partition to the target table in all schemas in my system. I am doing following query in my procedure

 

EXECUTE IMMEDIATE 'ALTER TABLE ' || :SCHEMA_NAME || '.TARGET_TABLE PARTITION BY RANGE (TARGET_TYPE_ID) (PARTITION VALUE = 1, PARTITION VALUE = 2,PARTITION VALUE = 3, PARTITION VALUE = 4, PARTITION OTHERS)';

 

But the procedure execution fails with the following error

 

Could not execute 'CALL PARTITION_TARGET_TABLE('SUREN_TEST')' in 1.160 seconds .

[129]: transaction rolled back by an internal error:  [129] "SUREN_TEST"."PARTITION_TARGET_TABLE": line 53 col 3 (at pos 2173): [129] (range 3)

 

The same query works fine if i execute directly on a particular schema. It fails if execute it as  dynamic SQL. What could be the reasons for this error?

 

Thanks,

Suren.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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