Variable set to NULL Query
I'm working on a procedure that is using the workflow Oracle EBS application for approval.It has been customized by a contractor in the past, but we need to make some changes to it.
I declared a new variable of number:
l_req_doc_id NUMBER :=0;
The value of the variable l_req_doc_id is set via this SQL: SELECT DISTINCT requisition_header_id
INTO l_req_doc_id
FROM po.po_requisition_lines_all prla
, ap.ap_suppliers pv
, ap.ap_supplier_sites_all pvsa
, po.po_line_locations_all plla
, po.po_lines_all pla
WHERE prla.vendor_id = pv.vendor_id
AND prla.vendor_site_id = pvsa.vendor_site_id
AND pv.vendor_id = pvsa.vendor_id
AND prla.line_location_id = plla.line_location_id
AND plla.po_line_id = pla.po_line_id
AND pla.po_header_id = l_document_id;
We hit a scenario where some applications are triggered when the value of vendor_site_id on the command line is NULL.When this happens, the SQL above will return no rows.
I wanted to check here if, after his return any rows, SQL will change the value of l_req_doc_id from zero to NULL or would remain at zero when the SQL returns no rows?
I know it's a silly question, and I could just write some debug statements in the code that works. Unfortunately the complexity of the code, that debugging statements don't always trigger in the way that I expect.
Any advice much appreciated.
Thank you
20100511 wrote:
I know it's a silly question, and I could just write some debug statements in the code that works. Unfortunately the complexity of the code, that debugging statements don't always trigger in the way that I expect.
It is pure laziness on your part.
You could easily create a sample test case to understand behaviour like this
SQL> ed
Wrote file afiedt.buf
1 declare
2 l_num number := 0;
3 begin
4 dbms_output.Put_line('Before Select '||l_num);
5 select 1 into l_num from dual where 1 = 2;
6 exception
7 when no_data_found then
8 dbms_output.Put_line('After Select '||l_num);
9* end;
10 /
Before Select 0
After Select 0
PL/SQL procedure successfully completed.
Tags: Database
Similar Questions
-
NDOPTION = '3' always sets the null variable
OK, it's just weird.
I just want a simple my jspx variable to pass to a method of the App Module. I want the value to be null. So, I use the ndoption = "3". When I do that, however, the value is ALWAYS null. If I take off the NDoption, the value typed in is correctly passed to the method.
What the hell is happening?
Pagedef
< variableIterator id = 'variables' >
< variable name = "pNewdate" Type = "oracle.jbo.domain.Date" IsQueriable = "false" / > "
< / variableIterator >
< attributeValues id = "tNewDate" IterBinding = "variables" >
< AttrNames >
< item Value = "pNewdate" / >
< / AttrNames >
< / attributeValues >
< methodAction id = "updateEffectiveDate" InstanceName = "CaasAppModuleDataControl.dataProvider" DataControl = "CaasAppModuleDataControl"
MethodName = "updateEffectiveDate" RequiresUpdateModel = "true" Action = "999" IsViewObjectMethod = "false" >
< NamedData NDName = "pProjNames" NDValue = "${ReportSelectBean.reportShuttle.selectedValues}" NDType="java.util.List"/ > "
< NamedData NDName = "pNewDate" NDValue = "${data.» CaasAdminPageDef.tNewDate}"NDType =" oracle.jbo.domain.Date"NDOption ="3"/ >"
< / methodAction >
JSPX
< af:selectInputDate label = 'Date of application' requiredMessageDetail = "you must enter an effective Date.
required value = "#{Bindings.tNewDate.inputValue}" = "false" columns = "12" / > "
Thanks for any help you can give me on this.
JetI do not know. Is there a particular reason why you even specify the NDoption? If the value of pNewdate variable binding is null, then your updateEffectiveDate method will receive a null value.
One more question about your code:
This should not:
be like this:
-
Set up a query (written Re)
Hi Experts,
I am facing a problem in executing the query that take a long time. And I'm new to setting up a query, kindly help me in this query to reduce the time of execution below.
After reading the stories, I am unable to find how to get the execution of the query, but not sure about re writing the query plan. This is the execution plan.
Please help me by rewriting the query and guide me some ground rules for rewriting where needed.
203 rows selected. Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5745 Card=1 Bytes= 222) 1 0 SORT (GROUP BY NOSORT) (Cost=5570 Card=1 Bytes=12) 2 1 TABLE ACCESS (FULL) OF 'FAMIS_REQ' (TABLE) (Cost=5570 Ca rd=1 Bytes=12) 3 0 SORT (GROUP BY NOSORT) (Cost=5563 Card=1 Bytes=8) 4 3 TABLE ACCESS (FULL) OF 'FAMIS_REQ' (TABLE) (Cost=5563 Ca rd=1 Bytes=8) 5 0 NESTED LOOPS (OUTER) (Cost=5745 Card=1 Bytes=222) 6 5 FILTER 7 6 NESTED LOOPS (OUTER) (Cost=5743 Card=1 Bytes=198) 8 7 NESTED LOOPS (OUTER) (Cost=5742 Card=1 Bytes=163) 9 8 HASH JOIN (Cost=5739 Card=1 Bytes=140) 10 9 NESTED LOOPS 11 10 NESTED LOOPS (Cost=5567 Card=1 Bytes=98) 12 11 TABLE ACCESS (FULL) OF 'FAMIS_REQ' (TABLE) ( Cost=5565 Card=1 Bytes=90) 13 11 INDEX (RANGE SCAN) OF 'FAMIS_REQUESTOR1' (IN DEX) (Cost=1 Card=1) 14 10 TABLE ACCESS (BY INDEX ROWID) OF 'FAMIS_REQUES TOR' (TABLE) (Cost=2 Card=1 Bytes=8) 15 9 TABLE ACCESS (FULL) OF 'FAM_PERSON' (TABLE) (Cos t=172 Card=1074 Bytes=45108) 16 8 TABLE ACCESS (BY INDEX ROWID) OF 'LEASE_CONTACT' ( TABLE) (Cost=3 Card=1 Bytes=23) 17 16 INDEX (RANGE SCAN) OF 'FK_LEASECONTACT_CONTACT' (INDEX) (Cost=1 Card=1) 18 7 TABLE ACCESS (BY INDEX ROWID) OF 'LEASE' (TABLE) (Co st=1 Card=1 Bytes=35) 19 18 INDEX (UNIQUE SCAN) OF 'PK_LEASE' (INDEX (UNIQUE)) (Cost=0 Card=1) 20 5 TABLE ACCESS (BY INDEX ROWID) OF 'FAMIS_LEASE_LOCATION' (TABLE) (Cost=2 Card=1 Bytes=24) 21 20 INDEX (RANGE SCAN) OF 'FAMIS_LEASE_LOC_LEASE_FK' (INDE X) (Cost=1 Card=1) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 8484854 consistent gets 0 physical reads 0 redo size 34190 bytes sent via SQL*Net to client 9592 bytes received via SQL*Net from client 15 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 203 rows processed SQL>
Apologies for any inconvenience in the reading of the application. This is the query.
SELECT a.req_number, a.req_status, a.wo_number, a.wo_status, a.description, a.requestor, a.req_date, a.enter_date, a.pl_number, a.site, a.building, a.room, a.attribute2, b.emp_id, c.custom09, c.custom13, c.custom11, c.custom16 + 1 AS family_no, c.active_flag, e.leaseid, e.commdate, e.enddate, e.functional_status, f.site_code, CASE WHEN c.custom09 = 'Married' THEN 10 ELSE 0 END AS married, CASE WHEN (CASE WHEN (c.custom16 + 1) > 4 THEN 10 ELSE (c.custom16 + 1) * 2 END ) IS NULL THEN 0 ELSE (CASE WHEN (c.custom16 + 1) > 4 THEN 10 ELSE (c.custom16 + 1) * 2 END) END AS family, CASE WHEN c.custom11 = 'Canadian Management' THEN 8 ELSE 0 END AS job, CASE WHEN ( CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY') ) > 36 THEN 6 ELSE 0 END + CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY') ) > 36 THEN ( MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) - 36 ) / 24 ELSE MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) / 24 END ) IS NULL THEN 0 ELSE ( CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY') ) > 36 THEN 6 ELSE 0 END + CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY') ) > 36 THEN ( MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) - 36 ) / 24 ELSE MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) / 24 END ) END AS hire, CASE WHEN MONTHS_BETWEEN (SYSDATE, a.req_date) * 4 > 10 THEN 10 ELSE MONTHS_BETWEEN (SYSDATE, a.req_date) * 4 END AS entered, CASE WHEN c.custom09 = 'Married' THEN 10 ELSE 0 END + CASE WHEN (CASE WHEN (c.custom16 + 1) > 4 THEN 10 ELSE (c.custom16 + 1) * 2 END ) IS NULL THEN 0 ELSE (CASE WHEN (c.custom16 + 1) > 4 THEN 10 ELSE (c.custom16 + 1) * 2 END ) END + CASE WHEN c.custom11 = 'Canadian Management' THEN 8 ELSE 0 END + CASE WHEN ( CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) > 36 THEN 6 ELSE 0 END + CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) > 36 THEN ( MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) - 36 ) / 24 ELSE MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) / 24 END ) IS NULL THEN 0 ELSE ( CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) > 36 THEN 6 ELSE 0 END + CASE WHEN MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) > 36 THEN ( MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) - 36 ) / 24 ELSE MONTHS_BETWEEN (SYSDATE, TO_DATE (c.custom13, 'MM/DD/YYYY' ) ) / 24 END ) END + CASE WHEN MONTHS_BETWEEN (SYSDATE, a.req_date) * 4 > 10 THEN 10 ELSE MONTHS_BETWEEN (SYSDATE, a.req_date) * 4 END + CASE WHEN a.attribute2 IS NULL THEN '0' ELSE a.attribute2 END AS total, CASE WHEN f.site_code IN ('AJ1', 'AJ2', 'AJ3', 'RG1') THEN f.building_code ELSE f.space_code END AS SPACE, CASE WHEN a.site IN ('AJ1', 'AJ2', 'AJ3', 'RG1') THEN a.building ELSE a.room END AS space_req, CASE WHEN a.pl_number = '002002001' THEN 'Villa to Villa' ELSE (CASE WHEN a.pl_number = '002002002' THEN 'Apartment to Villa' ELSE (CASE WHEN a.pl_number = '002002003' THEN 'Apartment to Apartment' ELSE 'Villa to Apartment' END ) END ) END AS TYPE, (SELECT MAX (g.req_date) FROM famis_req g WHERE g.req_date < a.req_date AND g.requestor_id = a.requestor_id AND g.pl_number IN ('002002001', '002002002', '002002003', '002002004') AND g.wo_status = 'CLOSED' GROUP BY g.requestor_id) AS last_move, (SELECT COUNT (g.req_number) FROM famis_req g WHERE g.req_date <> a.req_date AND g.requestor_id = a.requestor_id AND g.pl_number IN ('002002001', '002002002', '002002003', '002002004') AND g.req_status NOT IN ('REJECTED', 'CANCELED') GROUP BY g.requestor_id) AS requests FROM famis_req a JOIN famis_requestor b ON a.requestor_id = b.requestor_id JOIN fam_person c ON b.emp_id = c.person_code LEFT JOIN lease_contact d ON c.person_code = d.contact_id LEFT JOIN lease e ON d.leaseid = e.leaseid LEFT JOIN famis_lease_location f ON e.leaseid = f.lease_code WHERE site <> 'CNAQ1' AND pl_number IN ('002002001', '002002002', '002002003', '002002004') AND (a.enter_date < e.enddate OR e.enddate IS NULL) AND (e.functional_status = 'OCCUPIED' OR e.functional_status IS NULL)
Thank you.
It is difficult to read anything not formatted output of the explain plan.
In any case, there is a hughe number of becomes coherent.
I'm just guessing that the reason might be the two groups of subqueries.
You can try to replace them with
1 Inline views or subquery (with article) plants which are connected to the result set
or
2 analysis functions
Here is an example of the latter approach. You can try if this changes something (after make sure you that they lead to correct results).
, max (case when a.wo_status = 'CLOSED' then a.req_date any other purpose) over (partition by a.requestor_id of a.req_date order
range between unbounded preceding and interval "0.1"(seconde précédant) as last_move "."
, count (case when not in a.req_status ('DENIED', 'CANCELLED') then a.req_number any other purpose))
a.requestor_id partition)
-count (case when not in a.req_status ('DENIED', 'CANCELLED') then a.req_number any other purpose))
partition a.requestor_id, a.req_date) as applications
Note that I assume that req_date is of date data type. If it is of type timestamp, the interval should be adapted.
-
How many times can I use a variable binding in a query of the VO?
Is it possible that I can use a variable binding in a query of VO just once?
I test a query that keeps throwing the Houston-27122 error by pressing the application module tester. I tried to limit the problem to the simplest possible case, and it seems that the error is caused by the fact that I use the same variable bind two or more times.
When the query looks like this:
I have run, enter 'x' and it returns me the result.
When I change to:
I have run, enter the value
and immediately get the error
The same thing in sqlplus runs without problem:
My version of JDev is build JDEVADF_11.1.1.9.0_GENERIC_150314.0718.6673
Please, advise.
P. S. where can I find documentation queries are supported in your? In particular, I'm interested if I can use WITH the clause. There seems to be some confusion on this matter (see, for example, Oracle SQL WITH clause support - JDeveloper and ADF)
Thank you.
It depends on:
Open your VO in JDev and go the the query page.
In the lower part, there is a drop down 'link type', it is usually set to "JDBC-positional. In this case, you will need to provide the bind value for each occurrence of the variable binding separately.
You could change that to "named" (don't remember the exact name). But beware, this will also affect all relatioships master retail to others your. I think that this is not a good idea to change the style of binding to a single VO.
Good bye
DPT
-
If var! = NULL or if the variable is not NULL which is more correct?
Hello Experts
Which of the following is better?
Also when assign us a variable (type nvarchar) null including notation should we use?new_address = NULL;
or
new_address = ";
declare
new_address ADDRESS. ADDRESS TYPE %;
Startnew_address: = 'a ';
If new_address! = NULL then
dbms_output.put_line(new_address||) e DO ');
end if;end;
declare
new_address ADDRESS. ADDRESS TYPE %;
Startnew_address: = 'a ';
If new_address is not NULL then
dbms_output.put_line(new_address||) e DO ');
end if;end;
Thank you
NULL is unknown.
NULL = false NULL
NULL! = NULL also false
----
Ramin Hashimzade
-
problem with bind variables in the SQL query view object
Hi all
I use JDev 11.1.2.4.0.
I have a problem with bind variables in the SQL query view object.
This is my original SQL
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929') group by t.legertype_id
In my view .xml object query tab, I am writing this
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in :dddd group by t.legertype_id
Davis here is a variable of Type liaison: String, updatable and necessary.
I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.
But failed. The view object retrieves 0 line after that I run.
Why?
Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')
A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.
Timo
-
Hello.
I have 2 images.
1 framework for intro where the user can launch the game and game´s properties set.
2nd image to select the level.
When I use nextFrame() on 1st frame should I use pourla = null for all instances
who are on stage? Including instances that have been on scene not through code, but instances that have been
on stage without code?
And, in the 2nd West frame a button when you press it s moving the game to the first image again.So, what should I do for instances that have been added on stage not through code prior to calling nextFrame()?
I have to leave the bodies that they (not their setting to null or not to uninstall applications with removeChild) so when the game comes back to the first image they are there still?
Thank you
I'd leave them as they are.
-
How does whitespace or null values or characters set effect set in the query?
Hi all
I have a question about client side Oracle database tools. I have Oracle 11g installed on the server and I use PL/SQL developer tool to retrieve information from the server and then I copy paste this query in PL SQL Developer my company built in box of function of the application that executes the same query as client tools and the results.
When I write the request by spaces of the Tools client-side IE the PL/SQL developer tool and copy paste at my request of builtin company gives slow down me execution, but if I remove the white of the query space by copying the application of PL/SQL developer(client side tool) to Notepad first and then copy back at my request and gives me a faster execution.
For example:
Original Request: with whitespace
Select
*
Of
Double
Ask without spaces faster tracks:
Select * twice;
I want to the reason behind this slow execution and also if you could explain in detail would be great that I am no expert oracle.
Also, I wanted to know that character set parameters from the client side tools slow running query? As I copy the request of PL/SQL developer tool
Thank you
HP
HP, I have has been suggest you determine if the difference in performance is due to how the application prepares and processes SQL or if the difference is in Oracle. If you can duplicate the issue in Oracle using SQLPLus then you can use the Oracle tools such as autotrace, SQL, trace etc... to determine how Oracle handles each request. On the other hand if the time of execution in SQLPLus is the same then you know that the problem lies in the application. Depending on whether you have access to the source you can or will not be able to track down the issue and resolve it. Otherwise always paste the capture into the plan text and edit it to remove the unnecessary lines before copying them the text into your application tool.
- -
HTH - Mark D Powell.
-
Bind the Variable in a dynamic query
The procedure below uses a variable binding for the deptno and run it with a ref cursor The expected result is to display the ename from EMP for the deptno passed for the p_deptno parameter, but the procedure fails with an exception.
CREATE OR REPLACE PROCEDURE dynamic_query(p_deptno NUMBER) AS lv_deptno number(4); -- l_lookup_type VARCHAR2(30):='PBAMERICAS_CO'; lv_query VARCHAR2(15000) :=' SELECT ename,''Year'' from emp where deptno='|| p_deptno; lv_cursor SYS_REFCURSOR; lv_lookup VARCHAR2(20); lv_emp_rec emp%rowtype; lv_ename VARCHAR2(10); lv_year VARCHAR2(10); BEGIN dbms_output.put_line(lv_query); OPEN lv_cursor FOR lv_query USING p_deptno ; Loop FETCH lv_cursor INTO lv_ename,lv_year; dbms_output.put_line(lv_ename || ',' ||lv_year); EXIT WHEN lv_cursor%NOTFOUND; END LOOP; CLOSE lv_cursor; END dynamic_query;
SQL> exec dynamic_query(10); SELECT ename,'Year' from emp where deptno=10 BEGIN dynamic_query(10); END; * ERROR at line 1: ORA-01006: bind variable does not exist ORA-06512: at "APPS.DYNAMIC_QUERY", line 13 ORA-06512: at line 1
I can change the code slightly and change the where clause to work but wanted to know what am I did wrong which makes the procedure fails with the above code.
CREATE OR REPLACE PROCEDURE APPS.dynamic_query(p_deptno NUMBER) AS lv_deptno number(4); lv_query VARCHAR2(15000) :=' SELECT ename,''Year'' from emp ' ; lv_cursor SYS_REFCURSOR; lv_lookup VARCHAR2(20); lv_emp_rec emp%rowtype; lv_ename VARCHAR2(10); lv_year VARCHAR2(10); BEGIN IF p_deptno IS NOT NULL THEN lv_query := lv_query || ' Where deptno =' || TO_CHAR(p_deptno); END IF; dbms_output.put_line(lv_query); OPEN lv_cursor FOR lv_query ; Loop FETCH lv_cursor INTO lv_ename,lv_year; dbms_output.put_line(lv_ename || ',' ||lv_year); EXIT WHEN lv_cursor%NOTFOUND; END LOOP; CLOSE lv_cursor; END dynamic_query; /
PS: I use the table EMP for this example includes so not CREATE TABLE and INSERT.
The procedure below uses a variable binding
No, it isn't.
You're just concatenation of the value of p_deptno in the query, such as a literal.
It's using a variable binding:
lv_query VARCHAR2 (15000): = ' 'year', SELECT ename from emp where deptno =: 1';
Then, the variable may be correctly bound (by post) via the USING clause.
-
lov automatic setting of null at the click of a button.
Hi Experts ADF,
JDeveloper 12.1.3.0.0
I have a read-only VO as below which is dragged as a selectone choice. Do autosubmit = 'true '. I also have a valueChangeListener. In the valueChangeListner value, I'll put in an instance variable.
And I have an Add button that partial shipment is set to true. But when the click on the Add button, inside actionListener, I get the value null for the instance variable.
When I select a value, select a choice, I am able to see the value of valueChangeListener. The valueChangeListener inside I'll highlight selectedValue = valueChangeEvent.getNewValue;
After I click on the Add button, in the actionListener I get selectedValue as null.
Note: -.
selectedValue is a variable instance with the getter and setter.
The taskflow scope is backingbeanscope.
Read only Vo:-select DepartmentId, DepartmentName from departments dragged like a selectonechoice.
Thank you
Roy
Instead of the instance variable, save the value of the variable def page, as described here:
http://andrejusb.blogspot.com/2011/10/page-definition-variables-to-store.html
on this path, the value will survive another request
-
How not to display variable binding in the query ADF search panel?
Hello, I use JDeveloper 11.1.2.3.0.
I have a variable binding in my VO, (* required) that I use in the sql query. I put the value of this variable to link through the groovy expression so I don't have to manually put through my page. It works fine but the problem is that it appears in the query ADF Panel that I created in my page. To do this, I created a ViewCriteria and I've specified to display only 3 (other) fields for the simple search. Apart from the selected 3 variable bind shows here again because its value is set. I tried to remove the ' * required ' of the variable binding in the original Version, but in this case I have problems with my sql query.
Does anyone know how this variable is not to display in the Panel request ADF?
Thank you
Has tried to define the binding to bee hidden variable?
Controll tips, hint of display = hide
-
Problem with variable setting after some validation in RTF
Hi all
I have a requiremnt to set a variable value after some validation in RTF, I tried using the way below.
? xdofx:if (($p_email n'est pas null ou $p_fax n'est pas null) and $p_ver is null and S_C = 'ABC')? >
<? xdoxslt:set_variable($_XDOCTX,'SC','LIST_PRI')? > <? end if? >
Well, I need to set the 'SC' variable with the value "LIST_PRI" once the above if condition satisfied. then I tried to get the value as below:
<? If: xdoxslt:get_variable($_XDOCTX,_'SC') = 'LIST_PRI? ' > <? L? > <? end if? >
But it does not work with education and set_variable instruction, if you please help me on this
Thank youChange the code as follows and give it a try.
Or send the xml and RTF file to bipuser@gmail and I'll take a look. Update this thread to let me know if you sent me the files.
Thank you
Bipuser -
How to pass variables bind to select query
Hello
I use jdeveloper 11.1.1.6.0 version.
My use case is - I want to change the settings of the select clause dynamically
For example
My view of object query is as follows:
where FN_GET_ALFA_MESSAGE_DETAIL_SEQ is the name of function.SELECT FN_GET_ALFA_MESSAGE_DETAIL_SEQ(1,2) FROM DUAL
I want to pass parameters at runtime instead of 1 and 2 as a and b.
So, how can I pass dynamic parameters (bind variables) in the display object during execution of the select clause.
Published by: 925410 on January 7, 2013 18:25Hello
You may have two bind variables (note that bind variables are always preceded by a colon in the query) as below:
SELECT FN_GET_ALFA_MESSAGE_DETAIL_SEQ(:bind_var1,:bind_var2) FROM DUAL
Then, follow the following steps:
1. create two variables of the same names liaison in the variables section of Bind in the query tab of the VO
2 2 disposer have a method in the class Impl of Module of the Application and within this method, pass the values of these bind variables as below:Impl vo = null; vo = get 1(); vo.setNamedWhereClauseParam("bind_var1", ); vo.setNamedWhereClauseParam("bind_var2", ); vo.executeQuery(); 3 expose this method of the the module interface of the client Application, then the method will be visible in the section data when updating controls.
4 use the method to run the original Version of data controls you want :)Kind regards
Seddik -
the variable name of database query to SQL Server using the Oracle database link
Hi all
I have an ApEx 4.1 application running on x 64 (11.2.0.1) 11g on Windows Server 2008 x 64, and I have a few points of data integration with SQL (2005 and 2008) server that I need to create. I have configured the database with dg4odbc link and it works perfectly... I can run queries on the SQL Server database without any problem using the database link.
However, there is a scenario where the SQL Server database name is dynamic, and I need to generate on the fly in a PL/SQL block and then use it in a query dynamic SQL (all this in the ApEx). It of wherever I meet problems... when I asked the default database that is based on the ODBC connection and I don't have to specify the name of the database, no problem. But when I need access to one of the several other databases by default, I received the error "invalid table.
It works well:* (note that 'fv' is the name of my database link)
v_query1: = "select 'Release Date' from dbo." Schedules@FV where dbo. Annexes. "" SchedID "=: calendar";
EXECUTE IMMEDIATE v_query1 in rel_date using the grid.
I then take this rel_date variable, convert a varchar2 (rel_date_char), then use it as the name of the database in the following query...
_ It returns an error(error ORA-00903: invalid table name)
v_query2: = "select"PARTNO": rel_date_char.dbo.ProdDetails@fv where 'SchedID' =: calendar and"UnitID"=: unit"
and 'MasterKey' =: master and "ParentKey" =: parent';
EXECUTE IMMEDIATE v_query2 in part_number using planning, master, parent unit;
I also tried using all of the following conditions without result:
"select"PARTNO"of" | : rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"of" | rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"of" | @rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"in @rel_date_char.dbo.ProdDetails @fv where 'SchedID'..."
Is it possible to do it in PL/SQL?
Thanks for any help!
-Ian C.
Published by: 946532 on July 15, 2012 19:45Just did a test using passthrough:
SQL > set serveroutput on
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5. start
c: 6 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, "select count (*) from EMP");
8 LOOP
9 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
10 output when nr = 0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
12 dbms_output.put_line (val);
13 end of loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
15 end;
16.
24576PL/SQL procedure successfully completed.
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5. start
c: 6 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, ' select count (*) from dbo.) EMP');
8 LOOP
9 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
10 output when nr = 0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
12 dbms_output.put_line (val);
13 end of loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
15 end;
16.
24576PL/SQL procedure successfully completed.
So all 3 ways work for me.
Published by: kgronau on July 23, 2012 10:08
Now, using the variables to make the selection:
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5 tabname varchar2 (20): = 'EMP ';
6 ownr varchar2 (20): = "dbo."
7 dbname varchar2 (20): = "door";
Start 8
c: 9 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
10 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, ' SELECT count (*) FROM ': dbname: '.) ' || ownr | '.'|| tabname | ") ;
11 LOOP
12 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
13 when the exit nr = 0;
14 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
15 dbms_output.put_line (val);
16 end loop;
17 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
18 end;
19.
24576PL/SQL procedure successfully completed.
=> instead of executing the statement using the "execute Immediate" we use the PASTHROUGH package to pass the statement to SQL Server.
Published by: kgronau on July 23, 2012 10:10
-
ADF BC to SQL Server connection with variable set to View object
Hello world
I develop a BPM Application using Oracle BPM 11.1.1.5.0 and JDeveloper 11.1.1.5.0
Following the thread of the link below, since it is a new topic, I decided to open a new thread.
what I try to do is to get a record from a database and show to the user on the initiator of the UI using ADF BC and not the database adapter.
I have worked with ADF BC and display objects to get all the lines and show them to the user in a table.
However, when I try to run the same query in the parameterized shape just return a single line, I hit a wall.
In short, my problem is like this:
I have an Application Module which has an entity object and a display object.
My database is SQL Server 2008.
When I try to create a new read only view object to return a single line I face the problem.
The query that I have in the section my display object query is like this:
which works very well.select * from dbo.Employee where EmployeeCode= 99
However when I set a variable input_code, linking for example and change the query as follows it won't validate.
He just telling meselect * from dbo.Employee where EmployeeCode= :input_code
>
incorrect syntax near ': '.
>
I don't know if this has to do with my Oracle DB is not or I'm doing something wrong.
Can someone help me with this you problem?
Thanks in advanceThe problem is that you are using 'Oracle named' style for the binding of parameter in the SQL statement. However, this style of binding is specific Oracle. You must use "Positional JDBC" style of binding with MS SQL Server:
select * from dbo.Employee where EmployeeCode= ?
(The style of binding is specified in the query to the dialog box Definition VO Editor pane).
If you specify the positional style of binding "JDBC", another field called 'Linking the Positions' will appear in the definitions pane variables bind VO. You will be able to specify it is the position of the particular parameter in the binding variable VO query bound to. (the position of the bond index is 0-based).
Dimitar
Maybe you are looking for
-
The windows are constantly flashing and goes black. I'm almost ready to go back to IE.
The interface is slow accepting typing. Menu drop down windows go black and I have to point them to see the content sometimes, I take the bad selectiondue for the flashing window and shift in time
-
Buttons of switch Sound wireless not working not
Hello I just started my computer (pavilion dv6-1120ek) today & the touch Board no longer works. The light is on, but does not respond to my touch. Now, I can only control sound through its Panel in Windows, but the real problem is the WiFi, when I tr
-
How do I enter usb storage away from home?
I would like to access my usb storage away from home since Ios and android devices I googled and have not been able to find info. Thanks adavance.
-
install the black print cartridge
My HP Laserjet M1522n MFP changed today. Since then, the Panel was an error flashing and showing the message "install black cartridge." I have never installed a black cartridge - is NOT a color printer. The toner cartridge needs to be replaced. H
-
Missing when going back 10 of Windows to Windows 7 Language bar
After the start menu works is not in Windows 10, I went to Windows 7. Then the language bar does not appear. I can't use my IME more. I tried to repair corrupted files, accounts, and everything in the previous assignments. Nothing works! And I still