|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Help needed - driving me nuts
i have a database made in oracle. I need to make a query that will take the price of a book, and the ISBN of a book. Find out how many of the same ISBN is in the database and calculates the price.
The only thing is that when i run my query.....it takes all the the ISBNs in the database, no matter if the ISBN is specified, it just takes the lot. Could someone have a lok at this query and see if there is anything obviously wrong. Thanks in advance Cokes Quote:
|
|
#2
|
|||
|
|||
|
Don't make your function's argument name identical to your table column name, make the following changes:
CREATE OR REPLACE FUNCTION calculate_total_revenue (P_ISBN IN book.ISBN%TYPE, P_PRICE IN book.PRICE%TYPE) RETURN number IS total_revenue number; number_of_sales number; BEGIN SELECT count(ISBN) INTO number_of_sales FROM purchases WHERE purchases.ISBN = P_ISBN; total_revenue:= (P_PRICE * number_of_sales); return (total_revenue); END; |
|
#3
|
|||
|
|||
|
Thanks a lot buddy.......i'm useless with all this oracle stuff. Just another thing i gotta do for uni.
Thank you ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Help needed - driving me nuts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|