Home » SQL & PL/SQL » SQL & PL/SQL » view needed on the derived column
view needed on the derived column [message #321083] Mon, 19 May 2008 00:41 Go to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
Table Name : chk_SER

Tdate		varchar2(16)
Ser_type	varchar2(2)
ser_desc1	varchar2(30)
ser_amount	number(14,2)

I want the view as

tdate		varchar2(16)
cash		number(14,2)
cheque		number(14,2)


using the following querry

select tdate,decode(ser_desc1,'CASH',ser_amount,null) "cash",
decode(ser_desc1,'CHEQUE',ser_amount,null) "Cheque"
from chk_ser where ser_type='RV' order by tdate

is it possible




Re: view needed on the derived column [message #321086 is a reply to message #321083] Mon, 19 May 2008 00:54 Go to previous messageGo to next message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Create view ... as <your query>.
Note that "order by" although it is possible, is meaningless/irrelevant in relational theory.

Regards
Michel
Re: view needed on the derived column [message #321172 is a reply to message #321086] Mon, 19 May 2008 05:53 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'd say it's worse than useless actually. It will order the results, and they can still come out in a different order if you join to the table, so it'll just slow things down.
Previous Topic: FORALL gets executed twice
Next Topic: group by (merged)
Goto Forum:
  


Current Time: Wed Dec 07 05:13:28 CST 2016

Total time taken to generate the page: 0.15269 seconds