Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2014
    Posts
    8

    Unanswered: procedure array variables stored procedure

    I have created a stored procedure with some parameters (variables)

    the parameters can contain different values, therefore I need to implement arrays;

    Could someone help me on the right way?

    I have created following but I am still receiving an error in running the script; could anyone check? The select should return all records with the values identified in the parameter before running the procedure.

    Thanks,



    step 1 : create array type:

    create type table_name_array as varchar(10) array[100]

    step 2 : create stored procedure:

    CREATE OR REPLACE PROCEDUREmyproc

    (

    p_table_name IN table_name_array ,



    )

    AS

    BEGIN

    SET p_table_name = Array['T001', 'T002', 'T003'];



    cursor c_my_table

    is

    select domain,

    group,

    table_name,

    from mytable

    where

    table_name IN (case when p_table_name is null then table_name else p_table_name end)

    ;

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    have a look in developerswork : many topics
    https://www.ibm.com/developerworks/c...e-af91815413fb
    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
  •