You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two tables orders (1) and order_items (N). If I add computed field to table orders to fetch some data from order_items, then using isql -x to extract DDL script includes this fields in table creation. So using the script to create same structure fails.
Here's the sample of wrong script:
CREATE TABLE ORDERS (ID BIGINT NOT NULL,
...
TOTAL_ORDER_PRICE COMPUTED BY ((select coalesce(sum(total_item_price), 0) from order_items where order_items.id_order = http://orders.id) * ((100 - promo_code_discount) / 100)),
PRIMARY KEY (ID));
CREATE TABLE ORDER_ITEMS (ID BIGINT NOT NULL,
ID_ORDER BIGINT NOT NULL,
ITEM_NAME VARCHAR200 NOT NULL,
NUMBER_OF_ITEMS INTEGER NOT NULL,
PRICE_PER_ITEM MONEY NOT NULL,
DISCOUNT DISCOUNT NOT NULL,
PRICE_PER_ITEM_WITH_DISCOUNT COMPUTED BY (price_per_item * ((100 - discount) / 100)),
TOTAL_ITEM_PRICE COMPUTED BY (price_per_item_with_discount * number_of_items),
PRIMARY KEY (ID));
The text was updated successfully, but these errors were encountered:
Submitted by: @cincuranet
Votes: 2
I have two tables orders (1) and order_items (N). If I add computed field to table orders to fetch some data from order_items, then using isql -x to extract DDL script includes this fields in table creation. So using the script to create same structure fails.
Here's the sample of wrong script:
CREATE TABLE ORDERS (ID BIGINT NOT NULL,
...
TOTAL_ORDER_PRICE COMPUTED BY ((select coalesce(sum(total_item_price), 0) from order_items where order_items.id_order = http://orders.id) * ((100 - promo_code_discount) / 100)),
PRIMARY KEY (ID));
CREATE TABLE ORDER_ITEMS (ID BIGINT NOT NULL,
ID_ORDER BIGINT NOT NULL,
ITEM_NAME VARCHAR200 NOT NULL,
NUMBER_OF_ITEMS INTEGER NOT NULL,
PRICE_PER_ITEM MONEY NOT NULL,
DISCOUNT DISCOUNT NOT NULL,
PRICE_PER_ITEM_WITH_DISCOUNT COMPUTED BY (price_per_item * ((100 - discount) / 100)),
TOTAL_ITEM_PRICE COMPUTED BY (price_per_item_with_discount * number_of_items),
PRIMARY KEY (ID));
The text was updated successfully, but these errors were encountered: