Using the value of the column in the subquery?
Hello friends. Because I didn't realize anything today, although focusing on the problem for hours, I would like to ask you a question.I have a report based on a query. The following statement is the minimum to avoid confusion between you:
select cnt_gebiet, null work, 1 cs from tbl_gebiet
union
select
a.lng_gebiet,
case when (select max(a.lng_arbeitsschritt) from
tbl_arbeit_zu_gebiet a, tbl_arbeitsschritte_neu b
where
a.lng_arbeitsschritt = b.cnt_arbeitsschritt and b.lng_typ_arbeitsschritt = 3) = 1 then 0 else (select max(a.lng_arbeitsschritt) from
tbl_arbeit_zu_gebiet a, tbl_arbeitsschritte_neu b
where
a.lng_arbeitsschritt = b.cnt_arbeitsschritt and b.lng_typ_arbeitsschritt = 3) end as lng_arbeitsschritt,
2 cs
from tbl_arbeit_crit_date a inner join tbl_arbeitsschritte_neu b on a.lng_arbeitsschritt = b.cnt_arbeitsschritt
where a.lng_arbeitsschritt = 1
order by cnt_gebiet asc, cs asc
My problem:I need to add the cnt_gebiet criteria to the query
select max(a.lng_arbeitsschritt) from
tbl_arbeit_zu_gebiet a, tbl_arbeitsschritte_neu b
where
a.lng_arbeitsschritt = b.cnt_arbeitsschritt and b.lng_typ_arbeitsschritt = 3
Do you have any idea how I can the union row, using the value of line (cnt_gebiet) of the above query as a criterion in the subquery resp. lower?
skahlert,
Something like this might work:
WITH upper_query
AS ()SELECTcnt_gebiet
NULL WORK ,
1 cs
DE tbl_gebiet
UNION
SELECT a . lng_gebiet ,
CASE
WHEN (SELECTMax(a. lng_arbeitsschritt )
DE tbl_arbeit_zu_gebiet a ,
tbl_arbeitsschritte_neu b
OÙ a . lng_arbeitsschritt = b . cnt_arbeitsschritt
ET b . lng_typ_arbeitsschritt = 3 )=1
THEN 0
Else (SELECTMax(a. lng_arbeitsschritt )
DE tbl_arbeit_zu_gebiet a ,
tbl_arbeitsschritte_neu b
OÙ a . lng_arbeitsschritt = b . cnt_arbeitsschritt
ET b . lng_typ_arbeitsschritt = 3 )
END AS lng_arbeitsschritt ,
2 cs
DE tbl_arbeit_crit_date a
INTERIOR JOIN them tbl_arbeitsschritte_neu b
ON a . lng_arbeitsschritt = b . cnt_arbeitsschritt
OÙ a . lng_arbeitsschritt = 1
ORDER BY cnt_gebiet CSA ,
cs CSA )
SELECT Max (a. lng_arbeitsschritt )
DE tbl_arbeit_zu_gebiet a ,
tbl_arbeitsschritte_neu b ,
upper_query
OÙ a . lng_arbeitsschritt = b . cnt_arbeitsschritt
ET b . lng_typ_arbeitsschritt = 3
ET upper_query . cnt_gebiet = : variable
Jeff
Tags: Database
Similar Questions
-
Problem with update of table (using the subquery to retrieve value)
Hello
I update a table based on the value of the subquery.
Here's the update statement.
UPDATING temp xm
SET xm.col1 = (SELECT DISTINCT col1
Of
(SELECT col1, col2 COUNT (col2)
FROM table2
WHERE col1 = xm.col1
AND col2 = xm.col2
GROUP BY col1)
where col2 in (select... in the table3)
)
WHERE xm.col5 = < value >
AND xm.col6 = < value >
When I run this statement I get following error.
ORA-00904: "XM". "" Col1 ": invalid identifier.
Can someone help me why I get this error?
Why doesn't the main table alias in the subquery?
Is it possible to avoid this / re - write the query in a different way?
Thank you
Published by: user552703 on November 2, 2009 20:42You can nest only 1 level deep (referring to the table to be updated).
Have you looked at using the MERGE command? It is "easier" perform updates of this nature, assuming you are using a recent version of Oracle (9 or MORE).
-
Use the value of the inline column in a subquery
How can I use a value from a column of a row finds in a subquery in column_name, here's my problem:
SELECT scr_error.err_tab_severity
OF scr_error.
(SELECT column_name
Of user_tab_columns
WHERE table_name = 'SUPP_OUTPUT_ADDRESS' AND column_name LIKE '% ERR')
table__16
WHERE (scr_error.err_tab_code in (SELECT table__16.column_name
OF supp_output_address
where))
PS. the product within which im trying to imitate this request can't stand not pl/sqlWhich DB version are you running?
What is the SQL code you want to run?
set serveroutput on declare l_Str varchar2(4000); begin l_Str := 'select scr_error.err_tab_severity from scr_error where scr_error.err_tab_code '; for r in (select column_name cn from user_tab_columns where table_name = 'SUPP_OUTPUT_ADDRESS' and column_name like 'ERR%') loop l_Str := l_Str || ' = ' || r.cn || ' and '; end loop; dbms_output.put_line(substr(l_Str, 1, length(l_Str)-4); end; /
-
Dear all,
I am a beginner in the ADF and am under Jdeveloper Studio Edition Version 12.2.1.0.0.
I have a page that consists of two taskflows.
First workflow has a fragment which is to have a table based on view object salespersons (not editable)
Second task flow contains a form of ADF from the same view object Salespersons.
As the user selecting a line in the table of the same record is displayed as no problem.
Now, I have added two buttons Activate and Deactivate that is to change the status of the sales.
I tried to use two ways an updated using the procedure of database and then put in value by programming and I have different questions with two of them:
Now, here's the code of the Java bean for activation:
Option A - the problem with this is the value of the column in the list (the first task rate displayed) is not synchronized
and Activate and Deactivate buttons are not disabled and active properly.
{} public void confirmActivation (DialogEvent dialogEvent)
If (dialogEvent.getOutcome () == DialogEvent.Outcome.yes) {}
DBSequence vId;
vId = dcId.getValue ((DBSequence));
Links BindingContainer = getBindings();
OperationBinding operationBinding;
operationBinding = bindings.getOperationBinding ("changeSalespersonsStatus") (OperationBinding);
operationBinding.getParamsMap () .put ("pId", vId.getValue ());
operationBinding.getParamsMap () .put ("pStatus", "A");
Object result = operationBinding.execute ();
dcStatus.setValue ("A");
} else {}
return;
}
}
Option B - the problem with this is that the value of input for status text appears in the Active form for all records in form regardless of its database.
{} public void confirmActivation (DialogEvent dialogEvent)
If (dialogEvent.getOutcome () == DialogEvent.Outcome.yes) {}
-no doubt this two lines are not needed here
DBSequence vId;
vId = dcId.getValue ((DBSequence));
dcStatus.setValue ("A");
BindingContainer links = getBindings();
OperationBinding operationBinding;
the operationBinding = bindings.getOperationBinding("Commit") (OperationBinding);
Object result = operationBinding.execute ();
} else {}
return;
}
}
Here's the code from the Fragment of shape for used buttons.
"< af:button text = 'Activate' id ="bActivate' icon="/icons/activate.png ' iconPosition = 'top '.
partialTriggers = "Bcreer bSaveInsert bCancelInsert dDeactivate dActivate".
Binding = "#{pageFlowScope.salespersonsForm.buttonActivate} '"
Disabled = ' #{bindings. " Status.inputValue! {= ' n '} ">"
< af:showPopupBehavior popupId = "pActivate" / >
< / af:button >
"< af:button text = 'Disable' id = 'bDeactivate' icon="/icons/deactivate.png ' iconPosition = 'top '.
partialTriggers = "Bcreer bSaveInsert bCancelInsert dDeactivate dActivate".
Binding = "#{pageFlowScope.salespersonsForm.buttonDeactivate} '"
Disabled = ' #{bindings. " Status.inputValue! {= 'A'} ">"
< af:showPopupBehavior popupId = "pDeactivate" / >
< / af:button >
Here's matching Popups for each of the buttons Activate and Deactivate.
< childCreation = "deferred" autoCancel af:popup = "disabled" id = "pActivate" >
< af:dialog id = "dActivate" type = "YesNo" title = 'Status of salespersons' closeIconVisible = 'false '.
affirmativeTextAndAccessKey = "& amp; Yes"cancelTextAndAccessKey ="& amp; (Cancel)
noTextAndAccessKey = "& amp; No '.
dialogListener = "#{pageFlowScope.salespersonsForm.confirmActivation}" >
< f: facet = 'buttonBar' name / >
< af:outputLabel value = "Are you sure you want to enable the seller?" id = "ol1" / >
< / af:dialog >
< / af:popup >
< childCreation = "deferred" autoCancel af:popup = "disabled" id = "pDeactivate" >
< af:dialog id = "dDeactivate" type = "YesNo" title = 'Status of salespersons' closeIconVisible = 'false '.
affirmativeTextAndAccessKey = "& amp; Yes"cancelTextAndAccessKey ="& amp; (Cancel)
noTextAndAccessKey = "& amp; No '.
dialogListener = "#{pageFlowScope.salespersonsForm.confirmDeactivation}" >
< f: facet = 'buttonBar' name / >
< af:outputLabel value = "Are you sure you want to disable the seller?" id = "ol2" / >
< / af:dialog >
< / af:popup >
Thanks in advance.
Best regards
Arif Khadas
If you bind components to a range of flow page bean. You must complete that it saves the State of the component longer than the life of the component.
To change the value of the GET value of the component of the link layer and change it.
In this way the changes are captured by the framework and you should see them.
Timo
-
Using the value of the column of the report in view state
Hi all
I have a little trouble as long as you report column. Here's the problem I have face.
I have a classic report in apex5 (universal theme). Please find the page here https://apex.oracle.com/pls/apex/f?p=62495:5:
I want to have a condition that SAL column should appear only if DEPTNO! = 10. For this, I put a conditional display for SAL column that "point value / expression 1 column! Expression 2 ="and #DEPTNO # expression1 and expression2 10. But this doesn't seem to work. Can someone help me understand the issue.
Note: I want to view only the column of the report, not the page item in the condition.
Thank you
Stephanie.
Kalesh Ravi-Oracle wrote:
I want to have a condition that SAL column should appear only if DEPTNO! = 10. For this, I put a conditional display for SAL column that "point value / expression 1 column! Expression 2 ="and #DEPTNO # expression1 and expression2 10. But this doesn't seem to work. Can someone help me understand the issue.
It is not possible to report baseline values in the State of the reference column. It would be unwise to do so: how APEX can determine if the column should be included or not until all rows are retrieved?
Note: I want to view only the column of the report, not the page item in the condition.
Why? In the example given, this is the correct (and more effective) approach. If the condition must be based on the expected query results, then use a Exists (SQL query returns at least one row) or NOT Exists (SQL query returns no line) condition.
-
By using the link in the column to pass column values
Hello
I have a link to the column in my report which opens a modal page, now I want to use the value of the column clicked in the page that opens.
I don't want to put any article on the opening page of the column value of click rather I want to use the value of the column of the click in my sql query.
for example:
1 P1 has the report < column link by clicking on it opens P2 >
2. on page 2, I want to use the value of the clicked column.
So far, I did
1 link to page 2
2. ask - #column_value_clicked #.
3. in the sql query, I use the same above in the where clause.
Any help...
Thank you
Rakesh
fac586 wrote:
Sunil Bhatia wrote:
Hi Rakesh,
Make use of x 01 parameter included in apex 5.0
You can create a URL to page 1 as:
f? p = 103:1:3241341234123: & x 01: #column_value_clicked #.
Make use on request P2 in the form:
Select * from test_table where id = APEX_APPLICATION. G_X01;
You have not tested who, did you?
I tested it buddy.
Link https://apex.oracle.com/pls/apex/f?p=56971
Click any bar chart and then wait that he freshen up.
Click on report of ENAME and see that he went through the parameter.
Report URL: f? p = 56971:2: & APP_SESSION. : No.: & x 01 = #ENAME #.
-Sunil Bhatia
-
How to use the values in the columns of an interactive report (Apex 5)
Hello
I have an interactive report and a link column and I click to set the value of four fields in a subregion with the value of four columns of the report.
This without submitting the page every time so I think using javascript.
But what is the right way to do this in 5 Apex?
How to have a reference to the column of a report (customer.name to the customer or customer.city, for example)?
Concerning
Gianpaolo
Hi gianpagi,
gianpagi wrote:
I can't run your code as well, on apex.oracle.com, I have re-product the situation with the emp table and the columns ename, sal and the fields p1_ename, p1_job, p1_sal
Can you help me.
https://Apex.Oracle.com/pls/Apex/f?p=4550:1:103040501310506:
https://Apex.Oracle.com/pls/Apex/f?p=102726:LOGIN_DESKTOP:104044067688962:
user and developer demo/demo (TR1 workspace)
Check the application now. I've done the column 'Empno' as link and execution of your dynamic action on click on the link.
Here are the changes:
- Edited the "Empno" column attributes and perform the following settings in the properties of 'column link:
Text link: #EMPNO #.
Link attributes: class = 'empdetails '.
Target: URL
URL: javascript:void (0);
NOTE: The link does nothing but on the onclick for the event of link DA no real logic.
- Edited the dynamic action 'assign values' and set the following properties:
Selection type: jQuery Selector
jQuery Selector: a.empdetails
Kind regards
Kiran
-
Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?
Guessing
Select nvl (x.col_a, y.col_b) the_column
from table_1 x,.
table_2 y
where x.pk = y.pk
Concerning
Etbin
-
How to upgrade a table column using the values in the Oracle collection
On the "BOLD" line, I don't know how I should move the values of the collection of name I said without which are set all the values in the table supplier_16 = 'Saral.create or replace procedure test_coll IS CURSOR upd IS SELECT CONTACT_NAME FROM Supplier_16; TYPE dept IS TABLE OF upd%rowtype; cur_var dept; Type List Is table Of varchar2(20); Name List:= List('Shilpi','Sunil','Shreyas','Saral'); BEGIN OPEN upd; LOOP FETCH upd BULK COLLECT INTO cur_var; -- EXIT WHEN upd%NOTFOUND; FORALL i IN cur_var.FIRST..cur_var.LAST UPDATE supplier_16 ** SET Contact_name= name(i); *** COMMIT; END LOOP; CLOSE upd; END;
Help, please.Aashish S. wrote:
Thank you very much...Yes, I slide collections and was trying to reach somwthing on similar lines to which you provided the code example...
My essay is equipped to take a collection: initialized with values of say 3-4...
Take other tables... A column... and update the column in the table (not PK, FK anything) using the values of the initialized collection...
However, I am stuck between the two on how the UPDATE clause should be...
OK, if it's just because you want to practice with collections, you might do something like this...
SQL> set serverout on SQL> create table supplier_16 as 2 select 'Frederick' as contact_name from dual union all 3 select 'Robert' from dual union all 4 select 'Jeremy' from dual union all 5 select 'Simon' from dual 6 / Table created. SQL> create or replace procedure test_coll is 2 CURSOR upd IS 3 SELECT CONTACT_NAME 4 FROM Supplier_16 5 FOR UPDATE; 6 Type List Is table Of varchar2(20); 7 Name List := List('Shilpi','Sunil','Shreyas','Saral'); 8 v_contact_name varchar2(30); 9 v_idx number := 1; 10 BEGIN 11 OPEN upd; 12 LOOP 13 FETCH upd INTO v_contact_name; 14 EXIT WHEN upd%NOTFOUND; 15 UPDATE supplier_16 16 SET contact_name = name(v_idx) 17 WHERE CURRENT OF upd; 18 DBMS_OUTPUT.PUT_LINE(v_contact_name||' update to '||name(v_idx)); 19 v_idx := v_idx + 1; 20 END LOOP; 21 CLOSE upd; 22 COMMIT; 23 END; 24 / Procedure created. SQL> exec test_coll; Frederick update to Shilpi Robert update to Sunil Jeremy update to Shreyas Simon update to Saral PL/SQL procedure successfully completed. SQL> select * from supplier_16; CONTACT_N --------- Shilpi Sunil Shreyas Saral
Of course, there is treatment rank by rank and is not best for performance, but it allows you to access your collection that you created names.
-
How to choose the maximum value in a column of a table by using the cursor and iteration
Hello everyone
I have a table loan_detail
and a column inside loan_amount
now I want to take the values in this table with the cursor, then using iteration that I want to take a max value of him using this slider
Here is my table
I could make using the concepts of single loop, but when I tried to do by using the slider I wasn't able to do.LOAN_AMOUNT 100 200 300 400 500 5600 700
Concerning
ProstYou can get the maximum value for a particular column in SQL, PLSQL needn't; Always avoid PLSQL so you can do it in SQL. But always as an example:
declare
number of Temp: = 0;
Start
for news in some loan_amt of loan_detail
loop
If (temp
end if;
end loop;
dbms_output.put_line (temp);
end;Edited by: Mahanam January 5, 2011 03:11
-
How to use the default value of a column in a table in insert or upda
Hello
I try to use the values by default so that the user should not have to enter data, but when I select default type and a default, I see an error message if I try to add a new line.
How can I use a default value to a column in a tabular presentation?
Gouri
Published by: user1046395 on April 3, 2009 09:58Gouri,
You can change simply to attribute each report column. For example,.
To set the default date.
Default type: PL/SQL Expression of function
Default: sysdateTo set the default text,
Default type: PL/SQL Expression of function
Default: * "CLERK."If you still get an error, what is the error message?
Tarraf -
Navigation using the value of the column
Hello
I have a question about navigation in BI dashboard reports. If I understand correctly, I can implement the interaction of value to navigate to another report and use the original query as a filter. But I need to use the exact value that the user has clicked as a filter: I have a report that shows a list of the countries and summaries. Then, by clicking on the name of the country, I will navigate to a report target with a detailed analysis for that specific country.
Can someone help me with this?To do this, in the source report, go to the country column-> properties-> tab Format of the column column-> in the option value interaction select Browse and select the target report. In the report target activate option "" is bringing"on the Country column. This will pass the value when the user clicks on a particular value on the source report.
Arjun -
How to highlight the minimum value in a column?
I need to highlight the lowest value in each column in my spreadsheet. I try to use the conditional nail, but I can't find a function to work as I need.
One way would be to calculate the minutes in a cell of a footer row, select the cells in the body of the column and apply conditional highlighting like this:
You must click on the chip address first, and then select the comparison cell, A8 here, then be sure to keep the row and column.
The A8 from the example formula is = MIN (A).
The result is a bold 2 (not shown in the screenshots).
SG
-
Display several values on the front using the table
For example, if I enter "10" for number of datapoints, I want to see 10 hexadecimal and binary all values in a column. At present, only 1 value appears and erasing all of the previous values
Thank you!
You do not use a shift register to store the values in the table between the fo the loop iterations For.
It is a fundamental concept of LabVIEW.
I recommend you watch the LabVIEW tutorials online
LabVIEW Introduction course - 3 hours
LabVIEW Introduction course - 6 hours -
Write to the file of measurement with a loop For using the value of the dynamic data attributes
I looked and looked, but couldn't find a solution for this.
I currently have 15 points of different data that I try to write in an Excel file. I have all combined in a table and lie with the function "write into a file position. However, the column names are always "Untitled", "Untitled 1" etc. I then used the function 'Set the Dynamic Data attributes'; but for this I have to do 15 different functions "set data dynamic attributes. It was suggested to use a loop with the function 'Set the Dynamic Data attributes' inside of her, but I can't find how do.
I have several arrays consisting of 15 different values for 'Signal Index' 'Name of Signal' and 'Unit', but also a unique 'get Date/Time In Seconds' related to 'Timestamp '. The problem is that the error I get when I try to connect the output with Scripture at the entrance to measure file:
The source type is dynamic data table 1 d. The type of sink is Dynamic Data.
How can I fix it? I have attached a picture of my installation; Sorry if this is gross (I'm new on this!). Thank you!
It will get rid of the error, but it is not quite correct. What you need to do after that is to click on the output or the tunnel entry and select 'replace with the shift register. In addition, the array of values that you have wired to the Signal Index is wrong. Arrays are 0 based. Just wire the iteration Terminal here. And, finally, take the size of the table and this connection to the N terminal are stupid. Don't wire nothing to this.
Maybe you are looking for
-
How to copy a movie on my iPad without syncing?
Hello. I've got 2 iTunes libraries. One on my Mac and the other on a laptop, on Win10. Two of them contains my movies purchased from the iTunes Store. At home, I sync my iPad, using the iTunes library on my Mac. When I'm out, when I connect my iPad t
-
When I connect my iPad to my PC Windows (10), the iPad icon does not appear in the iTunes window. It's something new. I have uninstalled and reinstalled iTunes with the same result. The same happens when I connect my iPhone. What gives?
-
I already have a sync account, but I don't like on any other device now I want to just save my settings on this computer browser right now. Want to replace anything by what I have here but she again just put me into something the device. I want to re
-
I would like to make a request to have an option that would show that my message has been read. How to begin such a request?
-
With remote desktop connection, there are two computers involved, one linking and to get the connection. For that matter, let's call it the "receiver" of the latter. Is there a file in the 'receiver' (not the sender) when a "sender" has connected to