We help IT Professionals succeed at work.
Get Started
Troubleshooting Question

What internal value did Oracle Database store?

deleyd
deleyd asked
on
45 Views
Last Modified: 2021-03-28
I have an Oracle database. A column "mycolumn" is defined as 'Number' format. I run Oracle SQL Developer (version 4.1.4.21), run a SQL statement to insert some data:

INSERT INTO mytable (mycolumn) VALUES (8.321)

Still using Oracle SQL Developer, I look at the result in the table, and it shows the value "8.321" in the cell. So far so good.

Then I write a C# program to retrieve the value of that cell:
OracleCommand cmd = new OracleCommand();
cmd.Connection = OConnection;
cmd.CommandText = "SELECT * FROM mytable";
OracleDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
    int x = rdr.GetOrdinal("MYCOLUMN");
    Decimal y = rdr.GetDecimal(x);
}
This works and I retrieve the value in y, which is "8.3210"

My question is, where did the trailing zero come from? Why is Decimal y not "8.321"? Why is there a trailing zero in the result?
Comment
Watch Question
Software Engineer
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE