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
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: 65150
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.

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
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: Returning Value when i calling insert Query from Java
Next Topic: how to handle this problem
Goto Forum:

Current Time: Mon Aug 21 16:43:12 CDT 2017

Total time taken to generate the page: 0.05952 seconds