Select the column by using Session variables
I set a session variable to contain the name of a bound column that is the user. Is it possible to use a session variable to select a column in a database table? If so, how? Does need a statement where clause?Something like that? :
< cfquery name = "rsSelectColumn" datasource = 'Test' >
SELECT column 1, column 2, column 3 is Variable from Session
OF tbl_data
< / cfquery >
Thank you
Dave
I think you want to do this, if the value in the session variable is the actual column name:
SELECT column 1, column 2, #Session Variable # AS Col3
OF tbl_data
in this way, you can call any column stored in the session variable, and it will still be usable from the QUERY as COL3 regardless of which column you used.
If that's what you want to do - it OF as simple as that.
:-)
Sometimes we have to think of things too.
Tags: ColdFusion
Similar Questions
-
Select the column name when the value = something
Is there a way to select the column name when there is a specific value in it?
As follows:
create table (abc123)
COLUMN1 VARCHAR2 (50).
COLUMN2 VARCHAR2 (50).
Column3 varchar2 (50)
);
insert into abc123 values ('yes', 'Yes', 'No');
insert into abc123 values ('no', 'Yes', 'No');
INSERT INTO ABC123 VALUES ('no ',' no', 'No');
insert into abc123 values ('yes', 'Yes', 'Yes');
SELECT CASE WHEN COLUMN1 = 'Yes' THEN - the name of the column would be here somehow?
WHEN COLUMN2 = 'Yes' THEN - the name of the column would be here somehow?
WHERE Column3 = 'Yes' THEN - the name of the column would be here somehow?
Another null
finish as abc123 columnname
final results for the just Column1 would be:
COLUMN1
NULL VALUE
NULL VALUE
COLUMN1
I'm not sure what I use to get the name of column in there
Thank you.
Hello
708631 wrote:
Is there a way to select the column name when there is a specific value in it?
As follows:
create table (abc123)
COLUMN1 VARCHAR2 (50).
COLUMN2 VARCHAR2 (50).
Column3 varchar2 (50)
);
insert into abc123 values ('yes', 'Yes', 'No');
insert into abc123 values ('no', 'Yes', 'No');
INSERT INTO ABC123 VALUES ('no ',' no', 'No');
insert into abc123 values ('yes', 'Yes', 'Yes');
SELECT CASE WHEN COLUMN1 = 'Yes' THEN - the name of the column would be here somehow?
WHEN COLUMN2 = 'Yes' THEN - the name of the column would be here somehow?
WHERE Column3 = 'Yes' THEN - the name of the column would be here somehow?
Another null
finish as abc123 columnname
final results for the just Column1 would be:
COLUMN1
NULL VALUE
NULL VALUE
COLUMN1
I'm not sure what I use to get the name of column in there
Thank you.
Thanks for posting the CREATE TABLE and INSERT for the sample data.
Don't forget to post the exact results you want from these sample data. If the results depend on the parameters you want to pass a run time, then give a few different examples, with the the desired results of each.
You can hardcode the values you want, such as the column names in a query. For example:
SELECT CASE WHEN column1 = 'Yes' THEN 'Column1' END like y1
CASE WHEN column2 = 'Yes' THEN 'Column2' END like y2
CASE WHEN Column3 = 'Yes' THEN 'Column2' END like y3
, a. *-If wanted
Of abc123 one
;
-
Can I use session variables in data model BI publisher SQL query?
Hi Experts,
We apply security at the level of the BI Publisher 11g data.
In OBIEE we do so using session variables, so I wanted to just ask if we can use the same session variables in BI Publisher as well
That is, we can include a where clause in the SQL for the sample data as
Where ORG_ID = @{biServer.variables ['NQ_SESSION.]} {[INV_ORG']}
I would like to know your opinion on this.
PS: We implement security EBS r12 in BI Publisher.
Thank youRead this-> OBIEE 11 g: error: "[nQSError: 23006] the session variable, NQ_SESSION.» LAN_INT, has no definition of value. "When you create a SQL query using the session NQ_SESSION variable. LAN_INT in BI Publisher [ID 1511676.1]
Follow the ER - BUG: 13607750 -NEED TO be able TO SET up a SESSION IN OBIEE VARIABLE AND use it IN BI PUBLISHER
HTH,
SVS -
Hello
I have a report with 4 columns, 'Year', 'Demand amount', 'Amount of the purchase order' and 'invoice amount.
The user want to select "Amount of demand", "The purchase order amount" or "Invoice amount" in the drop down menu from the drop in the Oracle replies
In other words, he wants to see only the year and "amount of demand."
year or "amount in the purchase order.
year or "amount of the invoice.
How can I do? I already search column, select but did not understand. Please tell me in detail.
Thank youHello user.
I advise to use the column picker in the responses.
(1) build your table (or any other point of view) a year and the amount of the claim.
(2) then create a view by using the choice of mode 'column selector.
(3) check the checkbox 'Include the selector' for your column 'amount of demand. "
(4) add the other two columns in the selection pane. Your view should look like the image below:! http://i46.Tinypic.com/2gwyfso.jpg!
5) go to your compound view and add your views 'column selector.
You should now be able to Exchange "Amount of demand", "The purchase order amount" and "Amount of the invoice" using the column Chooser, and your other points of view should replace columns that you select.
I hope this helps and please assign points if you found it useful!
Kind regards
Jason -
How to set a variable to an attribute pageFlowScope on Create Insert without using session variable
Hi Experts ADF,
JDeveloper 12 c.
I have a VO as below:-
SELECT Departments.DEPARTMENT_ID,
Departments.DEPARTMENT_NAME,
Departments.LOCATION_ID,
Departments.MANAGER_ID
DEPARTMENTS of MINISTRIES
WHERE Departments.DEPARTMENT_Name =: bindDeptName
And taskflow as below:-which starts with a default activity as ExecuteWithParams that defines the variable of the VO to the pageFlowScope variable binding.
When the page loads, it now has a button create that is mapped to the CreateInsert operation. Now I have @overridden create the method below. How to pass the pageflowscope variable to the EOImpl.java without using a Variable of Session. If any other approach is there please suggest.
EOImpl.java
@Override protected void create (AttributeList attributeList) {} this.setAttributeInternal (DEPARTMENTNAME, "msg"); -> Msg value here should be replaced by variable scope pageflow. Super.Create (AttributeList); } Thanks in advance
Roy
Roy, do not access a page flow or session scope variable in the model layer.
Instead, you use the createWithParams to pass the variable to the create method via the link layer. An example can be found here http://andrejusb.blogspot.de/2011/02/createwithparams-operation-for-oracle.html
Timo
-
Select the column in a table that is defined in the select previous in the statement
Hello
I want to write a procedure that selects all the data in a table has then records them in the text file. I tested on table hr.countries.
My code is like this:
echo off newpage 0 space 0 pagesize 0 feed head off trimspool check out serveroutput on the value
coil countries.txt
define dtable = COUNTRY;
declare
col_num NUMBER;
no_lig NUMBER;
line VARCHAR2 (100);
Col VARCHAR2 (100);
Start
Select count (COLUMN_ID) in the col_num USER_TAB_COLUMNS WHERE table_name = '& dtable';
Select count (*) in no_lig of & dtable;
because me in 1.row_num
loop
1.col_num j
loop
Select column_name from col FROM USER_TAB_COLUMNS WHERE table_name = '& dtable' and column_id = j;
Select the pass in the row (select col, rownum: nurse of (select col from & dtable)) where rn = i;
IF (j! = col_num) THEN
DBMS_OUTPUT. PUT(Row ||) ', ');
ON THE OTHER
DBMS_OUTPUT. PUT (Row);
END IF;
end loop;
DBMS_OUTPUT. NEW_LINE;
end loop;
end;
/
spool off
I have had no error, but the result is like this:
COUNTRY_ID, COUNTRY_NAME, REGION_ID
COUNTRY_ID, COUNTRY_NAME, REGION_ID
COUNTRY_ID, COUNTRY_NAME, REGION_ID
.. and so on for the whole table.
I want to have results with data not only the names of columns. No idea what is the problem? I thought that select col online would do the thing, but the line is identical to the col variable...
Thank you
Honza
Set serveroutput on;
define dtable = COUNTRY;
declare
col_num NUMBER;
no_lig NUMBER;
line VARCHAR2 (100);
Col VARCHAR2 (100);
Start
Select count (COLUMN_ID) in the col_num USER_TAB_COLUMNS WHERE table_name = '& dtable;
Select count (*) in the no_lig argument of &dtable;
because me in 1.row_num
loop
1.col_num j
loop
Select column_name from col FROM USER_TAB_COLUMNS WHERE table_name = '& dtable' and column_id = j;
run immediately 'select'. Col | "from (select ' |) Col |', rownum: nurse from (select ' |) Col |' of & dtable)) where rn =' | I have
Online;
IF (j! = col_num) THEN
DBMS_OUTPUT. PUT(Row ||) ', ');
ON THE OTHER
DBMS_OUTPUT. PUT (Row);
END IF;
end loop;
DBMS_OUTPUT. NEW_LINE;
end loop;
end;
/
Output
anonymous block filled
AR, Argentina, 2
To, Australia, 3
BEING, Belgium, 1
BR, Brazil, 2
CA, Canada, 2
CH, Switzerland, 1
CN, China, 3
OF (Germany), 1
DK, Denmark, 1
For example, Egypt, 4
FR, France, 1
HE, Israel, 4
IN, India, 3
IT, Italy, 1
JP, Japan, 3
KW, Kuwait, 4
ML, Malaysia, 3
MX, Mexico, 2
NG, Nigeria, 4
NL, Netherlands, 1
SG, Singapore, 3
UK, United Kingdom, 1
WE, United States of America, 2
ZM Zambia, 4
ZW, Zimbabwe, 4
-
You want to sort the columns by using the ROLLUP GROUP.
Want to order the below query using "column of News in descending order and the"Email address"column in ascending order.
Note: Triage should not bring the total value at the top. It's happening now.
{code}
SELECT decode (grouping (NVL (customer, "NA")), 1, 'total', NVL (customer, "NA")) 'Email (ID). "
"Location."
Sum (News) "News."
Sum (website) "Web Site",
OF VW_FX_USERDATA
GROUP BY ROLLUP (((NVL (Client, "NA")), location, 1, 'total', NVL (customer, "NA")))
{code}
Please let me know if you need any details.
Published by: Nana Akkivalli on September 23, 2011 16:04order by decode(decode(grouping(NVL(EMailAddress, 'NA')),1, 'Totals', NVL(EMailAddress, 'NA')), 'Totals',2,1), 3 desc, 1 asc
-
I use this session variable in an application.
< CFSET Session.CPActive = True >
I thought that the variable would be deleted when I close the browser.
When I open a new browser window the Session.CPActive is always set and true! ??
Any comments on that?As promised here is the tech note:
http://www.Adobe.com/cfusion/knowledgebase/index.cfm?id=tn_17915# Use the following code to delete previously existingCFID and CFTOKEN
Cookies:
# Use the following code to set per-session cookies instead of
persistent cookies:For Session Management:
Note: In ColdFusion 5 and earlier versions, if you do not lock shared
scope variables, it caused corrupt the memory of the application blocks
resulting in server instability or crashes. This is no longer the case
with ColdFusion MX or later. However, it may be necessary to use
cflock in some cases to avoid competitive conditions in your application code. -
Regd select the column in the table area
Hello
I have a search page... Have used autocustomization to create... This page will be used to query data from a table and then we must also update two fields of results table and save.
There is a region of results. I've included the multiselect table option that made me select a column as the first column of the table. Also, including a tableaction and a button upate with whom...
I need to write a handler for the update now... but do not understand all the slect column...
Whenever a user clicks on the boxes to select specific records and change the fields and click Update to save, how to write code to check whether the checkbox option has been activated or not?
Please help me as soon as possible...
Kind regards
PreetiHello
Take a Transient attribute tell 'SelectFlag' in view object and to set the Instance of the view and the view attribute
for multipleselection in the table.Now that the update is click on the button:
If (PageContext.GetParameter ("Update")! = null)
{
OAApplicationModule am = pageContext.getApplicationModule (webBean);
OAViewObject vo = (OAViewObject) am.findViewObject ("projVO1");
Line [] row = vo.getAllRowsInRange ();
Loop through lines
for (int i = 0; i)<>
{
Check if checbox is checked or not
If (line.getAttribute("SelectFlag").toString().equals("Y"))//means checbox is checked for this line.
{
write your logic
}
}
}Thank you
Gerard -
It is no longer a row of icons at the bottom right, and asked me to choose a program to use to open files
Hello and welcome to Microsoft Answers. It seems that your computer is infected with malware. The first thing you need to do is re - associate your executable files with applications.
First
Second
Right click on start > search. Type rundll32.exe in the field of the files to be searched. Choose to search for your main drive (usually C). Select the search hidden files and folder advanced features. Click on the search button to start the search. In the results list, find the associated rundll32 file C:\WINDOWS\ServicePackFiles\i386. Right-click on rundll32 to the left of the directory above and choose 'open file location '. The rundll32.exe file should be highlighted when the folder opens. Right-click on the file and choose copy. Then, in the search results list, right-click on rundll32 which corresponds to C\Windows\system32\rundll32.exe and choose "open file location". Again the file should be highlighted. Right-click on the file and choose Remove. Right click again in a free space in the folder and choose Paste. If this does not resolve your problem, you will need to get a windows OS disk and extract the file from there.
Once this problem is solved, you will need to perform several anti-malware analysis. You should start with Malwarebytes. Make sure that you update the parser before the scan.
-
Hello
I am migrating an application from 3 APEX APEX 4.2 on a thing I noticed with the classic reports when I put them in the model 23, it's that the first section break has break notch under the headings of columns for this section of line while the remaining lines properly have it display above the headers on the subsequent sections of group.
When I look at firebug code I saw that all the tables but the first, the break line is included in the last line of the previous table, so I can see how it did not work for the holidays since.I have tow questions.
1. is it really intentional because it seems not terribly elegant and my users to zero immediately above as a perceived bug.
2. is there a reasonable job around always use headers repeat on break? I have multiple reports on the same page in places so switch to interactive reports is not a quick fix for me in this case.
Example of a question can be seen at apex.oracle.com at home
Thank you
Brad
Roadling wrote:
Hello
I am migrating an application from 3 APEX APEX 4.2 on a thing I noticed with the classic reports when I put them in the model 23, it's that the first section break has break notch under the headings of columns for this section of line while the remaining lines properly have it display above the headers on the subsequent sections of group.
1. is it really intentional because it seems not terribly elegant and my users to zero immediately above as a perceived bug.
The Standard report template definition in issue 23 contains
thead
andtbody
elements:Before the column header
Column title template
#COLUMN_HEADER# After the title column
After the lines
#EXTERNAL_LINK##CSV_LINK#This is intentional, the best practice for marking up HTML tables. What is not expected is the problem that arises when this model is used with the break of repeat titles on break formatting option. The repeated headings result table consisting of soup of tags containing several poorly constructed tbody and thead, which is not valid elements.
2. is there a reasonable job around always use headers repeat on break? I have multiple reports on the same page in places so switch to interactive reports is not a quick fix for me in this case.
Create a copy of the report model Standard in Standard (break formatting) for use with reports of the break, remove the
thead
andtbody
definitions of template tags and the breakdown of the reports to use the new model of change. (Or, if you use mainly break reports using the Standard template, keep the tags in the copy and remove them from the original in order to minimize the number of reports, you need to change.)Personally, I would create a report model of line custom to break complex reports in order to be able to have complete control over the structure and presentation.
-
Business rule - unable to name the text data using substitution variables
Hello
I can't assign a value of text stored in a variable substitution. I read the posts that you can't assign string values I just want to check if it was possible using substitution variables.
For example.,.
Trouble (scenario, Version and year)
"Test year".
(
"Test year" = &;
);
EndFix
& those is a substitution variable whose value is "FY13.
Please advice.
Thanks, CzThe same rules apply, you must apply a numerical value, because this is what is stored in essbase data compared to the intersection.
See you soon
John
http://John-Goodwin.blogspot.com/ -
Select the columns not in the group by clause
Hello
My version of DB is 10.0.2
I have query, where in I need to select two columns more but that should not be part of the group by Clause.
Does perform a work around?
SELECT F.custnum, V.Import_date, -- F.ErledigtMM,F.ErledigtGrundMM, (Columns to be selected additionally) nvl(sum(nvl(round(V.VerAuf16/1000,2), 0) +nvl(round(V.VerAuf17/1000,2), 0) + nvl(round(V.VerAuf18/1000,2), 0) + nvl(round(V.VerAuf19/1000,2), 0) + nvl(round(V.VerAuf20/1000,2), 0) + nvl(round(V.VerAufKAPUn/1000,2), 0) + nvl(round(V.VerAufKAPVz/1000,2), 0) ), 0) Mandantenforderung, nvl(sum(nvl(round(V.VerAuf4/1000,2), 0) ), 0) Inkassokosten, nvl(sum(nvl(round(V.VerAuf5/1000,2), 0) ), 0) KontoFuehrungsgebuehren, nvl(sum(nvl(round(V.VerAuf1/1000,2), 0) + nvl(round(V.VerAuf2/1000,2), 0) ), 0) Verwertungskosten, nvl(sum(nvl(round(V.VerAuf10/1000,2), 0) + nvl(round(V.VerAuf8/1000,2), 0) + nvl(round(V.VerAuf9/1000,2), 0) ), 0) Barauslagen, nvl(sum(nvl(round(V.VerAuf13/1000,2), 0) + nvl(round(V.VerAuf14/1000,2), 0) + nvl(round(V.VerAuf15/1000,2), 0) + nvl(round(V.VerAuf6/1000,2), 0) ),0) Gerichtskosten, nvl(sum(nvl(round(V.VerAuf11/1000,2), 0) + nvl(round(V.VerAuf12/1000,2), 0) + nvl(round(V.VerAuf7/1000,2), 0) ), 0) RAKosten, TO_CHAR(F.Created_Date,'MM.YYYY') Created_Date_MM , TO_CHAR(F.Created_Date,'YYYY') Created_Date_MMRRRR FROM FACM F, VA V WHERE F.custnum = DECODE(0,0,F.custnum,0) AND F.accnum = V.accnum GROUP BY F.custnum, V.Import_date,TO_CHAR(F.Created_Date,'MM.YYYY') ,TO_CHAR(F.Created_Date,'YYYY'))
Hello
Here's what I suggest:
select a.custnum, a.import_date, b.ErledigtMM, b.ErledigtGrundMM, a.Mandantenforderung, a.Inkassokosten, a.KontoFuehrungsgebuehren, a.Verwertungskosten, a.Barauslagen, a.Gerichtskosten, a.RAKosten, a.Created_Date_MM , a.Created_Date_MMRRRR from ( SELECT F.custnum, V.Import_date, nvl(sum(nvl(round(V.VerAuf16/1000,2), 0) +nvl(round(V.VerAuf17/1000,2), 0) + nvl(round(V.VerAuf18/1000,2), 0) + nvl(round(V.VerAuf19/1000,2), 0) + nvl(round(V.VerAuf20/1000,2), 0) + nvl(round(V.VerAufKAPUn/1000,2), 0) + nvl(round(V.VerAufKAPVz/1000,2), 0) ), 0) Mandantenforderung, nvl(sum(nvl(round(V.VerAuf4/1000,2), 0) ), 0) Inkassokosten, nvl(sum(nvl(round(V.VerAuf5/1000,2), 0) ), 0) KontoFuehrungsgebuehren, nvl(sum(nvl(round(V.VerAuf1/1000,2), 0) + nvl(round(V.VerAuf2/1000,2), 0) ), 0) Verwertungskosten, nvl(sum(nvl(round(V.VerAuf10/1000,2), 0) + nvl(round(V.VerAuf8/1000,2), 0) + nvl(round(V.VerAuf9/1000,2), 0) ), 0) Barauslagen, nvl(sum(nvl(round(V.VerAuf13/1000,2), 0) + nvl(round(V.VerAuf14/1000,2), 0) + nvl(round(V.VerAuf15/1000,2), 0) + nvl(round(V.VerAuf6/1000,2), 0) ),0) Gerichtskosten, nvl(sum(nvl(round(V.VerAuf11/1000,2), 0) + nvl(round(V.VerAuf12/1000,2), 0) + nvl(round(V.VerAuf7/1000,2), 0) ), 0) RAKosten, TO_CHAR(F.Created_Date,'MM.YYYY') Created_Date_MM , TO_CHAR(F.Created_Date,'YYYY') Created_Date_MMRRRR FROM FACM F, VA V WHERE F.custnum = DECODE(0,0,F.custnum,0) AND F.accnum = V.accnum GROUP BY F.custnum, V.Import_date,TO_CHAR(F.Created_Date,'MM.YYYY') ,TO_CHAR(F.Created_Date,'YYYY')) ) a, FACM b where b.custnum = a.custnum
By the way
WHERE F.custnum = DECODE(0,0,F.custnum,0) AND F.accnum = V.accnum
can be translated into
WHERE F.accnum = V.accnum
because
F.custnum = DECODE(0,0,F.custnum,0)
is always true
becauseDECODE(0,0,F.custnum,0)
means
if 0=0 then F.custnum else 0
-
Print the name of the column by using the query
Hello
I need to print the column name and the number of number of columns i.e. columns in the query below. Please suggest me how to print
SELECT
E.EMPNO,
E.ENAME,
D.DEPTNO
FROM EMP E,.
D DEP.
WHERE
E.DEPTNO = D.DEPTNO
Please suggest
Thank you
SudhirRe: get the title of column
http://saubbane.blogspot.com/2011/01/how-to-find-column-count-of-query.html
Re: writing data from table to filePublished by: Johan July 5, 2011 16:28
-
First of all, I would like to know the name of this type of table.
ex.
Name of the song. Artist | Album | Date | Quality | Etc.
Select the one you want to see less to higher value, select again to see bigger less valuable.
SortTable: make all your tables sortable
or with jquery
Maybe you are looking for
-
Hi all I need to use XML to store program data. In the attached example, I save a path to an XML file, so that my program remember last used folder for export. This simple XML file format is as follows: - C:\Users\AJ\Desktop At another time in my mai
-
Can my moniter be shared?
I have HP S 2031 LCD moniter and want to use it to view the files on two desktop computers. We're running Windows XP and the other Windows 7 Home Premium. I have both connected to moniter works fine individually powered. I would like to be able to ac
-
Problems with the windows troubleshooting utility. Error code: 0 x 80070002
Original title: Problems with the windows troubleshooting tool Whenever I run the Troubleshooting Guide for things like a problem of wireless network I get this error An error occurred during troubleshooting: An unexpected error has occurred. The Tro
-
Conditional fields on PDF forms?
I develop a PDF form that has fields that should be active/filled if another domain is active/populated.Examine the fields A, B, B1, B2 and C.Zones B1 and B2 not should be full and active a field B = 'YES '.On the other hand, the behavior of the fiel
-
Hi, I am unable to change my payment details to renew my subscription on creative cloud, my subscription has expired yesterday and as I click on change my payment details, I get a popup, but it fails to load the details and mode of buffering / downlo