Subject | computed by columns |
---|---|
Author | James |
Post date | 2004-06-01T07:25:58Z |
hi guys,
I have try to use the computed by when creating a table and here is what
I discovered. For example if I had a table like this ...
CREATE TABLE INVOICE (
ID D_ID NOT NULL,
INVOICE_NO D_ID,
CUSTOMER_ID D_ID,
INVOICE_DATE D_TRANSACTION_DATE,
TOTAL_AMOUNT D_MONEY,
DISCOUNT_1 D_DISCOUNT_PERCENT,
DISCOUNT_2 D_DISCOUNT_PERCENT,
DISCOUNT_3 D_DISCOUNT_PERCENT,
LESS D_MONEY,
ADJUSTMENT D_MONEY,
GRAND_TOTAL COMPUTED BY (total_amount * (1-(discount_1/100)) *
(1-(discount_2/100)) * (1-(discount_3/100)) - less - adjustment),
SALES_AGENT D_ID,
LOCATION VARCHAR(15) NOT NULL,
REMARKS VARCHAR(240),
STATUS CHAR(3) DEFAULT 'ACT' NOT NULL,
CREATE_BY D_CREATE_BY,
CREATE_ON D_CREATE_ON,
EDIT_BY D_EDIT_BY,
EDIT_ON D_EDIT_ON
);
As you can see the grand_total field has computed by properties. At
first its data type was set at numeric(15,2), but after compiling it
became numeric(18,8) and I think it was cause by the computed by
properties. My question is this normal? or Is this what computed by for
or does it has other uses?
Please guide. Thanks
regards,
james
I have try to use the computed by when creating a table and here is what
I discovered. For example if I had a table like this ...
CREATE TABLE INVOICE (
ID D_ID NOT NULL,
INVOICE_NO D_ID,
CUSTOMER_ID D_ID,
INVOICE_DATE D_TRANSACTION_DATE,
TOTAL_AMOUNT D_MONEY,
DISCOUNT_1 D_DISCOUNT_PERCENT,
DISCOUNT_2 D_DISCOUNT_PERCENT,
DISCOUNT_3 D_DISCOUNT_PERCENT,
LESS D_MONEY,
ADJUSTMENT D_MONEY,
GRAND_TOTAL COMPUTED BY (total_amount * (1-(discount_1/100)) *
(1-(discount_2/100)) * (1-(discount_3/100)) - less - adjustment),
SALES_AGENT D_ID,
LOCATION VARCHAR(15) NOT NULL,
REMARKS VARCHAR(240),
STATUS CHAR(3) DEFAULT 'ACT' NOT NULL,
CREATE_BY D_CREATE_BY,
CREATE_ON D_CREATE_ON,
EDIT_BY D_EDIT_BY,
EDIT_ON D_EDIT_ON
);
As you can see the grand_total field has computed by properties. At
first its data type was set at numeric(15,2), but after compiling it
became numeric(18,8) and I think it was cause by the computed by
properties. My question is this normal? or Is this what computed by for
or does it has other uses?
Please guide. Thanks
regards,
james