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 9315679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:25:47+00:00 2026-06-19T02:25:47+00:00

I need to create an Informix procedure to return a table with rows if

  • 0

I need to create an Informix procedure to return a table with rows if I found some value and an empty table if no value found.

I know how to return a table with rows, but I don’t know how to return the empty table; can anyone help?

CREATE row type AType (
  id VARCHAR(255),
  name VARCHAR(255)
);


CREATE PROCEDURE getmeasurement (p_date DATETIME YEAR TO SECOND)
RETURNING MULTISET(AType NOT NULL);

    DEFINE AType_TABLE MULTISET (AType NOT NULL);
    DEFINE v_id VARCHAR(255);
    DEFINE v_name VARCHAR(255);
    ....
    IF( FoundValue ) THEN
        -- INSERT INTO TABLE
        INSERT INTO TABLE (AType_TABLE) VALUES (ROW(v_id,v_name)::AType);     
    ELSE
        // how to initial a AType_TABLE instance with empty records.
    END IF
    ....
    RETURN AType_TABLE;

END PROCEDURE;
  • 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-19T02:25:48+00:00Added an answer on June 19, 2026 at 2:25 am

    Despite what it says in the SQL Syntax Manual, SPL (Stored Procedure Language) procedures can return collection types (COLLECT, SET, MULTISET or LIST). I’ve reported a documentation bug against that — which misled me earlier this week.

    I’m not able to get this procedure to compile under Informix 11.70.FC6 on Mac OS X 10.7.5, but the error it comes up with is:

    SQL -9905: [Internal] No extended type information for domain.
    

    I’ve run into various issues trying various variants of the above code. You can’t have a WHERE clause on a DELETE from a multiset, it seems (different error message). You can also run into problems if you rollback the creation of the type and then try again.

    However, I was able to test it with a pre-release of 11.70.FC8 on Linux (RHEL 5, x86/64) and got the desired output:

    CREATE ROW TYPE IF NOT EXISTS AType
    (
        id   VARCHAR(255),
        name VARCHAR(255)
    );
    
    CREATE PROCEDURE getmeasurement (p_date DATETIME YEAR TO SECOND)
            RETURNING MULTISET(AType NOT NULL);
    
        DEFINE AType_TABLE MULTISET(AType NOT NULL);
        DEFINE v_id VARCHAR(255);
        DEFINE v_name VARCHAR(255);
    
        LET v_id = "Polynomial - " || p_date;
        LET v_name = "Euclid's Geometry of the Plane";
        INSERT INTO TABLE (AType_TABLE) VALUES(ROW(v_id, v_name)::AType);
        IF 1 = 1 THEN
            -- how TO initial a AType_TABLE instance WITH empty records.
            DELETE FROM TABLE(AType_TABLE);
        END IF
    
        RETURN AType_TABLE;
    
    END PROCEDURE;
    
    EXECUTE PROCEDURE getmeasurement(CURRENT);
    
    ROLLBACK;
    

    The output was:

    MULTISET{}
    

    which is an empty multiset. If you don’t insert something into the multiset first, the delete fails. This is a trifle odd.

    Summary

    You may be OK with Informix 11.70.xC7; it may work on some other versions too. But there are likely to be a lot of versions of Informix where it does not work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need create clone repository. but I do not know where can I get
Need to create some table so I can get an info from it in
I need create a user only to create others users, but, i don't know
I need create custom tabbar with super class UITabBarController. But i don,t know how
I need create WebView which can load a page from Youtube. I don't want
I need create a document word with Java. And I ask, how can I
I use MS SQL 2008 R2, I need create a Table with a CHECK
I need create a table to store Black listed IP address in case of
I need to create a <div> of height 200px that has some text at
i need create JavaFx TableView with multicolor rows (color1 for low priority, color2 for

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.