[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Informix - sqlca.sqlerrd1 variable?

Posted on 1997-08-01
1
Medium Priority
?
1,481 Views
Last Modified: 2008-07-03
The following SQL is working as expected;

INSERT INTO TABLE(COLUMN1) VALUES (VALUE1);

This INSERT is inserting a column, COLUMN1, and a serialized column,
COLUMN2, not shown. COLUMN2 gets incremented automatically.

SELECT SERIALIZEDCOLUMN FROM TABLE WHERE SERIALIZEDCOLUMN =
DBINFO('sqlca.sqlerrd1');

This SELECT statement returns the thread specific SERIALIZEDCOLUMN that was
just inserted.  Everything is working as I would expect.

QUESTION?

Is there any other way to get the sqlca.sqlerrd1 variable, without issuing
a SQL statement.  A "C" routine would be nice, or any other method.

The problem is I want to read this value directly without issuing a second
SQL statement.

I am using VB5 as the VCL.

Any help would be greatly appreciated.

Carl

0
Comment
Question by:cfulton
1 Comment
 
LVL 9

Accepted Solution

by:
cymbolic earned 150 total points
ID: 1025201
I don't think there is another way.  You have to read it from the database, because it doesn't exist until the row is added to the table.  It's not in your resultset in memory to be accessed. It get's generated from internal system tables by your server when the row is written. For some additional insight into what your access method sees and is doing, set logging/trace on in your ODBC Connection  using your ODBC connection  Manager, then review the details of what's actually transpiring when you do one of these inserts.  I don't think you'll see the serialized number ever coming back to your VB app.

Also, you can't even "read ahead" and guess that the next number will be one higher than the current maximum number, because that doesn't work in a multiusr environment.

If you're really desparate, don't use an autonumber field.  Set up your own control table to control and select new numbers, or use a very large random random generated floating point number to serialize.  That way you are in control, since you hand out the numbers, not your server.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, we’ll look at how to deploy ProxySQL.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question