SQL query to Oracle - Only getting integer part of numeric columns

조회 수: 9 (최근 30일)
Niclas Engberg
Niclas Engberg 2014년 7월 25일
댓글: Geoff Hayes 2014년 7월 28일
I have just bought the database toolbox so I am not very familiar with this. I want to retrieve data from an Oracle database. Each row in my dataset contains both string columns and numeric columns. I have set the DataReturnFormat to 'table'.
The columns that contain strings look fine in my result table but the numeric columns only have the integer part, i.e. 101.37 becomes 101, 0.0425 becomes 0 etc.
Running the same query in AQT gives me the correct data. (That is the way I used to do it - either AQT and export to excel and xlsread from Matlab or running the query in VBA + xlsread)
There is probably a simple change in settings that fixes this but right now this eludes me.
Regards,
Niclas
  댓글 수: 6
Niclas Engberg
Niclas Engberg 2014년 7월 28일
Issue solved. It seems the database uses decimal komma "," while Matlab only recognizes decimal point ".". Using to_char(xxx,'9990.99999'), where xxx is whatever numeric column I want, did the trick. Or at least I get strings that can be converted to the correct numerical values.
Geoff Hayes
Geoff Hayes 2014년 7월 28일
Awesome that you figured it out!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by