Home » SQL & PL/SQL » SQL & PL/SQL » can we able to create a view with conditional statement
can we able to create a view with conditional statement [message #317851] Sun, 04 May 2008 04:44 Go to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
hi,


table name Product_master

structure

id                   number
date_of_purchase     date
product_code         varchar2(10)
quantity             number(10,2)
rate_per_unit        number(10,2)

data's are as follows

01-jan-08    C001     100     10.00
02-jan-08    C001     -10     10.00
03-jan-08    C001     100     11.00


I want to create a view

Product_code      varchar2(10)
quantity          number(10,2)
unit_per_rate     number(10,2)

Based on the above data
my view should contain the following data

C001        190.00     10.51

ie  100 x 10 = 1000
    -10 x 10 =  -100
    100 x 11 = 1100
= 1100 / 190

is it possible to create a view based on the derived column






Re: can we able to create a view with conditional statement [message #317855 is a reply to message #317851] Sun, 04 May 2008 05:15 Go to previous message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, a view is just a name on a query.
If you are able to create the query, then you are able to create the view.

Regards
Michel
Previous Topic: trigger for restricting insertion into table through the SQL*plus
Next Topic: Bulk collect : impact in performance
Goto Forum:
  


Current Time: Fri Dec 02 20:48:36 CST 2016

Total time taken to generate the page: 0.11530 seconds