Home » Developer & Programmer » Forms » Dynamically call column in Select Statement
Dynamically call column in Select Statement [message #195138] Wed, 27 September 2006 02:52 Go to next message
fahedakhter
Messages: 39
Registered: March 2005
Location: Pakistan
Member

I have 3 columns in table like "PRO_LOC,WVG_LOC,STH_LOC".I want to select my dsired column on condition

:Global.V_Menu kept following values ('PRO','WVG','STH').

I have made this query and its work fine but it is hardcoded "PRO,WVG,STH").
SELECT DECODE(:Global.V_Menu, 'PRO', Pro_Loc, 'WVG', Wvg_Loc, 'STH', Sth_Loc)
FROM My_Table;

I Want my query like this.
SELECT :Global.V_Menu||'.Loc'
FROM My_Table;

Does it possible or not.

Reagrs'd
Fahed
Re: Dynamically call column in Select Statement [message #195145 is a reply to message #195138] Wed, 27 September 2006 03:38 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

I also do decode because lexical is not applicable.
Re: Dynamically call column in Select Statement [message #195350 is a reply to message #195145] Thu, 28 September 2006 02:41 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Pass the ':Global.V_Menu' into a procedure, use 'dbms_sql' to build and then execute your code, and base your block on this procedure.

David
Previous Topic: How to assign 2 record groups to single LOV in forms
Next Topic: Doubt in form
Goto Forum:
  


Current Time: Mon Dec 05 12:49:23 CST 2016

Total time taken to generate the page: 0.06797 seconds