Solved

Oracle sequence number ODBC problem

Posted on 2002-05-16
4
490 Views
Last Modified: 2008-03-10
I'm trying to get the next sequence number from an Oracle sequence with:

SELECT WRV.WRV_SEQ_ADRESSEN.NEXTVAL FROM DUAL

This works fine with the Oracle ODBC drivers from Oracle, but not with those from microsoft. Miscrosoft gives an "value out of range" error (error 22003) for sequences with high numbers.

I checked the ODBC trace for both drivers and it appears that the Microsft versions see the NEXTVAL column as a SQL_C_SHORT (5 positions) where Oracle sees it as a SQL_C_DOUBLE (8 positions).

Unofrtunately the target machine has only Microsoft ODBC drivers so I'm stuck with those.

How do I tell the Microsoft ODBC driver for Oracle to use a larger datatayp for the NEXTVAL column?

How can I instruct
0
Comment
Question by:patrickl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 200 total points
ID: 7013390
You can cast the value to varchar datatype:

SELECT to_char(WRV.WRV_SEQ_ADRESSEN.NEXTVAL) FROM DUAL

CHeers
0
 
LVL 5

Author Comment

by:patrickl
ID: 7013397
Cool, that works! I was trying something like that, but no luck. Great!

Do you have an idea why this goes wrong at all?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7013399
the ODBC drivers have different data type representations, and while the ORACLE driver knows the data types, the one of MS does some kind of approximation :-(
Glad I could help.
CHeers
0
 
LVL 5

Author Comment

by:patrickl
ID: 7013413
I guess ODBC is just a minefield. I always keep running into trouble with it. The oracle drivers never seem to install and the Microsoft ones don't always work.

But anyway, many thanks.

Just to be complete. I change the query to:

SELECT to_char(WRV.WRV_SEQ_ADRESSEN.NEXTVAL) AS NEXTVAL FROM DUAL

To make it equivalent to the one I had before. Works like a charm.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 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