Data Services Designer Query tranform dynamic where clause or another way
I have an XML source that has 5 fields. These fields are used to query 4 different SQL table data sources and do an AND inthe where clause of a query transform. Works well if all 5 fields in the xml have data. If one (or more) are blank, then it runs the where checking for blank matches and gives no results. What I want to do is if a field is blank, do not use it in the where clause. Could this be an outer join setup? Issue is that if there is a PhoneNumber input, then to be considered a result, there must be a PhoneNumber match on potential result records...
I have an XML source that has 5 fields. These fields are used to query 4 different SQL table data sources and do an AND inthe where clause of a query transform. Works well if all 5 fields in the xml have data. If one (or more) are blank, then it runs the where checking for blank matches and gives no results. What I want to do is if a field is blank, do not use it in the where clause. Could this be an outer join setup? Issue is that if there is a PhoneNumber input, then to be considered a result, there must be a PhoneNumber match on potential result records...
Similar Messages
-
Less than or eual to Date issue in dynamic where clause
Dear All,
I have a requirement to search the leave balance information, here date as a parameter. When ever we pass the date as a parameter it should be display all the leave balance information till the parameter date.
Steps I have followed to achieve this requirement
• Created the VO and query as follows
SELECT trunc(paa.creation_date) creation_date, paa.date_start, paa.date_end,
SYSDATE duty_resumption_date, paa.absence_days leave_deducted,
paa.absence_days leave_added, 'Leave Deucted' detail,
paa.absence_days balance_remaining,
fu.user_id
FROM per_absence_attendances paa, per_all_people_f papf, fnd_user fu
WHERE 1 = 1
AND papf.person_id = paa.person_id
AND papf.person_id = fu.employee_id
AND fu.user_id=fnd_profile.value('USER_ID')
And trunc(paa.creation_date) <= TO_DATE((to_char(trunc(to_date(:1)),'DD-MON-YYYY') ),'DD-MON-YYYY')
• Created the Advance Search Region
• In the controller of the region, I have captured the go button logic and setting the dynamic where clause as below
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
OAQueryBean oaquerybean = (OAQueryBean)webBean.findIndexedChildRecursive("QueryRN");
if (pageContext.getParameter(oaquerybean.getGoButtonName()) != null)
OAViewObject oaviewobject = (OAViewObject)am.findViewObject("XXLeaveBalanceVO");
String creationDate = pageContext.getParameter("CreationDate");
oaviewobject.setWhereClauseParam(0,creationDate);
oaviewobject.executeQuery();
• But this where condition is working equal condition to the parameter but it is not working less than condition.
• When I am running the VO query in Toad it is working the less than condition.
Please help me out to resolve this issue.
Thanks in Advance,
SaiDear Kumar,
I have changed my vo query as you suggested, now the equal condition also not working and I am getting the following error message
JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT trunc(paa.creation_date) creation_date, paa.date_start, paa.date_end,
SYSDATE duty_resumption_date, paa.absence_days leave_deducted,
paa.absence_days leave_added, 'Leave Deucted' detail,
paa.absence_days balance_remaining,
fu.user_id
FROM per_absence_attendances paa, per_all_people_f papf, fnd_user fu
WHERE papf.person_id = paa.person_id
AND papf.person_id = fu.employee_id
AND fu.user_id=fnd_profile.value('USER_ID')
And trunc(to_char(paa.creation_date) ,'dd-MMM-yyyy')<= trunc(to_char(:1, 'dd-MMM-yyyy'))) QRSLT WHERE (( CREATION_DATE = :2 )) ORDER BY CREATION_DATE ASC
at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:72)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
java.sql.SQLException: ORA-01722: invalid number
Thanks,
Sai -
Dynamic where clause in select query
Hi
I'm trying for a dynamic query and in the dynamic where clause i'm checking a field for constant.....for instance if i wanna to use WERKS EQ '0478' how to declare it in dync where clause. i tried for the following:
SELECT (TAB_FIELD) INTO TABLE DITAB UP TO 10 ROWS FROM (TAB_NAME) WHERE (CONDI).
heree CONDI = 'werks eq 0287' . in this case the query fails as the werks shud be equal to '0287' and not just 0287. How to handle this? i tried for the following
CONDI = 'werks eq " '0287' " ' but no luck as it is not a valid stmt as i knew.hi prabhu,
this is how u select dynamically...
DATA: COND(72) TYPE C,
ITAB LIKE TABLE OF COND.
PARAMETERS: CITY1(10) TYPE C, CITY2(10) TYPE C.
DATA WA TYPE SPFLI-CITYFROM.
CONCATENATE 'CITYFROM = ''' CITY1 '''' INTO COND.
APPEND COND TO ITAB.
CONCATENATE 'OR CITYFROM = ''' CITY2 '''' INTO COND.
APPEND COND TO ITAB.
CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO COND.
APPEND COND TO ITAB.
LOOP AT ITAB INTO COND.
WRITE COND.
ENDLOOP.
SKIP.
SELECT CITYFROM
INTO WA
FROM SPFLI
WHERE (ITAB).
WRITE / WA.
ENDSELECT.
regards,
sohi -
Dynamic where clause for generated reports (designer 6.0)
Hi,
I'd like to include dynamic where clause into my reports. It's easy with report builder by using bind parameter in a query where clause (¶m where param is a parameter in which you fill a VARACHAR2 to complete default where clause).
Problem with designer 6.0 report generator is that he failed while trying to parse the query statement he contructs if there is a bind parameter within.
How can I manage this problem ?
Thanks for answers
RomainHi Divya,
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no P_WHERE_CLAUSE= '||Where_Clause);Instead of using SET_REPORT_OBJECT_PROPERTY built in try using ADD_PARAMETER built in which
adds parameters to a parameter list. Each parameter consists of a key, its type, and an associated value.
v_rep := RUN_REPORT_OBJECT(repid); and instead of using RUN_REPORT_OBJECT try using RUN_PRODUCT.
DECLARE
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
Where_Clause Varchar2(4000) := null ;
*Pl_Id ParamList;*
*Pl_Name VARCHAR2(10) := 'param_list';*
BEGIN
Where_Clause := 'Where '||Create_Where_Clause();
message(Where_Clause);
message(' ');
pl_id := Get_Parameter_List(pl_name);
IF not Id_Null(pl_id) THEN
Destroy_Parameter_List(pl_id);
END IF;
pl_id := Create_Parameter_List(pl_name);
Add_Parameter(pl_id,'P_WHERE_CLAUSE', TEXT_PARAMETER, WHERE_CLAUSE);
Add_Parameter(pl_id,'PARAMFORM',TEXT_PARAMETER,'NO');
-- Add_Parameter(pl_id,'ANY_OTHER_PARAMETER', TEXT_PARAMETER, 'VALUE FOR OTHER PARAMETER');
RUN_PRODUCT(REPORTS,'REPORT_NAME', ASYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
END;Also you can add as many User created or System parameters as you want using add_parameter. Updated the code to add PARAMFORM parameter.
Best Regards
Arif Khadas
Edited by: Arif Khadas on Mar 15, 2011 9:31 AM -
Dynamic where clause in my query
I am using a view
select * from vw_pt_inv_customer
My requirement is have a web page where users can search for customers by filling in a form which has the following feilds: - User can fill in the form with all the feilds or not. I want a dynamic where clause.. how can i get this work for me?
Title
Firstname
Surname
Address1
Address2
Postcode
Telephone No879796 wrote:
I am using a view
select * from vw_pt_inv_customer
My requirement is have a web page What web frame work is used? Apex? Something else?
where users can search for customers by filling in a form which has the following feilds: - User can fill in the form with all the feilds or not. I want a dynamic where clause.. how can i get this work for me?Dynamic where clauses are a Very Bad Idea (tm).
And having an open ended search function on a web page is also not a great idea.
If you are using Apex, the for performance (and even query flexibility) it will be better creating a separate reporting region for each unique query. A boolean rendering condition checks the existing bind variables in order to determine if that specific reporting region should be executed.
This results in a reporting region having a proper and dedicated SQL query (no hacking of the where clause) and that region only being rendered for the proper combination of supplied filter criteria.
A slightly more complex, but more flexible approach, is using a generic reporting region that calls a PL/SQL function that creates returns the SQL query for execution and rendering. The approach to this is very similar to constructing a SQL ref cursor (dynamically) for a client. The only difference is that instead of creating the actual ref cursor, the code simply needs to return the SQL source code statement - with bind variables. The Apex run-time does the rest (does the binds and execution and rendering).
If you are not using Apex - you should still consider these approaches. And not hacking a single SQL to cater for all different types of filter conditions. -
How to add a dynamic where clause for a sql based VO with group by query?
Hi,
Here is my case, I have a sql query based VO with the query like "select status, count(*) StatusCount from my_table group by status". Now I used the following java code trying to dynamically add the where clause to my VO to filter the rows based the type attribute in my DB table.
vo.setWhereClause("type='MyType1' ");
vo.executeQuery();
Then I got the sql syntax error. Looks like the ADF has added the where clause to the end of my sql so my sql becomes "select status, count(*) StatusCount from my_table group by status where type='MyType1' ". But what I expected was the correct syntax "select status, count(*) StatusCount from my_table where type='MyType1' group by status".
Does anyone know if this is an ADF bug? Or is there any other way to achieve my goal?
Thanks,
Chunyang
Edited by: Chunyang on Dec 13, 2012 9:09 PMHi,
When you use setWhereClause on the VO, it is applied on top of the VO query. I.e, assume your VO has the following query.
select empno, ename from empNow, if you apply the where clause programatically, only the two attributes that you are using in the select statement could be used. I.e
select * from (select empno, ename from emp) where ename='KING' - VALID
select * from (select empno, ename from emp) where deptno=10 - INVALID (because the inner query - the one you've defined as query for your vo does not have deptno attribute selected)If you would need to set a dynamic where clause, you need to make them available in your select statement / use bind variables.
-Arun -
ADF dynamic where clause for VO query using BC
I'm hoping someone can help me out. I have a read only view object that I want to filter results based on some user choices. For example the user may want to see all results or they may only want to see a much smaller subset. This is for an error dashboard, the smaller subset maybe by application or maybe by application and by error severity. I think I can use a dynamic where clause but I'm not sure, Can someone get me started down the right path, or post an example that I can see.
Hi user,
You can use a dynamic where clause for this, but maybe there is a more practical option. Maybe you can have a fixed where clause, but using a bind parameter, like:
vo.application like :applicationParam. This makes an executeWithParams method available that you can call from your page, and use in the bindings. This parameter you can populate with the results of for example a poplist, with a default value of '%'.
When you do want to use a dynamic where clause, you will need to add a method to the java code of your application module, and make this method available for the client. In this method, you can use findViewObject to retrieve your VO, use VO.setWhereClause to set the whereclause to what you want, and then call VO.executeQuery. This method can then again be called from the page.
Success,
Jeroen van Veldhuizen -
Dynamic Where clause in 4.6C [Literals allowed but not variables]
Good afternoon-
We have a dynamic select statement that works perfectly in 4.7 ext 2, but is causing a short dump in 4.6C. The error in the short dump says:
The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
statement containing a WHERE condition of the form WHERE (itab) or
WHERE ... AND (itab). The part of the WHERE condition specified at
runtime in the internal table itab contains an invalid
value "HDR_COMP_CODE". Literals are allowed as values, but not variables.
HDR_COMP_CODE is in incoming parameter to the function module that is calling this code. It is of type BKPF-BUKRS.
Here is the code:
DATA: BEGIN OF L_WHERE_CLAUSE OCCURS 0,
TEXT_LINE(60) TYPE C,
END OF L_WHERE_CLAUSE.
CLEAR L_WHERE_CLAUSE.
IF NOT HDR_COMP_CODE IS INITIAL.
SELECT SINGLE KTOPL
INTO LV_KTOPL
FROM T001
WHERE BUKRS = HDR_COMP_CODE.
L_WHERE_CLAUSE = 'B~BUKRS = HDR_COMP_CODE'.
APPEND L_WHERE_CLAUSE.
CLEAR L_WHERE_CLAUSE.
L_WHERE_CLAUSE = 'AND'.
APPEND L_WHERE_CLAUSE.
CLEAR L_WHERE_CLAUSE.
L_WHERE_CLAUSE = 'T~KTOPL = LV_KTOPL'.
APPEND L_WHERE_CLAUSE.
CLEAR L_WHERE_CLAUSE.
L_WHERE_CLAUSE = 'AND'.
APPEND L_WHERE_CLAUSE.
CLEAR L_WHERE_CLAUSE.
ENDIF.
L_WHERE_CLAUSE = 'T~SPRAS = SY-LANGU'.
APPEND L_WHERE_CLAUSE.
CLEAR L_WHERE_CLAUSE.
SELECT BSAKNR TTXT50
INTO (LT_GL_ACCOUNT_DATA-GL_ACCOUNT, LT_GL_ACCOUNT_DATA-DESCRIPTION)
FROM SKB1 AS B INNER JOIN SKAT AS T
ON TSAKNR = BSAKNR
WHERE (L_WHERE_CLAUSE).
APPEND LT_GL_ACCOUNT_DATA.
CLEAR LT_GL_ACCOUNT_DATA.
ENDSELECT.
This EXACT query works in 4.7, has anyone run into this, or can they tell me why I might be getting the error?
Thanks,
AndyWell, in this case, unless I'm missing something, you do not requre a dynamic WHERE clause. You can use RANGES instead.
report zrich_0001.
*DATA: BEGIN OF L_WHERE_CLAUSE OCCURS 0,
*TEXT_LINE(60) TYPE C,
*END OF L_WHERE_CLAUSE.
ranges: r_bukrs for t001-bukrs.
ranges: r_ktopl for t001-ktopl.
*CLEAR L_WHERE_CLAUSE.
IF NOT HDR_COMP_CODE IS INITIAL.
clear r_bukrs. refresh r_bukrs.
r_bukrs-sign = 'I'.
r_bukrs-option = 'EQ'.
r_bukrs-low = hdr_comp_code.
append r_bukrs.
SELECT SINGLE KTOPL
INTO LV_KTOPL
FROM T001
WHERE BUKRS = HDR_COMP_CODE.
clear r_ktopl. refresh r_ktopl.
r_ktopl-sign = 'I'.
r_ktopl-option = 'EQ'.
r_ktopl-low = lv_ktopl.
append r_ktopl.
*L_WHERE_CLAUSE = 'B~BUKRS = HDR_COMP_CODE'.
*APPEND L_WHERE_CLAUSE.
*CLEAR L_WHERE_CLAUSE.
*L_WHERE_CLAUSE = 'AND'.
*APPEND L_WHERE_CLAUSE.
*CLEAR L_WHERE_CLAUSE.
*L_WHERE_CLAUSE = 'T~KTOPL = LV_KTOPL'.
*APPEND L_WHERE_CLAUSE.
*CLEAR L_WHERE_CLAUSE.
*L_WHERE_CLAUSE = 'AND'.
*APPEND L_WHERE_CLAUSE.
*CLEAR L_WHERE_CLAUSE.
ENDIF.
*L_WHERE_CLAUSE = 'T~SPRAS = SY-LANGU'.
*APPEND L_WHERE_CLAUSE.
*CLEAR L_WHERE_CLAUSE.
SELECT B~SAKNR T~TXT50
INTO (LT_GL_ACCOUNT_DATA-GL_ACCOUNT, LT_GL_ACCOUNT_DATA-DESCRIPTION)
FROM SKB1 AS B INNER JOIN SKAT AS T
ON T~SAKNR = B~SAKNR
WHERE b~bukrs in r_bukrs
and t~ktopl in r_ktopl.
APPEND LT_GL_ACCOUNT_DATA.
CLEAR LT_GL_ACCOUNT_DATA.
ENDSELECT.
Regards,
Rich Heilman -
Dynamic select query with dynamic where condition
Hi all,
I want to use the dynamic select query with dynamic where condition. For that I used the below code but I am getting dump when using this code.
Please advice, if there is any other way to achieve this requirement.
Thanks,
Sanket Sethi
Code***************
PARAMETERS: p_tabnam TYPE tabname,
p_selfl1 TYPE edpline,
p_value TYPE edpline,
p_where1 TYPE edpline .
DATA: lt_where TYPE TABLE OF edpline,
lt_sel_list TYPE TABLE OF edpline,
l_wa_name TYPE string,
ls_where TYPE edpline,
l_having TYPE string,
dref TYPE REF TO data,
itab_type TYPE REF TO cl_abap_tabledescr,
struct_type TYPE REF TO cl_abap_structdescr,
elem_type TYPE REF TO cl_abap_elemdescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
comp_fld TYPE cl_abap_structdescr=>component.
TYPES: f_count TYPE i.
FIELD-SYMBOLS : <lt_outtab> TYPE ANY TABLE,
* <ls_outtab> TYPE ANY,
<l_fld> TYPE ANY.
struct_type ?= cl_abap_typedescr=>describe_by_name( p_tabnam ).
elem_type ?= cl_abap_elemdescr=>describe_by_name( 'F_COUNT' ).
comp_tab = struct_type->get_components( ).
comp_fld-name = 'F_COUNT'.
comp_fld-type = elem_type.
APPEND comp_fld TO comp_tab.
struct_type = cl_abap_structdescr=>create( comp_tab ).
itab_type = cl_abap_tabledescr=>create( struct_type ).
l_wa_name = 'l_WA'.
CREATE DATA dref TYPE HANDLE itab_type.
ASSIGN dref->* TO <lt_outtab>.
*CREATE DATA dref TYPE HANDLE struct_type.
*ASSIGN dref->* TO <ls_outtab>.
* Creation of the selection fields
APPEND p_selfl1 TO lt_sel_list.
APPEND 'COUNT(*) AS F_COUNT' TO lt_sel_list.
** Creation of the "where" clause
*CONCATENATE p_selfl1 '= '' p_value ''.'
* INTO ls_where
* SEPARATED BY space.
*APPEND ls_where TO lt_where.
* Creation of the "where" clause
APPEND p_where1 TO lt_where.
* Creation of the "having" clause
l_having = 'count(*) >= 1'.
* THE dynamic select
SELECT (lt_sel_list)
FROM (p_tabnam)
INTO CORRESPONDING FIELDS OF TABLE <lt_outtab>.
* WHERE (lt_where).Hi Sanket,
The above given logic of mine works for you, put the code in the If condition and try-
just like below:
IF NOT P_EBELN IS INITIAL.
lt_where = '& = ''&'' '.
REPLACE '&' WITH p_ebeln INTO lt_where.
REPLACE '&' WITH field_value INTO lt_where.
SELECT (lt_sel_list) INTO CORRESPONDING FIELDS OF TABLE <lt_outtab>
FROM (p_tabnam)
WHERE (lt_where).
ENDIF.
thanks\
Mahesh -
How to create VO with multiple dynamic where clauses on select with UNION?
I am trying to implement the View Object for the UNION query that looks like this:
select a,b,c...
from t1,t2,...
where dynamic_where_clause1
union all
select a,b,c,...
from t11,t12, ...
where dynamic_where_clause2
There are up to 60 input parameters that are used to generate dynamic where clauses. They are actually created by calling PL SQL function.
So far, I was not able to assign both where clauses to the view object. Is there a workable solution for this problem, besides resorting to programmatic View Object?
I understand that recommended way with UNIONs is to wrap both queries into a parent select:
select * from (
select a,b,c...
from t1,t2,...
where ... -- table relationship joints
union all
select a,b,c,...
from t11,t12, ...
where ... -- table relationship joints
) QRSLT
where dynamic_where_clause
Unfortunately this approach doesn't work here, since individual selects are producing unmanageable amount of data and resulting query takes forever to complete.I afraid I would not have any real benefits from using VO if I replace the entire query with every request. Actually, the performance may suffer.
I solved the problem by creating a POJO Data Control and invoking the custom select query from java. Not sure if it is the best approach to the problem, but implementation time is limited and it works.
Actually, this is not the first time I see the need to implement VO with complicated SQL like select with unions and dynamic pieces. It would be nice to find a solution and not resort to workarounds.
Edited by: viksicom on Aug 2, 2012 8:48 AM -
Passing values to Dynamic where clause as IN parameter - ADF
Hi,
I am trying to get the Dynamic where clause query output something like below,
select * from EMP where emp_id IN(200,203,204)
How to pass values from setWhereCluase(emp_id,????)
Thanks,I'd go about this a little differently (probably not the best way):
1. Create view object lk_department (lookup). In the query add a union with something like "select null as ID, 'All' as name' from dual;". This adds a null value that they can select by leaving the combo box on "All". Add a 'order by id" so the null value is the first one. When creating the combo box you want it set to navigation mode, so select the whole viewobject from the data palette rather a specific field.
2. Create a jTextField for the "Jobs" field.
3. Create an application module method that does something like:
public void filterEmployees(String job){
ViewObject vo_departments = findViewObject("lk_departments");
ViewObject vo_employees = findViewObject("employees");
String wc = "1 = 1 ";
String wc = " and job like '%"+job+"%'"
if (vo_departments.getCurrentRow().getAttribute("Id") != null) {wc += "and department_id = "+vo_departments.getCurrentRow().getAttribute("Id");}
vo_employees.setWhereClause(wc);
vo_employees.executeQuery();
this.sync;
4. In your Jclient app, you just need to call the method of your appmodule and insert the string from the textbox, using code similar to this:
AppModule b = (AppModule)panelBinding.getApplicationModule();
b.filterEmployees(jTextField.getText());
I didn't test this code, but that's how I go about the same thing. -
Hi,
I have code as below
Scenario1
FOR i in (Select .................... from table1 Where id in(select id from Sample_table where status='Submit'))
Loop
End loop;
Scenario2
FOR i in (Select .................... from table1 Where id in(select id from Sample_table where status='Saved'))
Loop
End loop;
Scenario3
FOR i in (Select .................... from table1 Where id in(select id from Sample_table where status='Inprogress'))
Loop
End loop;Query is same here but only chage is where clause
Total length of this query is exceeding varchar2 length. so i cant use variable to hold this query and append where clause dynamically.
Do we have any other method to change where clause dynamically?>
We have around 200 columns to select from multiple tables...Here I gave sample code...
so its exceeding length
>
So 200 columns at 30 bytes per column name is only 6000 bytes. That means the rest of the query is using over 26000 bytes: 260 lines of query if each line was 100 bytes long.
You need to rethink what you are doing. So far your queries are too big, your row-by-row processing is a terrible way to process data and repeating that process multiple times just aggravates the performance even more.
I can't imagine there is ANY justification for doing things that way.
Even if you HAD to do things that way you couldn't exceed the CLOB length so why aren't you using a CLOB variable?
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/openfor_statement.htm
>
OPEN-FOR StatementThe OPEN-FOR statement executes the SELECT statement associated with a cursor variable. It allocates database resources to process the statement, identifies the result set (the rows that meet the conditions), and positions the cursor variable before the first row in the result set.
With the optional USING clause, the OPEN-FOR statement processes a dynamic SELECT statement that returns multiple rows: it associates a cursor variable with the SELECT statement, executes the statement, identifies the result set, positions the cursor before the first row in the result set, and zeroes the rows-processed count kept by %ROWCOUNT.
dynamic_string
A string literal, string variable, or string expression that represents any SQL statement. It must be of type CHAR, VARCHAR2, or CLOB. -
Need a FM to convert into dynamic where clause
Hi all
I had a requirement in BI Extractor i need a FM to convert RSELECT into dynamic where clause query
Please help me
Regards
HiteshHi Dolly
code like this
day = date + 0(2)
month = date + 3(2)
year date + 6(4).
case month.
when '01'.
mon = 'january'.
when '02'.
mon= 'february'.
etc....
endcase.
concatenate day 'th' ' ' mon ' ' year into output.
write:/ output.
reward points to all helpful answers
kiran.M -
How to create dynamic where clause instead of pragmatically
Hi,
I'm using Jdev 11.1.2.2.0 and my requirement to create a two fields with search button to fetch data as adf table. User need to enter either of the field value and click search button to see his data.
So I created a sql query based view object with 2 bind variables (which are input params) & 2 view criteria (to create dynamically where clause) and then drag on to the page by ExecuteWithParams operation from data controls but couldnt work.
If anyone have idea to build dynamically please let me know.
AmarUser need to enter either of the field value and click search button to see his data.User need to enter either of the field value and click search button to see his data.
Hi Amar,
Is your requirement, creating a query panel with table??
Drag and drop the view criteria(Application Navigator>DataControls> AppModule >NamedCriteria> ViewCriteriaName ) onto the page.
In the context menu, select Query->ADFQueryPanel With Table.. That brings your necessary two columns and Search field with data represented as a table.
Harsha
Edited by: Harsha049 on Nov 28, 2012 3:51 PM -
JSP, Data Web Bean, BC4J: Setting the where clause of a View Object at run time
Hi,
I am trying to develop a data web bean in which the where clause of a View Object will be set at run time and the results of the query then displayed.
My BC4J components are located in one project while the coding for the data web bean is in another project. I used the following code bu t it does not work. Could you please let me know what I am doing wrong?
public void populateOSTable(int P_EmpId)
String m_whereString = "EmpView.EMP_ID = " + P_EmpId;
String m_OrderBy = "EmpView.EMP_NAME";
oracle.jbo.ApplicationModule appModule = null;
ViewObject vo = appModule.findApplicationModule("EMPBC.EMPAppModule").findViewObject("EMPBC.EMPView");
vo.setWhereClause(m_whereString);
vo.setOrderByClause(m_OrderBy);
vo.executeQuery();
vo.next();
String empName numAttrs = vo.getAttribute(EmpName);
System.out.println(empName);
Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
Here is how I have usually done mine:
1. In the JSP, use a RowsetNavigator bean to set the where clause and execute the query.
2. Use a custom web bean to process the results of the query (print to HTML).
for example:
<jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
<%
// get the parameter from the find form
String p = request.getParameter("p");
String s = request.getParameter("s");
// store the information for reference later
session.putValue("p", p);
session.putValue("s", s);
// initialize the app module and view object
rsn.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
// set the where clause string
String theclause = "presname = '" + p + "' AND slideno=" + s;
// set the where clause for the VO
rsn.getRowSet().getViewObject().setWhereClause(theclause);
rsn.getRowSet().getViewObject().executeQuery();
rsn.getRowSet().first();
%>
</jsp:useBean>
<jsp:useBean class="wt_bc.walkthruBean" id="wtb" scope="request" >
<%
// initialize the app module and VO
wtb.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
wtb.render();
%>
In this case, the render method of my custom web bean mostly gets some session variables, and prints various content depending on the session variable values.
Hope this helps.
</jsp:useBean><HR></BLOCKQUOTE>
Laura can you give the code of your walkthru bean? i wna't to initialize a viewobject, set the where clause and give that viewobject back to initialize my navigatorbar.
Nathalie
null
Maybe you are looking for
-
I want firefox 9 web print to print normal full pages
Firefox 9 fails Preview and Print Web Pages correctly Some web pages preview and print only on the top 1/3 of Letter paper, and cutoff the right half of the web page Other Web pages preview as too laarge BUT STILL print only on the top 1/3 of the pag
-
How can we use a PL/SQL item (an idex for exemple) in a PL/SQL function or procedure belonging to the same database schema ?
-
これまでPCI-6229を使用して信号出力と電圧入力をするviプログラムをLabVIEW7.1で使用しておりました. 久しぶりに使用しようとしたところ,次のエラーが表示されて動かなくなってしまいました. エラー89130 が次の場所で発生しました: DAQmx Write (Digital 1D Wfm NChan NSamp).vi そこで,Measurement and Automationでデバイスとインターフェイスをのぞいてみると,NI-DAQmxデバイスのツリーにPCI-6229:"D
-
BADI ME_PROCESS_PO_CUST not getting triggered
Hello Experts, i implemeted BADI ME_PROCESS_PO_CUST to ZME_PROCESS_PO_CUST. there is only one badi implemented for this. And it is working fine in development and transported to Quality system. in Quality system this badi itself is not getting trigge
-
Labels lost following re-install of lightroom
After re-installing Lightroom all the colour label info has been lost. Database not affected. Why? Should I use auto save xmp to prevent this?