Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8039813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:41:52+00:00 2026-06-05T03:41:52+00:00

How I Can pass multiple values in a single parameter to a stored procedure

  • 0

How I Can pass multiple values in a single parameter to a stored procedure in Informix?.

This is a frequent question but I have seen noyhing about informix.

I found a post, but it is not working for me, should be the version of the DB or am I missing something?

I’m trying this to perform a WHERE X IN (SELECT Y FROM TABLE(PARAM))

Edit:

This is an example of what Im trying to do.

CREATE PROCEDURE test_hector
(
    C LIST( SET (CHAR(10) NOT NULL ) NOT NULL)
)
RETURNING CHAR(10) AS C, CHAR(10) AS CVE, CHAR(50) AS DESC;

DEFINE vColumna like tclaves.columna;
DEFINE vClave like tclaves.clave;
DEFINE vdescve like tclaves.descve;

FOREACH
select columna, clave, descve
INTO vColumna, vClave,vdescve
from tclaves
where columna in (SELECT * FROM TABLE(C))
RETURN vColumna, vClave,vdescve WITH RESUME;
END FOREACH
END PROCEDURE;

I’m trying to execute it but I think I’m having sintax problems

EXECUTE PROCEDURE test_hector( '{stspols,stsrepo}');

I’m getting the error message [Informix][Informix ODBC Driver][Informix]Invalid collection literal value.

I executed this function execute function se_release() to obtain the informix version this is what I got.

column1
Spatial DataBlade Release 8.21.FC4R1 (Build 238)                 Compiled on Thu Aug 26 19:42:55 CDT 2010 with:                      IBM Informix Dynamic Server Version 10.00.FC7                    glslib-4.00.UC10

I’m using Aqua Data Studio 8.0.22 to create and execute the procedure. Runinng on Windows 7 Ultimate 32-Bits

Thanks in advance. For any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:41:53+00:00Added an answer on June 5, 2026 at 3:41 am

    Define the parameter type as an appropriate collection type: LIST, SET, MULTISET (which is what I said in the answer to the cross-referenced question).

    • What isn’t working for you?
    • What did you try?
    • What is the error message you get?
    • Which version of Informix server are you using?
    • Which tool or API are you using to create the stored procedure?
    • Which tool or API are you using to execute the stored procedure?
    • Which platform are you running on?
    • How are you invoking the procedure?

    Thanks for amplifying the question. You say:

    EXECUTE PROCEDURE test_hector('{stspols,stsrepo}');
    

    I’m getting the error message [Informix][Informix ODBC Driver][Informix]Invalid collection literal value.

    This may be a simpler problem to fix than it appears on the surface. The input type for the procedure is supposed to be a collection — in fact, a LIST of SET values — where each value is a character string. You can write that as:

    EXECUTE PROCEDURE test_hector(LIST{SET{'stspols','stsrepo'}});
    

    I created myself a dummy procedure to test this syntax:

    CREATE PROCEDURE test_hector(c LIST(SET (CHAR(10) NOT NULL ) NOT NULL))
        RETURNING CHAR(10) AS C, CHAR(10) AS CVE, CHAR(50) AS DESC;
        return "abc", "def", "ghi";
    END PROCEDURE;
    

    And the output from it was as expected:

    abc   def   ghi
    

    Note that Informix supports a comment style started by { and ended by the first following }. However, that comment style is suppressed when the keyword before the { is one of SET, MULTISET or LIST (and yes, that does make it really hard to parse!). You can have immense (if perverted) fun with "where can you add the {} in the SQL above" without changing its meaning. There’s an outside chance that an API might recognize Informix {} comments but not recognize the collection-exception. In that case, you’d probably get back a syntax error (because the second } is not expected if you interpret the first { as a start comment symbol). In that case, use one of the notations below.

    The notation for collection (SET, MULTISET, LIST) literals evolved over time. This alternative notation also works (and is more closely related to what you tried originally, and is what was documented originally):

    EXECUTE PROCEDURE test_hector('LIST{SET{''stspols'',''stsrepo''}}');
    

    The strings within the SET must be enclosed in quotes, but the whole literal is itself a string, so you need to double the embedded quotes. You could also ‘cheat’ and use double quotes and single quotes:

    EXECUTE PROCEDURE test_hector('LIST{SET{"stspols","stsrepo"}}');
    EXECUTE PROCEDURE test_hector("LIST{SET{'stspols','stsrepo'}}");
    

    From the discussion below, and as described in the alternative answer, the problem now seems to be related to the nested collections. A LIST{SET{"str1", "str2"}} is an ordered list (with one entry in it); that entry is itself a set of (distinct) strings, which has no particular order. You’d use a MULTISET if you needed to be able to repeat strings (but the order isn’t important). You use a LIST is order is important (and duplicates are allowed in a list).

    It sounds as if you really only need to choose the argument type so that it is simpler. You should be able to use any one collection type effectively; I’d probably nominate SET so that you don’t have to deal with repeated strings in the list, but MULTISET or LIST are also valid options. With a procedure renamed to test_3():

    CREATE PROCEDURE test_3(c SET(CHAR(10) NOT NULL))
        RETURNING CHAR(10) AS r;
        DEFINE r CHAR(10);
        FOREACH SELECT * INTO r FROM TABLE(c)
            RETURN r WITH RESUME;
        END FOREACH;
    END PROCEDURE;
    

    I was able to execute both the statements following, with the results shown:

    + EXECUTE PROCEDURE test_3(SET{'stspols','stsrepo'});
    stspols
    stsrepo
    + EXECUTE PROCEDURE test_3('SET{''stspols'',''stsrepo''}');
    stspols
    stsrepo
    

    This was using an ESQL/C interface. You should be able to get the second to work with ODBC; the first may cause a -201 syntax error.

    If you prefer LIST to SET, then change SET to LIST in the code above:

    + CREATE PROCEDURE test_3(c LIST(CHAR(10) NOT NULL))
        RETURNING CHAR(10) AS r;
        DEFINE r CHAR(10);
        FOREACH SELECT * INTO r FROM TABLE(c)
            RETURN r WITH RESUME;
        END FOREACH;
    END PROCEDURE;
    + EXECUTE PROCEDURE test_3(LIST{'stspols','stsrepo'});
    stspols
    stsrepo
    + EXECUTE PROCEDURE test_3('LIST{''stspols'',''stsrepo''}');
    stspols
    stsrepo
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pass multiple rows to a stored procedure. Can I use a
Can anyone explain to me how to pass multiple values into a parameter or
Using Simple.Data how can I pass multiple values to a query? Example generated SQL:
I am trying to pass multiple values for a single field name to an
If I have an enum with multiple values which can be present at the
I'm trying to write my own protocol so that multiple servers can pass data
I know that I can pass a string as the second parameter to the
If I have a auto_ptr I can pass it for a reference?Like: auto_ptr<MyClass>Class(new MyClass);
Is there any way that I can pass arguments in selector? example: I have
name_iexact keyword is a parameter we can pass to filter function in django.model. Can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.