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 you
DBA 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;
Tags: Database
Similar Questions
-
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).
-
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
-
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
-
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 -
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
-
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
-
Everytime I open AE an error message saying that I can't use this version with the OSX I am running
Someone knows how to fix this? Should I just uninstall After Effects?
You should not uninstall. Instead, you must upgrade your CS6 to the latest version.
-
ORA-00907: lack the right parenthesis when using Group by clause with xmlagg
I have the following query and I am getting ORA-00907 error when I use the clause with the xmlagg function group.
If I remove the clause xmlagg and the group by clause, the query works well and not give me the result.select xmlelement("Mitigation", xmlelement("m_szMethodName",tm.DisplayName), xmlelement("SubstanceInterferenceProtocolList", (select xmlagg(xmlelement("MitigationProtocol", xmlelement("m_szMethodName",tm.DisplayName), xmlelement("m_szInterferenceProtocolName",tmp.protocol_name), xmlelement("m_szInterferenceSubstance",tmp.intf_mtrl_prod_code), xmlelement("m_ProtocolParameters", xmlelement("m_szProtocolName",tmp.protocol_name), xmlelement("m_Consumables", xmlelement("Consumable", xmlelement("m_szConsumId", xrl.rgnt_pack_name), xmlelement("m_szProductCode",xrl.pack_prod_code), xmlelement("m_nVolume",tmp.fluid_vol), xmlelement("m_szProtocolStep",xps.protocol_step_name))), xmlelement("m_ProtParamList", xmlagg( xmlelement("ParameterValues", xmlelement("m_szProtocolName",tmp.protocol_name), xmlelement("m_Time",xpsd.parameter_ntime_value)) group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code) ))) order by tmp.ccd_test_id, tmp.intf_mtrl_prod_code, xps.protocol_step_intprotocolstep ) from XPR_tdef_mitigation_protocol tmp, xp_reagentlist xrl, xpr_protocol_settings xps, xpr_protocol_settings_default xpsd where tmp.ccd_test_id = tm.ccd_test_id and tmp.ccd_test_id = xrl.ccd_test_id and tmp.pack_prod_code = xrl.pack_prod_code and tmp.intf_type = 1 and xps.protocol_name = xpsd.protocol_name and xps.protocol_step_name = xpsd.protocol_step_name and xps.ps_action_parameterlist = xpsd.ps_action_parameterlist and xps.protocol_name = tmp.PROTOCOL_NAME ))) from XPtoXPRTdef_defn_mapping tm where tm.DisplayName = 'SYPH'
But in this code XML, the output format is incorrect for my application.
Could someone help out here?Now my problem is that this unique coating is more than 32767 characters and utl_file can write 32767 bytes per line.
Someone deal with this?Serialize the output as CLOB and DBMS_XSLPROCESSOR.clob2file procedure used to write to a file:
DECLARE xml_output CLOB; BEGIN SELECT XMLElement("Department", XMLAgg( XMLElement("Employee",e.job_id||' '||e.last_name) ORDER BY e.last_name ) ).getClobVal() AS "Dept_list" INTO xml_output FROM hr.employees e WHERE e.department_id = 30 OR e.department_id = 40; DBMS_XSLPROCESSOR.clob2file(xml_output, 'XML_DIR', 'test.xml'); END; /
-
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
-
Hello
I use a table column in the where condition.
For example. product_id <>1234 in where clause.
and the query returns results which have id is not equal to 1234.
My question is if the product id for a particular set (row) record is null, then only this record show upward in the result because it is not equal to 1234.
In other words oracle made the comparison "<>null 1234 so retunr the record in the result set?
Please advice. Thanks in advance.Hello
No Oracle would not return columns with null values if this column is used in where clause with equal/not equal clause (= /! =)
If there use null values in querywhere (product_id != 1234 or product_id is null)
Concerning
Anurag -
Hi Experts,
I have a VO with query like select * ministries dept, emp where dept.dept_id = emp.dept_id group... by order of dept.dept_id employees
At runtime, I need to add where clause with (and in dept.dept_id (select dept_id from table2))
I tried to use the vo.setWhereClause () method. But it does not work
Is there another solution?
I use Jdeveloper 12.1.3
Thanks in advance.
There are various possible solutions for this. You can either use setQuery that defines the entire sql statement. However, you then need to delete where condition adding yourself too.
Or you use viewCriteria as explained in this blog http://www.ahsanscorner.com/content/2015-11-16-1942-simulating-sql-clause-adf-viewcriteria-api.
Another approach is described by this blog Jet binary: using bind variable for SQL statements with the paragraph who uses a SQL table to build the in clause.
Timo
-
Hello
I want to use where clause in the View with BindVeriable object.
How can I use?
Concerning
Kiran SANCHEZYou cannot use Oracle bind variables when you use DB2. Use JDBC positional Binding Style in your query. You can use something like this in your where clause:
Where Field1 =? AND Field2 =?
Then set the 2 variables bind bind positions 0 and 1.
Make sure that you used DB2 Sql-flavor and a Java type map when creating business logic of your application (the first time you create a component of business adf).
Maybe you are looking for
-
iMac does not recognize the hard drive device
iMac does not recognize my new WD My Passport for Mac external hard drive. I have a late 2009 21. 5-inch iMac with Mac OS X Lion 10.7.5 version and I have USB 2.0 ports. Memory is 4 GB 1067 MHz DDR3. I made sure that my Finder preference displays dr
-
ReadyNAS 204 - adding 2 new drives
Hi all I have a RN204 (OS v6.4.2) currently with 2 x 3 TB WD red inside. Everything is good, and I have a RAID 1 of 2.72 TB volume - looks as X-RAID also. I've now bought another 2 x 3 TB WD red. My questions are the following: 1. in the event that t
-
Bronkhorst gas mass flow controller is not powered
Hello I have connected the mass flow controller of company BRONKHORST using RS232 to USB to my PC connection, but not flashing LEDs on mfc. I don't know if he needs additional power or not? MFC has only RS232 PIN. I have attached the mfc manual and m
-
C7280 will not feed paper photo kirkland
I tried to print on the LB 69 professional document brilliant Costco Kirkland brand ink jet. The printer goes through the motions and resembles his impression and then blocking the printer. In the past, I was able to print several sheets, but now t
-
What is the DPI of the screen of the playbook?
What is the DPI of the screen of the playbook? Thank you