Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> Using outer query column alias in sub-query in the SELECT clause?, Using outer query column alias in sub-query in the SELECT clause?
natarajg
post Dec 24 2008, 05:03 AM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 24-December 08
Member No.: 39,242



Hello All,

Would be of great help to me if you could reply to this post.

Is there a way we could refer column alias in the outer query with in the sub-query in the SELECT clause.

Eg.,

SELECT
ALARM_KEY as "KEY",(select KEY_DESC from DESC where alarm_key = KEY )
FROM
ALARMS

MySql is supporting this. How about Oracle or any work-arounds for this?
Go to the top of the page
 
+Quote Post
burleson
post Dec 24 2008, 07:06 AM
Post #2


Advanced Member
***

Group: Members
Posts: 11,706
Joined: 26-January 04
Member No.: 13



>> Is there a way we could refer column alias in the outer query with in the sub-query in the SELECT clause.

I've asked a SQL guru to pop-in and address this. . .

BTW, can't you re-write this as a standard join?

CODE
SELECT
   ALARM_KEY,
   KEY_DESC
FROM
   ALARMS,
   DESC
WHERE
   alarms.ALARM_KEY = desc.KEY_DESC


If you want to learn advanced Oracle SQL, get the book "Advanced Oracle SQL Programming":

http://www.rampant-books.com/book_2008_2_a...programming.htm


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
Laurent Schneide...
post Dec 24 2008, 03:19 PM
Post #3


Advanced Member
***

Group: Members
Posts: 243
Joined: 24-June 07
From: Switzerland
Member No.: 9,590



no, you cannot, well, you could use subquery

CODE
SELECT
  KEY,
  (select KEY_DESC from "DESC" where alarm_key = KEY )
FROM
(
  SELECT
    ALARM_KEY as "KEY"
  FROM
    ALARMS
)



--------------------
Go to the top of the page
 
+Quote Post
natarajg
post Dec 26 2008, 02:36 AM
Post #4


Newbie
*

Group: Members
Posts: 2
Joined: 24-December 08
Member No.: 39,242



Thank you so much for all your efforts in giving out a solution at the earliest.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd November 2014 - 03:52 PM