473,513 Members | 3,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting number fields back from Oracle

I am being driven absolutely mad. As part of a generic data access library
that was originally written on top of Oracle's OCI and Pro-C libraries but
that I am now porting to ADO.NET I am trying to write some generic code to
process a DataReader. I am using the GetValues() call to return an array of
Object^ refs that I am then trying to process with a bunch of templated code.
I originally attempted to read back some Oracle Number fields into Int32
variables allocated from the managed heap, but got back a message telling me
that a System.Decimal could not be cast to an Int32. Fair enough; that's
when I realized that Oracle Numbers are first brought back to the client as
Decimal types. Unfortunately, however, the Decimal type does not have a copy
constructor, so that broke a number of places in my generic code. I have
since been trying to do explicit conversions with specialized template
functors, but am being thwarted at every turn. I am now trying to get these
Decimals into OracleNumber objects, because at least these can be copy
constructed and will play nicely with code I already have in place. I was
hoping the following would work:

template<> struct ABIMConversion<OracleNumber^>
{
OracleNumber^ operator()(Object^ h) { return (OracleNumber^)h ; }
};

This compiles fine, but unfortunately at run time I get the error:bUnable to
cast object of type System.Decimal to type
System.Data.OracleClient.OracleNumber. Okay. Then I tried to a construct an
Oracle Number with the constructor that takes a Decimal parameter:

template<> struct ABIMConversion<OracleNumber^>
{
OracleNumber^ operator()(Decimal^ h) { return gcnew OracleNumber(h) ; }
};

This refuses to compile with a (to me, seemingly bizzare) message:

Error 1 error C2664:
'System::Data::OracleClient::OracleNumber::OracleN umber(bool)' : cannot
convert parameter 1 from 'System::Decimal ^' to
'bool' c:\abimdataaccesslibrary\DataBinding.h 1529

THere isn't even documented an OracleNumber constructor that takes a bool,
so I really don't understand what's going on. But I'm giving a presentation
on C++/CLI in a day or two and would really love to have this worked out.
Can anyone explain this to me and suggest a workaround?

Much obliged!

Nov 17 '05 #1
0 956

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6932
by: Binu jose | last post by:
hi all i am writing a CMP ,with oracle 9i as database and blazix as ejb server. i mapped my number fields in oracle db to java.math,BigDecimal, it compiles ok , when i call create with java.math.BigNumber arguement , error comes saying javax.ejb.FinderException: java.rmi.RemoteException: SQL Error:
303
17422
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which...
0
9823
by: Sven Mayer | last post by:
Assume a database (e.g. Oracle) field is declared as a) NUMBER (length=10) b) NUMBER (length=26) c) VARCHAR2 (length=1) d) VARCHAR2 (length=50) e) DATE How do I retrieve the contents from these resultset fields and put it into a (numeric) java resp Date field? For other field types it is already clear e.g.):
9
2814
by: kangaroo | last post by:
Hi guys, when we run a stored proc and it results into an unhandled error, the error message returned by db2 udb does not contain a line number that caused an error. This makes it pretty difficult to debug those procs. Line number have always been there in Oracle messages. When I Googled on this, I saw some people showing DB2 Stored Proc...
10
19731
by: CJM | last post by:
I'm trying to call a package/procedure in oracle (from an ASP page) which requires a number of parameters. I have got this working using OO40 but unfortunately the transaction rollback function doesnt seem to do much. So I'm now trying to use ADO instead (in the hope that ADO transactions will work), however I'm getting the above error. My...
22
6605
by: Sri | last post by:
All Recenetly our shop migrated to DB2 V8 from V7. We are in IBM System Level: z/OS 1.6.1 @ RSU 0702. Processor : IBM 2064-1C7 (z/900) # 1B89 Mode: 64-bit One of my application is facing problem while testing their code/Jobs in DB2 V8 environments. The Details are: Job is abending with SQLCODE -302 SQL error on the prepare staement....
1
1805
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I can successfully insert and update the oracle database by calling a oracles stored proc from my .net code. This oracle stored proc is returning some value. I cannot see that value in my .net code Below is my .net code OracleParameter mbrid = new OracleParameter("RET_MBRID", OracleType.Number); mbrid.Direction =...
2
3549
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in uby/Rails. I started it in Perl and gave up on Perl as I went from the 'display the database information on the web page' to the 're-display the information...
12
5557
by: magmike | last post by:
Accidentally deleted a record. Anyway to get it back? If not, I know the ID number - which is an autonumber field. Because of the related data from other tables, would I be able to create a new record and make its ID number, that of the deleted record? Thanks! magmike
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.