Passing the value of the where clause with the page
Dear friends,
I have a requirement like when I select a selection list value I should pass this value to sql query where clause without submitting the page
ex I have a select like: P1_Dept guess I selects the value 10 in this
then I have a query select * from emp where deptno =: P1_Dept.
DB. ORACLE 11G
APEX 4.1.1.00.23
is this possible? can someone help me please in this topic
Thanks and greetings
Vballeda
Suppose we have the selection list with the name P1_DEPT and query for report
select * from emp where deptno = :P1_DEPT
We create dynamic Action on the evolution of the P1_DEPT point. We will need two real actions:
1-> set value action
Set the Type - > body of the PL/SQL function
The function of body - > return 1;
Page item to submit-> P1_DEPT
Change to delete-> Yes event
Selecttion Type-> trigger element
2. action-> Refresh
Selecttion Type-> region
Region-> your region of report
Tags: Database
Similar Questions
-
How to pass a value LOV to where clause of another LOV
Hello
I have the two LOV project and activity. When I select a value of project LOV this value project to switch to the 2nd activity LOV where clause. How can I achieve this.
I tried to use the code in the process CO request by getting the value of project with the command below.
int v_project = Integer.parseInt ((String) passiveCriteria.get ('Project')); grab the critirea project
and set this value in the setwhereclauseparams of the VO LOV. But the above command is throwing an exception with the exception of null pointer.
This approach is correct, or should I use any other method.
Thank you
HCBelow you will find the article interesting
http://oracleanil.blogspot.com/2010/12/dependent-lov-in-OAF.html
Thank you
AJ -
Calculate the sum of values of 2 where Clauses
Hi, sorry to trouble, I have all the data in a database or anything like that, just to think about some of the work I have to do, trying to get ahead. I was wondering how i would be the sum of the values in a column, but with 2 where clauses. By example, if I wanted to the sum of all the values until 18:00 in 1 column and all the after 18:00 for 1 day how I would write this out.
I don't know how to write separately, i.e.
select name, sum(values) as after6 from table where time > '18:00' group by name;
select name, sum(values) as upto6 from table where time < '18:00' group by name;
How can I combine these columns after6 and upto6 next to each other.
If someone could please advise.
Thanks in advance
Select the name,
sum (case when time > 18:00 ' then 0 otherwise end of values) as after6,.
sum (case when time< '18:00'="" then="" values="" else="" 0="" end)="" as="">
table
Group by name;
----
Ramin Hashimzade
-
Using the Case statement in Where clause with operator
Hi all
I'm doing the following work (this is just a simple version of what I'll eventually need):
Sorry, I forgot how to use the code tags...
and li. MAJOR_ACCT in case
When: prompt = 'Energy' then ('9320906 ', ' 9321471')
end
Problem is that I get a missing closing parenthesis error.
Wouldn't - that evaluate against a value(as below) it works fine:
and li. MAJOR_ACCT in case
When: prompt = 'Energy' then ('9320906')
end
Any thoughts? Is it possible to use a box (or decode) in an In clause with multiple values? I tried to use decode as well and get the same results.
Thank you.
Darren.What:
and ( case when :prompt = 'Energy' and li.MAJOR_ACCT in ('9320906', '9321471') then 1 when :prompt = 'Vehicle' and li.MAJOR_ACCT in ('9812180', '9812320') then 1 when :prompt = 'Meals' and li.MAJOR_ACCT in ('983120', '983452') then 1 end ) = 1
-
where clause with reg_exp
Hello
My query is...
The string is "1,2,3"...
output must be '1', ' 2 ', ' 3',
Please help me...!
Concerning
SA
The guru gave the solution...
But, I have to use this condition in Where clause on my request. If I put in which the value of the clause does not appear. Any help on that...! Please, I beg you.select REGEXP_REPLACE('1, 2, 3', '([0-9]+)', '''\1''') from dual;
Concerning
SAHello
Query: SELECT "' | REPLACE ('1,2,3',',' "',"'). "' val FROM DUAL;
will convert '1,2,3' string '1', ' 2 ', 3'.
Run the sub queries first and then run a select statement.
CREATE TABLE sample_table
(
col_a VARCHAR2 (3)
);INSERT INTO sample_table
VALUES ('1');INSERT INTO sample_table
VALUES ('2');INSERT INTO sample_table
VALUES ('3');INSERT INTO sample_table
VALUES ('4');INSERT INTO sample_table
VALUES ('5');COMMIT;
SELECT col_a
OF sample_table
WHERE INSTR ((SELECT ''' ||)) REPLACE ('1,2,3',',' "',"'). "' val
THE DOUBLE).
col_a
) > 0;The select statement above will give you the desired result of "sample_table" as below.
COL_A
1
2
3Kind regards
Big Boss -
Oracle OFA customization list of values (LOV) mapping in Where clause with variables
Hi all
I have a requirement to add the condition of the UOM LOV I don't understand under conditions in LOV for example mcc.inventory_item_id =: 1 what: 1 means? and how the system look at the value in: 1? if I have to add the condition to the middle which number should I use?
SELECT * FROM (SELECT distinct muc.unit_of_measure unit_meas_lookup_code, muc.unit_of_measure_tl unit_meas_lookup_code_tl, muc.description, muc.uom_class, muom.uom_code FROM mtl_uom_conversions_val_v muc, mtl_units_of_measure muom WHERE (muc.uom_class IN (SELECT mcc.to_uom_class CMC mtl_uom_class_conv_val_v WHERE mcc.inventory_item_id =: 1) muc.uom_class = GOLD: 2), AND (muc.item_id =) ((: 3 GOLD muc.item_id = 0) AND muc.unit_of_measure = muom.unit_of_measure) QRSLT WHERE ((UPPER (UNIT_MEAS_LOOKUP_CODE_TL) like UPPER(:4) AND (UNIT_MEAS_LOOKUP_CODE_TL like: 5 OR UNIT_MEAS_LOOKUP_CODE_TL as: 6 OR UNIT_MEAS_LOOKUP_CODE_TL as: 7 OR UNIT_MEAS_LOOKUP_CODE_TL as: 8))) ORDER BY upper (unit_meas_lookup_code)
Concerning
A.S.
Hey A.S.,.
Looking more closely at the image you included, it seems that it is already a custom code, it starts with "Xx". You should see if you have the available custom code.
To answer part of your original question ""mcc.inventory_item_id =: 1 what: 1 means? ' " The ': 1 ' is a variable binding in the SQL code. This value is populated at run time by using the "setWhereClauseParam (Bind number, value). You can see the details of the request and the variable linking using JDeveloper and a double-tap on the View object. Again, this should be in the custom code of the object View 'atco.oracle.apps.po.lov.server.XxDocumentUomBothVo '.
I hope this helps.
Thank you
Tim
-
using where clause with value to hardcode in run immediately
Dear Experts, I use below in the stored procedure make exception.
RUN IMMEDIATELY "REMOVE CC. TB WHERE COL ='HG ";
When the collar is varchar2 (30) DC. TB
Please guide how to use above the statement in the stored procedure
Thank youDBA wrote:
Dear Experts, I use below in the stored procedure make exception.RUN IMMEDIATELY "REMOVE CC. TB WHERE COL ='HG ";
When the collar is varchar2 (30) DC. TB
Please guide how to use above the statement in the stored procedure
Thank you
Why you use dynamic SQL? DELETE statement is a DML statement and its valid inside a PL/SQL block.
So, you can remove the immediate execution and write your DELETE statement directly.
begin delete from cc.tb where col = 'HG'; end;
-
Where clause with XMLExists and join to another table
Hello
We have table as:
drop table xml_tbl;
create table xml_tbl)
whole xml_msg_id
xmltype xml_msg_text
);
insert into xml_tbl values
(1, "< principal > < id > 1 < /ID > < / hand > '");
insert into xml_tbl values-(xml_msg_id, xml_msg_text)
(1, "< principal > < id > 2 < /ID > < / hand > '");
Another table like:
create the table1 Table:
(id1 int);
Insert into Table1 values (2);
Insert into Table1 values (3);
We need to have a view on top of the table xml_tbl where/hand/IDs should only have the values located in id1 column of the Table1 table.
Something like
CREATE OR REPLACE VIEW V_xml_tbl
(
xml_msg_text
)
AS
SELECT T.xml_msg_text
OF xml_tbl T
WHERE (XMLEXISTS)
' declare namespace Namesp1 = "Abc: Set";
Let $Results as XS: Boolean: = fn:exists($p/main/id_in_(Select_id1_from_Table1))-now, here I know that I can't select id1 of
Table 1
return if ($Results) then true() (else)"
PASSAGE T.xml_msg_text AS 'p');
In fact, in the scenario real Table1 will have several IDs and xml_tbl a lot of XML files...
So I'm stuck on how to do it. Help, please.
Thank you...
Published by: user8941550 on November 20, 2012 19:19One of these two:
SQL> select t.xml_msg_text 2 from xml_tbl t 3 where exists ( 4 select null 5 from table1 t1 6 where t1.id1 = xmlcast( 7 xmlquery('/main/id' passing t.xml_msg_text returning content) 8 as integer 9 ) 10 ); XML_MSG_TEXT --------------------------------------------------------------------------------
2 SQL> select t.xml_msg_text 2 from xml_tbl t 3 , xmltable('/main' passing t.xml_msg_text 4 columns id integer path 'id' 5 ) x 6 where exists ( 7 select null 8 from table1 t1 9 where t1.id1 = x.id 10 ); XML_MSG_TEXT --------------------------------------------------------------------------------
2 And a third, using XMLExists:
SQL> select t.xml_msg_text 2 from xml_tbl t 3 where xmlexists ( 4 'fn:collection("oradb:/DEV/TABLE1")/ROW[ID1=$d/main/id]' 5 passing t.xml_msg_text as "d" 6 ); XML_MSG_TEXT ------------------------------------------------------------------------------------------------------------------------
2 The plan is similar to that of the second query above (XMLTable/EXISTS).
Still using XMLExists, a plan similar to the first query (EXISTS, XMLCast, XMLQuery) can be achieved by id of casting to an integer data type:
SQL> select t.xml_msg_text 2 from xml_tbl t 3 where xmlexists ( 4 'fn:collection("oradb:/DEV/TABLE1")/ROW[ID1=xs:int($d/main/id)]' 5 passing t.xml_msg_text as "d" 6 ); XML_MSG_TEXT ------------------------------------------------------------------------------------------------------------------------
2 Check each on your real-world scenario to see that present better performance.
(I would say those involving streaming of assessment)Published by: odie_63 on 5 nov. 2012 12:24
Published by: odie_63 on 5 nov. 2012 12:38
-
selection of values to query where clause
Hi guys, it of maybe a silly question but do not know if I approach the solution in the correct engineering.
At the top of my form, I framed that the user fills out the different values. These values are then used to refine the query results in the block below. I know that I can go in the datablock being interrogated and set the where the clause equal to the value of the text boxes above, but I don't feel it is the right place to do it.
If I do like this when the above text box is empty, it returns no results when infact I want to ask all if the values are left white. So should I put it in motion pre? If so how should we do?
Any help would be greatly appreciated.
Thank you.In the trigger of the QUERY before block you, just put the value in the corresponding element
:block.name := :ctrl.selection ;
François
-
How can I get a non-existent value based on where clause
For example look at the table
SQL > select * from emp_temp;
EMP_NAME AGE
---------------------------------------- ----------
Jay 24
MUT 25
Leo 26
ARA 19
Select the age of emp_temp years where in (24,25,26,19,30);
The result I need is 30, since it is the age which is not available in the table.
In other words I need a query that compares the where values would adopt with the records in the table and give the value not existing.(B-) B-) B-)
select * from table(sys.ODCINumberList(24,25,26,19,30)) minus select age from emp_temp
-
Dynamic WHERE Clause with multiple ORs
I need to build a dynamic SQL statement such as the clause WHERE looks / works as follows:
WHERE x LIKE '%1% ' OR LIKE '%2% ' x OR x LIKE '%3%...
I can do the above, no problem, but I wonder if there is a better way?
Thank you
Mark
Hi, Mark,.
You should not need dynamic SQL for that.
For example, if you are still interested in substrings of characters suingle, and you get entry as a unique string called str (e.g. '123' it which means you want to find the rows where x contains '1', '2' or 3'), so you could say:
...
WHERE (x REGEXP_LIKE
, '[' || str || ']'
)
I hope that answers your question.
If not, post a small example data (CREATE TABLE and INSERT statements), a few entries and also post the desired results of each input given the same data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002#9362002
-
Simple conditional SQL WHERE Clause with two Subselects
Hi SQL Experts,
I need some quick help with a query.
It is a ' select ' for a data source object repository phyiscal table OBI.
So, I can't put in PL/SQL or in stored procedures. I just need
have two conditions / selects different according to the user's role (this information comes
of the session).
The above does not work:-ORA00905. 00000 - 'lack the key word'
SELECT OFFICENO FROM orgunit
WHERE
BOX WHEN "SESSION_VARIABLE' LIKE '% globalmanager %' THEN
ASSIGNEDOFFICES =
(
SELECT DISTINCT ASSIGNEDOFFICES
FROM USERSTABLE INNER JOIN orgunit WE
OrgUnit. KEY = USERSTABLE. OFFICE
WHERE USERSTABLE. USERNAME ='VALUEOF (NQ_SESSION. THE USER)"
)
ON THE OTHER
OFFICENO =
(
SELECT DISTINCT USERSTABLE OFFICENO
INNER JOIN orgunit WE
OrgUnit. KEY = USERSTABLE. OFFICE
WHERE USERSTABLE. USERNAME ='VALUEOF (NQ_SESSION. THE USER)"
)
END;Can anyone help?
Hello
I can't tell what you want to do by looking at the code that do not do. Maybe:
SELECT officeno
For orgunit
WHERE (session_variable LIKE '% globalmanager %'
AND IN assignedofficies
(
SELECT assignedoffices
UserTable U1
JOIN orgunit o1 ON o1.officekey = u1.officekey
WHERE u1.username = ' VALUEOF (NQ_SESSION. THE USER)"
)
)
OR (NVL (session_variable
, '?'
) NOT LIKE '% globalmanager % '.
AND IN officeno
(
SELECT officeno
Of u2 usertable
JOIN orgunit o2 ON o2.officekey = u2.officekey
WHERE u2.username = ' VALUEOF (NQ_SESSION. THE USER)"
)
)
;
There might be a simpler and more efficient way in function your tables and your limit.
The condition u2.username = ' VALUEOF (NQ_SESSION. The USER) "almost certainly not what you really want.
.
Whenever you have any questions, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002#9362002
-
How to call another page and pass the page parameter to another page?
Hi friends,
I've finished a page based on the payment date, he turns the payroll, summarized in the table region. Now, I have to address in detail (submit) button, when click on the details button I want to open the new page, this page based on a few VO. This vo I spend 2 parameters, we're Person_id, and the second is pay date until we are on the front page.
How to achieve this where I can write code, I am new to the OPS. could you please explain in detail and process?
Thank you and best regards.
Jocelyne.RAMU
The value of your hashmap returns null. Let intrepret your code below
String newValue = params.get("pid").toString(); null.toString(); will always throw null pointer exception
Robichaud, I suggest you to always put some SOPS for debugging purposes. It is useful to locate the problem.
Kind regards
GYAN -
using where clause with cast multiset
Version
Oracle 10g
How to select values based on the values of the object.
Published by: new learning on August 23, 2010 19:35CREATE OR REPLACE TYPE init_queue AS OBJECT ( seq_num_q NUMBER, source_system_name VARCHAR2 (50 BYTE), milestone_id NUMBER, milestone_date DATE, downstream_order_number VARCHAR2 (175 BYTE), leg_id VARCHAR2 (175 BYTE), statuspro_captured_date DATE, pon VARCHAR2 (26 BYTE), milestone_source VARCHAR2 (26 BYTE), session_id NUMBER, reconfirmation_flag CHAR (1 BYTE), vec_flag CHAR (1 BYTE) ); / CREATE OR REPLACE TYPE tab_init_queue AS TABLE OF init_queue; / SET serveroutput on; DECLARE v_list tab_init_queue := tab_init_queue (); v_arr_sort tab_init_queue := tab_init_queue (); BEGIN SELECT init_queue (seq_num_q, source_system_name, milestone_id, milestone_date, downstream_order_number, leg_id, statuspro_captured_date, pon, milestone_source, session_id, reconfirmation_flag, vec_flag ) BULK COLLECT INTO v_list FROM r_cust_status_init_queue; SELECT CAST (MULTISET (SELECT * FROM TABLE (v_list) WHERE v_list.milestone_id = 11 -- * How to select values based on milestone.* ) AS tab_init_queue) INTO v_arr_sort FROM DUAL; DBMS_OUTPUT.put_line (v_arr_sort.COUNT); END; /
new learner wrote:
Version
Oracle 10gHow to select values based on the values of the object.
CREATE OR REPLACE TYPE init_queue AS OBJECT ( seq_num_q NUMBER, source_system_name VARCHAR2 (50 BYTE), milestone_id NUMBER, milestone_date DATE, downstream_order_number VARCHAR2 (175 BYTE), leg_id VARCHAR2 (175 BYTE), statuspro_captured_date DATE, pon VARCHAR2 (26 BYTE), milestone_source VARCHAR2 (26 BYTE), session_id NUMBER, reconfirmation_flag CHAR (1 BYTE), vec_flag CHAR (1 BYTE) ); / CREATE OR REPLACE TYPE tab_init_queue AS TABLE OF init_queue; / SET serveroutput on; DECLARE v_list tab_init_queue := tab_init_queue (); v_arr_sort tab_init_queue := tab_init_queue (); BEGIN SELECT init_queue (seq_num_q, source_system_name, milestone_id, milestone_date, downstream_order_number, leg_id, statuspro_captured_date, pon, milestone_source, session_id, reconfirmation_flag, vec_flag ) BULK COLLECT INTO v_list FROM r_cust_status_init_queue; SELECT CAST (MULTISET (SELECT * FROM TABLE (v_list) WHERE v_list.milestone_id = 11 -- * How to select values based on milestone.* ) AS tab_init_queue) INTO v_arr_sort FROM DUAL; DBMS_OUTPUT.put_line (v_arr_sort.COUNT); END; /
Published by: new learning on August 23, 2010 19:35
Like this.
DECLARE v_list tab_init_queue := tab_init_queue (); v_arr_sort tab_init_queue := tab_init_queue (); BEGIN v_list.extend; v_list(v_list.count) := init_queue(1, '1', 11, sysdate, '1', '1', sysdate, '1', '1', 1, '1', '1'); 8 SELECT CAST (MULTISET (SELECT * FROM TABLE (v_list) WHERE milestone_id = 11 -- * How to select values based on milestone.* ) AS tab_init_queue) INTO v_arr_sort FROM DUAL; DBMS_OUTPUT.put_line (v_arr_sort.COUNT); END; / 1 PL/SQL procedure successfully completed. ME_XE?ME_XE? ME_XE?select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Production TNS for Linux: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production 5 rows selected. ME_XE?
It would have been easier if you had done a simple example, if I didn't have to type the example folder (since your original referenced a code table that you did not provide DDL and INSERTS).
Something to keep in mind for the future (make you it easier for us, the more likely we want to help).
-
How to filter the result with a where clause clause?
Hello
I have a nice sql query. I would like to include a where clause with a joker clause.
If the user selects for example a "AGENT_ID", then where clause would include the AGENT_ID, otherwise, every thing would appear.
The WHERE clause:SELECT "FICHE"."FICHE_ID" "FICHE_ID", "FICHE"."AGENT_ID" "AGENT_ID", "FICHE"."EQUIPE_ID" "EQUIPE_ID", "FICHE"."DATE_ACTIVITE" "DATE_ACTIVITE", "FICHE"."DATE_CREATION" "DATE_CREATION", "FICHE"."TYPE_FICHE" "TYPE_FICHE", "FICHE"."FICHE_CREE_PAR" "FICHE_CREE_PAR", "FICHE"."TOTAL_HEURES" "TOTAL_HEURES", "FICHE"."TOTAL_HEURES_EXCEPTIONNELLES" "TOTAL_HEURES_EXCEPTIONNELLES", "FICHE"."DATE_MODIFICATION" "DATE_MODIFICATION" FROM "FICHE"
WHERE AGENT_ID = ' * ' if nothing is selected.
WHERE AGENT_ID = "4290" If an agent ID is selected.
Hope I'm clear that English is not my mother tongue.
Thanks for you help.
ChristianHello
Try this
WHERE "FICHE".AGENT_ID like NVL(:val, '%')
see you soon
VT
Maybe you are looking for
-
Let me start by saying that I've only had my Macbook pro for a day. I tried to uninstall and reinstall onedrive several times. The problem I'm having with it is when I put the application in my dock and click it to open it, it does not open. Nothing
-
I want a filter to stick to a specific folder.
In very old versions of Thunderbird. If I clicked on a folder and selected to view: unread, that view would remain for this specific issue, until I changed the display manually. I wonder if there is a way to restore this behavior, on the latest versi
-
find if in the sequence editor API call
I swear that I found this somewhere once but can't find it now. What is the API call (or another mechanism) to determine if I am running out of sequence with respect to a user interface editor? What I want to do is if running the sequence editor, ma
-
Vista Windows only recognizes the ipod touch as a camera
How can I get windows vista Explorer and widows to recognize the ipod touch as an MP3 player and not a camera? I went to Device Manager, the drivers updated without success. When I plug in the ipod, I always get a window that opens offering manage th