Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

How to define ARRAY of varying length? - response (1) by Adharssh

$
0
0

Hi Avi,

 

I didn't understand the Question Properly. The question from you must be The Array is of size VARCHAR(100) in length and the no of Array Elements would be passed in Run Time. The Array Syntax is,

 

CREATE TYPE numbers_ary AS VARCHAR(100) ARRAY[5];

 

Your query can be solved by using Procedure. You can get the Parameter for the Arrayelement an you can construct the Procedure like this,

 

 

 

CREATE PROCEDURE PROC1(IN VALUE INTEGER, OUT P2 INTEGER)

 

BEGIN

 

DECLARE QUER VARCHAR(100); 

 

QUER='CREATE TYPE numbers_ary VARCHAR(100) ARRAY['||:VALUE'||'];'

 

CALL DBC.SYSEXECsql(QUER);

 

SET P2=SQLCODE

 

END;

 

This Procedure, will create the Variable length Array. 

 

 

 

Thanks & Regards,

 

Adharssh.


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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