Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (Oracle)
 Oracle 8.1.5.00 ODBC/integer problem
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

gor
Retired Admin

Netherlands
5511 Posts

Posted - 07 March 2001 :  17:31:00  Show Profile  Visit gor's Homepage
Ok, first this: I do have to use ODBC for this, so no option doing this using OO4O (Oracle Objects for OLE)

When I store integers in INTEGER fields in the Oracle and retrieve them using ODBC and a Recordset they always display as being 0
If I store them as CHAR(5) however they display ok, I even didn't have to convert them to string first.

Is this the only option I've got, or are there other ways to store them as INTEGER and retrieve them using ODBC ?

Pierre<

gor
Retired Admin

Netherlands
5511 Posts

Posted - 09 March 2001 :  13:34:53  Show Profile  Visit gor's Homepage
I changed the datatype to VARCHAR() but still don't know why I can't just use INTEGER

Pierre<
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 09 March 2001 :  14:15:18  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
You can't do a direct display of integer values because they are signed fields. You need to convert them to displayable fields (probably to character would be safest)

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 09 March 2001 :  14:48:41  Show Profile  Visit gor's Homepage
I used character because that is easiest when used in combination with the other databases.

What on earth are signed fields ?

Pierre<
Go to Top of Page

THWR
Starting Member

9 Posts

Posted - 13 March 2001 :  05:00:40  Show Profile
this sounds a bit crazy, but -at least i needed to do this for my projects- you need to convert numerics to varchar2.

to_char(user.table.field) is the function for this

often you will also hae problems with the ODBC driver. the one from microsoft returns wrong field types (eg. nvarchar as varchar2, integer as varchar(1) etc). i dont know if this is fixed in the us version, but with the german driver u can forget using ODBC drivers. i use the COM Objects from oracle itself to connect:

at global.asa:

<OBJECT RUNAT=Server SCOPE=Application ID=OraSession PROGID="OracleInProcServer.XOraSession"></OBJECT>


and in the scripts

Set OraDatabase = OraSession.OpenDatabase("TNSListener","user/password",0)


for example. this works. or.. mhh... it works better that the ODBC driver

<
Go to Top of Page

THWR
Starting Member

9 Posts

Posted - 13 March 2001 :  05:03:40  Show Profile
singed fields? these are numerics (dunno the english word for it) with a minus or plus sign. negative OR positive values with another range than unsigned fields.

singed int means values from -16535 to +16535, unsigned is from 0 to about 30000 (not exactly

<
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 13 March 2001 :  08:02:28  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
quote:

What on earth are signed fields ?



Signed fields are integers with positive or negative possible values. The reason they can't be directly displayed is because they are stored in packed fields not straight storage like a character field. You'll probably want to convert the fields to character before trying to display...

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 13 March 2001 :  08:19:55  Show Profile  Visit gor's Homepage
quote:

Signed fields are integers with positive or negative possible values. The reason they can't be directly displayed is because they are stored in packed fields not straight storage like a character field. You'll probably want to convert the fields to character before trying to display...



Ah, ok, well then it is just a matter of preference then I guess.
At the moment I store them as characters and convert them to numeric when needed (i.e. when comparing the replycount with the hottopiccount) and otherwise I would store them as integers and convert them each time I display them.
I think the first option takes less converting, and since that converting is unneeded for all the other databases, I think I'll stick with storing as character.


Thanks guys for the extra info !

Pierre<
Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 13 March 2001 :  13:20:46  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
ok... do we want to consider converting all of our non-ID numeric fields to Text fields? And handle the logic in the forum code?

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
<
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 13 March 2001 :  13:42:17  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
Either that (though, off the top of my head, I can't think of that many fields that would affect (ICQ, age,...) or I believe there IS a datatype in Oracle which doesn't require a sign, so it might not be packed.....

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 13 March 2001 :  18:55:36  Show Profile  Visit gor's Homepage
Don't think we need to change anything for the other databases...the number of conversions doesn't decrease if you change the datatype for the others...it just is going to increase a bit because I'm going to have to add a few for Oracle to work ok.

Pierre<
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07