Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old April 21st, 2004, 10:27 AM
claire@@ claire@@ is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 15 claire@@ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question multiplying values in oracle

How can I write into my sql script ORDERTOTAL is equal to wineorder.quantity * winelist.winename WHERE winelist. winename=wineinvoice.winename


CREATE TABLE "WINEINVOICE"
( "INVOICENO" NUMBER,
"ORDERID" NUMBER NOT NULL ENABLE,
"INVOICEDATE" DATE,
"CUSTOMERNAME" VARCHAR2(50) NOT NULL ENABLE,
"WINENAME" VARCHAR2(50) NOT NULL ENABLE,
"QUANTITY" NUMBER NOT NULL ENABLE,
"ORDERTOTAL" NUMBER,
"PRICE" NUMBER NOT NULL ENABLE,
CONSTRAINT "WINEINVOICE_PK" PRIMARY KEY ("INVOICENO") ENABLE,
CONSTRAINT "INVOICEORDER" FOREIGN KEY ("ORDERID")
REFERENCES "WINEORDER" ("ORDERID") ENABLE
)
/

Reply With Quote
  #2  
Old April 21st, 2004, 10:47 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,620 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 4 Days 3 h 39 m 45 sec
Reputation Power: 259
Usually I use two tables, one for the general data of the invoice ("INVOICENO", "ORDERID", "INVOICEDATE", "CUSTOMERNAME") and another one for the invoice details ("INVOICENO", "WINENAME", "QUANTITY") and I compute totals for each invoice with a view, something like:
select "INVOICENO", "ORDERID", "INVOICEDATE", "CUSTOMERNAME", sum("WINENAME" * "QUANTITY") from "invoice", "invoice details" where invoice.invoiceno = invoice details.invoiceno
group by ...
(this is all pseudo-code).

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > multiplying values in oracle


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway