How to solve ERROR MISSING RIGHT PARENTHESIS ? (ORACLE) [closed]
Apart from the fact that syntax you "invented" doesn't even exist, you're trying to create virtual columns (service_charge
and transaction_amount
) that reference columns from another table(s), most probably product
. Well, you can't.
Looks like you'd rather create a view.
Something like this (you didn't post how tables are related to each other so I'm just guessing):
CREATE TABLE bill
(
transaction_id VARCHAR2 (10) PRIMARY KEY,
date_bill DATE,
transaction_type VARCHAR2 (45),
order_id VARCHAR2 (45) REFERENCES orders (order_id),
cust_id VARCHAR2 (45)
);
CREATE OR REPLACE VIEW v_bill_product
AS
SELECT b.transaction_id,
b.date_bill,
b.transaction_type,
b.order_id,
b.cust_id,
--
0.1 * p.product_price * p.product_quantity AS service_charge,
1.1 * p.product_price * product_quantity AS transaction_amount
FROM bill b JOIN product p ON b.transaction_id = p.transaction_id;