Ask Your Question
0

Split Base DB. Field is Decimal. Decimal places was 2, now it's 0??? How to fix it!!!

asked 2019-10-07 00:41:06 +0200

MQ-818 gravatar image

updated 2019-10-07 01:34:16 +0200

Hi, For several years I am using Split DB. I am building a new DB, also Split. As I created the table, I set the field Interest_Rate to be Decimal with Decimal Places to 2. Now that I am inputting info/data.....I just noticed the Decimal places set to 0?

1) How did it get change? 2) How to set "Decimal places" to 2 or 3?

Here is Libreoffice Base Version >>> Version: 6.2.7.1 (x64) Build ID: 23edc44b61b830b7d749943e020e96f5a7df63bf CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; Locale: en-US (en_US); UI-Language: en-US

Thanks in advance for you help!!!

edit retag flag offensive close merge delete

Comments

Hello,

What database version are you using? What type field are you using? Where is the decimal places = 0 - Table view, form control (and type control)?

Ratslinger gravatar imageRatslinger ( 2019-10-07 01:18:41 +0200 )edit

1) DataBase Version: Version: 6.2.7.1 (x64) Build ID: 23edc44b61b830b7d749943e020e96f5a7df63bf CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; Locale: en-US (en_US); UI-Language: en-US

2) Field Type >>>> Original Was: Decimal / Decimal Places = 2 . NOW Decimal Places=0.

MQ-818 gravatar imageMQ-818 ( 2019-10-07 01:27:27 +0200 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2019-10-07 01:36:55 +0200

MQ-818 gravatar image

updated 2019-10-07 01:38:17 +0200

Looks like I can use SQL command One field at a time. But if you have a better approach, please share it. Thanks!

ALTER TABLE "tst_tbl" ALTER COLUMN "fld" decimal(16,3)

Don’t forget to refresh the table

I got 27 Fields to deal with; some with info others are blank!

edit flag offensive delete link more
0

answered 2019-10-07 01:49:51 +0200

Ratslinger gravatar image

Hello,

Just tested with HSQLDB v2.3.2 and had no such problem. You did not give the DB version as a split DB can use whatever version is installed.

With a split DB (HSQLDB type widely used) you cannot modify already saved fields. So if incorrectly created & saved (most likely cause of your problem) then you have two choices:

  • Use SQL as you state

  • Use GUI by first deleting the problem field, save the table, then enter correct definition.

When creating tables, I typically go back through my fields to insure correct settings before saving. Have done this using various DB's as there have been different occasions where say an auto increment did not take the first time.

Measure twice - cut once.

edit flag offensive delete link more

Comments

It may also help if you can duplicate the problem and list the steps taken. As stated cannot duplicate and tried both Decimal and Numeric fields.

Ratslinger gravatar imageRatslinger ( 2019-10-07 01:55:00 +0200 )edit

I think this is where I went wrong!!!

1) I added new fields on an existing table (Not a problem)

2) My last few number fields on that table were set to 0 decimal (This is the problem)

3) So, any fields that were added after the last one, if defaulted to 0 decimal after I saved the table. I think so, can't confirm as its too late now...!

I am going to Just delete the newly added fields and rework the table to make my life easier. As new fields are just in test face; no important data in them as of now!!!

MQ-818 gravatar imageMQ-818 ( 2019-10-07 02:11:42 +0200 )edit

You must set the number of decimals for each new field entered. If you copy/paste a field, the number of decimals from the copied field will be retained in the pasted field.

Ratslinger gravatar imageRatslinger ( 2019-10-07 02:18:15 +0200 )edit

Got it Thanks for your help!

MQ-818 gravatar imageMQ-818 ( 2019-10-07 02:26:11 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-10-07 00:41:06 +0200

Seen: 60 times

Last updated: Oct 07 '19