Skip to Content
0
Former Member
Jun 24, 2015 at 10:45 AM

How to use a variable as a select for Columns

15 Views

Hi,

we are students and currently trying to execute a procedure which involves using a variable to select a specific column out of a given table. We use the variable "table_name" to store the String value for the column that we need to select. The code is as following:

CREATE PROCEDURE "MY_DIRECTORY"."test_procedure" (IN table_name NVARCHAR(30))

LANGUAGE SQLSCRIPT AS

BEGIN

DECLARE temp DOUBLE := 0;

.......

SELECT :table_name INTO temp FROM "MY_DIRECTORY"."test" WHERE "DATUM" = '2015-03-02 00:31:00';

.......

END;


call "MY_DIRECTORY"."test_procedure" ('VSA191_D1_T1_ZAEHL');



Is there any chance that this code is executable by useing a workaround? We would be very glad for your support.


Kai