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

  • Home
  • SEARCH
  • 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 398771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:46:52+00:00 2026-05-12T16:46:52+00:00

I see the following code fragment in a legacy application that accesses Informix through

  • 0

I see the following code fragment in a legacy application that accesses Informix through C. Can anyone explain what the SQL in the code is trying to achieve? Thanks.

EXEC SQL BEGIN DECLARE SECTION;
int i_tableref;
EXEC SQL END DECLARE SECTION;

    /* Some code here */

if (!i_sel_ref)
{
    exec sql begin declare section;
    const char *sql1 = 
        "select refer_num.nextval from table ( SET{''} )";
    exec sql end declare section;
    exec sql prepare oref_sel_fid from :sql1;
    if ( sqlca.sqlcode != SQL_OK )
    {
         /* some code */
    }
    /* More code */
}
  • 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-05-12T16:46:53+00:00Added an answer on May 12, 2026 at 4:46 pm

    I believe it is obtaining the next value from a database sequence called refer_num. Sequences are a way of generating values for numeric unique identifiers – a bit like IDENTITY columns in some DBMSs. I don’t know Informix, but my guess is that “table ( SET{”} )” is a way of generating a pseudo-table with 1 row so that you can perform a select statement that doesn’t actually need to access any real database table. Oracle has a special table called DUAL for this purpose, and this would be a common sight in Oracle:

    select refer_num.nextval from dual;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(resolved: see bottom) I have the following code snippet: Protected Sub SqlDataSource1_Inserted(ByVal sender As
I see in a header that I didn't write myself the following: class MonitorObjectString:
I see lots of TDD practitioners following this cycle: 1) Write your test as
Consider the following two ways of writing a loop in Java to see if
From time to time I see an enum like the following: [Flags] public enum
Is there a better way than the following to check to see if a
while exploring jQuery I came up with the following weird script. I don't see
(see here for the problem I'm trying to solve) How do you get hibernate
See title. By lightweight markup I mean something like markdown or wikitext.
See title: what does it mean for a C++ function to be inline?

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.