Skip to Content
0
Aug 07, 2012 at 12:26 PM

SQLScript to drop memory-resident columnar tables

93 Views

Hi,

I tried to write SQLScript to unload the tables from my HANA appliance on mass. But whilst it runs, it doesn't do anything. Is anyone able to spot why? Thanks so much!

Regards,

John

DROP PROCEDURE unload_tables;

CREATE PROCEDURE unload_tables() LANGUAGE SQLSCRIPT AS v_table_name

VARCHAR(20) := ''; v_table VARCHAR(60) := '';

CURSOR c_cursor1 (v_table_name VARCHAR(60) ) FOR

SELECT TABLE_NAME FROM M_CS_TABLES WHERE RECORD_COUNT!=0 AND TABLE_NAME =

:v_table_name ORDER BY MEMORY_SIZE_IN_TOTAL DESC;

BEGIN

FOR cur_row as c_cursor1(v_table_name) DO

v_table := cur_row.TABLE_NAME;

EXEC 'UNLOAD SAPBW1.(''' || :v_table || ''')';

END FOR;

END;