Results 1 to 4 of 4

Thread: Varray in db2

  1. #1
    Join Date
    Jun 2015
    Posts
    2

    Unanswered: Varray in db2

    Hi Db2 genius

    is there any way to create column as array type in db2, like in oracle using varray?

    Eg:-

    CREATE OR REPLACE TYPE vstatus AS VARRAY(10) OF VARCHAR2(128);
    /
    CREATE TABL varray_table (id number, status vstatus);

  2. #2
    Join Date
    Apr 2015
    Posts
    13
    Hi Logan,

    Please go through below link.

    https://www-01.ibm.com/support/knowl....0%2F2-10-6-97

  3. #3
    Join Date
    Jun 2015
    Posts
    2
    Hi mtaral

    thank you for the update.
    I tried but it did not work..

    CREATE TYPE vstatus AS VARCHAR(20) ARRAY[5]
    CREATE TABLE varray_table (id number, status vstatus);

    getting below error..
    A "ARRAY" data type is not supported in the context where it is being used.. SQLCODE=-20441, SQLSTATE=428H2, DRIVER=4.14.113

    I am using db2 10.5 does it mean db2 does not really support to create column as array type.

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    according the doc
    Array type usage: An array type can only be used as the data type of:
    A local variable in a compound SQL (compiled) statement
    A parameter of an SQL routine
    A parameter of a Java™ procedure (non-nested ordinary arrays only)
    The returns type of an SQL function
    A global variable
    A variable or parameter defined with an array type can only be used in compound SQL (compiled) statements
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •