Skip to Content
1
Former Member
Jul 22, 2013 at 09:29 AM

Use hdbsql to create a stored procedure

591 Views

Hi,

I've created a procedure within hdbstudio but I am miserably failing to import it using hdbsql. 😕

Maybe someone can give me a hint what's wrong:

-- Drop and create tableDROP TABLE RANDOMDATA;CREATE COLUMN TABLE RANDOMDATA( STR1 NCLOB );DROP PROCEDURE RANDOMGENERATOR;CREATE PROCEDURE RANDOMGENERATOR LANGUAGE SQLSCRIPT ASCNTR2 INTEGER;RDNR DOUBLE;RSTR NCLOB;TOPVAL INTEGER;BEGINCNTR2 := 0;RDTR := '';-- RAND() = 18 Chars - >100.000 you might get out-of-memoryTOPVAL := ROUND(50000/18,-1);RDNR := RAND();-- Loop to create the very long stringWHILE CNTR2 < :TOPVAL DO RSTR := RSTR || RDNR;CNTR2 := CNTR2 + 1;END WHILE;-- Remove old and insert new dataDELETE FROM RANDOMDATA;INSERT INTO RANDOMDATA SELECT SUBSTR(:RSTR,0,4096) FROM DUMMY;END;CALL RANDOMGENERATOR;

As said, it's working great inside hdbstudio but using hdbsql it fails as soon as the PROCEDURE part is starting.

Thanks for helping,

HP