Dynamic using clause
Hi All,
Is it possible to build a dynamic using clause in execute immediate command.
EXECUTE IMMEDIATE <dynamic query> USING <dynamic clause>;
If not, is there any alteranate approach there?
Regards
Swaminathan
"there is no such thing as a dynamically generated USING clause."
Ask Tom &quot;Returning cursor from stored procedure u...&quot;
Tom's referring to the following approach as an alternive: http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1288401763279
Similar Messages
-
Dynamic USING clause in execute immediate
Hi All,
Is it possible to build a dynamic using clause in execute immediate command.
EXECUTE IMMEDIATE <dynamic query> USING <dynamic clause>;
Rgrds,
Nitin.Hi,
The problem is I have a query in which in some scenarios I want just one column in where clause, in other scenario I need 2 columns in the where clause.
So I would have to write 2 different queries.
execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1' into a using 1;
execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1 AND 2 = :bind2' into a using 1, 2;
Is there any way I can achieve this in a single query like:
dynamic_using_str varchar2(100);
dynamic_using_str := '1';
execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1' into a using dynamic_using_str;
dynamic_using_str := '1, 2';
execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1 AND 2 = :bind2' into a using dynamic_using_str;
~Nitin.
Edited by: user13060845 on Apr 30, 2010 12:29 PM -
Dynamic SQL Select String VS non-dynamic USING Clause
This isn’t a question, I just wanted to share a solution to a problem I have encountered several times.
e.g. You have ‘n’ number of variables, of which any combination could be used in a SQL string. But it’s difficult to execute the SQL string with USING without an unpleasant CASE statement.
Solution: Reference all ‘n’ bind variables in the FROM clause of the SQL in an in-line-view. And specify all variables in the USING Clause.
When building the SQL String, specify the view.variable rather than directly referencing bind variables
This eliminates the requirement to check which variables have been populated.
<h6>
t_select := ‘SELECT tab.cola, tab.colb’;
t_from := ‘FROM (SELECT :1 cola, :2 colb, :3 colc, :4 cold, :5 cole) parms, tablea tab’;
t_where := ‘WHERE tab.cola = parms.cola’;
OPEN c t_select||t_from||t_where USING v1, v2, v3, v4, v5;
</h6>
I hope this is useful to someone...
PeteDInteresting approach.. but I would still prefer creating a DBMS_SQL cursor instead - as there the binding can be fully controlled at run-time.
If this has to return a ref cursor (caller is an external process), then I would rather use conditional processing logic (as that is what PL is about) in PL/SQL and build a "+proper+" SQL statement (with only the required bind variables) at run-time. Features like polymorphism makes this easy - and the call interface that is provided to the client is a lot cleaner. -
Execute immediate with using clause to pass column name dynamically
Hai,
Is there any way using execute immeidate to pass the column name dynamically. I used to pass the column value as dynamic with the help of "Using clause" . But if i use to pass column name, it is giving numberic error at run time. Eg,. for testing has been given below.
1. Column value as dynamic, which is working correctly.
create or replace function testexeimm (acctnum char)
return number as
acctbal number;
begin
execute immediate 'select balance from acct_master where acct_no=:a' into acctbal using acctnum;
return acctbal;
end;
2. Column name as dynamic which is not working
create or replace function testexeimm (colnam char)
return char as
acctbal char;
begin
execute immediate 'select :a from ch_acct_mast where rownum=1' into acctbal using colnam;
return acctbal;
end;
Any help in this regard will be highly appericated.
Regards
SridharSo the variable has to be numeric too:
create or replace function testexeimm (colnam char)
return number as
acctbal number;
begin
execute immediate 'select '|||colnam||' from ch_acct_mast where rownum=1' into acctbal;
return acctbal;
end;Max
http://oracleitalia.wordpress.com -
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 -
REP 300 error when using dynamic where clause
Hi,
I am developing a report and I need a dynamic where clause.The code I have written in the where clause is as below
function where_clauseFormula return VARCHAR2 is
begin
if :P_PO_REQD = 'No' then
return ('and pha.segment1 is null');
elsif :P_PO_REQD = 'Yes' then
return('and pha.segment1 between NVL(:p_po_num_from,1) and NVL(:p_po_num_to,99999999999999999)');
else return NULL;
end if;
end;
Now if i directly use either of the conditions in my report query it works fine.But if the parameter is No then the where clause does not work.I have also tried different statements in the if clause of the 'No' part and they work.For example the following code works when :P_PO_REQD is 'No' :
function where_clauseFormula return VARCHAR2 is
begin
if :P_PO_REQD = 'No' then
return ('and pha.segment1 between NVL(:p_po_num_from,1) and NVL(:p_po_num_to,99999999999999999)');
elsif :P_PO_REQD = 'Yes' then
return('and pha.segment1 between NVL(:p_po_num_from,1) and NVL(:p_po_num_to,99999999999999999)');
else return NULL;
end if;
end;
I don't know why this is happening.I really need a solution or a workaround urgently
Thanks
MukundYou may use Lexical Reference for the dynamic where. In After Parameter Form Trigger, code....
if :P_PO_REQD = 'No' then
:P_where := :P_where || 'and pha.segment1 is null';
elsif :P_PO_REQD = 'Yes' then
:P_where := :P_where || 'and pha.segment1 between NVL(:p_po_num_from,1) and NVL(:p_po_num_to,99999999999999999)';
end if;
.......... -
Need to know the column names in my dynamic select clause
Dear All,
Please go through the following code. While executing the following code i am getting an error saying that dbms_sql.describe_columns overflow, col_name_len=35. Use describe_columns2.
Please guide me how to proceed further. Or please help me, how can i get the column names when i issue a dynamic select clause.
DECLARE
CUR INTEGER;
COL_CNT INTEGER ;
A INTEGER;
SEL_CLAUSE VARCHAR2(2000);
DESC_T DBMS_SQL.DESC_TAB;
REC DBMS_SQL.DESC_REC;
b number;
BEGIN
SEL_CLAUSE := 'SELECT 1,2,DECODE(1,1,''ONE'',2,''TWO'',3,''THREE'') FROM DUAL';
--'SELECT ROWID,PARA_SUB_CODE,DECODE('||''''||'ENG'||''''||','||''''||'ENG'||''''||',PARA_NAME,PARA_BL_NAME),NULL,NULL FROM PCOM_APP_PARAMETER';
--'SELECT 1,2,DECODE(1,1,''ONE'',2,''TWO'') FROM DUAL';
DBMS_OUTPUT.PUT_LINE( SEL_CLAUSE );
CUR := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(CUR,SEL_CLAUSE,DBMS_SQL.NATIVE);
DBMS_SQL.DESCRIBE_COLUMNS(CUR,COL_CNT,DESC_T);
B := desc_t.first;
FOR J IN 1..COL_CNT
LOOP
DBMS_OUTPUT.PUT_LINE('J := '||J || ' COL CNT ' || COL_CNT);
END LOOP;
BEGIN
A := DBMS_SQL.EXECUTE(CUR);
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END;
Regards,
BalajiIs there any way can i have it directly??It does not work with static SQL either. Dynamic SQL is no different.
SQL> select 1 x from dual where x = 1 ;
select 1 x from dual where x = 1
ERROR at line 1:
ORA-00904: "X": invalid identifier
SQL>As suggested already, you will need to use alias if you want your select expression to be referred in the where clause.
SQL> BEGIN
2 FOR rec IN (SELECT *
3 FROM (SELECT 1,
4 2,
5 DECODE(1, 1, 'ONE', 2, 'TWO', 3, 'THREE') "DECODE(1, 1, 'ONE', 2, 'TWO', "
6 FROM DUAL)
7 WHERE "DECODE(1, 1, 'ONE', 2, 'TWO', " = 'ONE')
8 LOOP
9 NULL;
10 END LOOP;
11 END;
12 /
PL/SQL procedure successfully completed.
SQL>Message was edited by:
Kamal Kishore -
Dynamic WHERE clause in SELECT statement
Hi,
I need to extract (SELECT) all the products in different salesorganizations. Since a product can be available in more than 1 salesorg I have created several properties in the PRODUCT dimension - 1 for each salesorganization (naming: Sxxxx where xxxx is the salesorganization number).
Since I need to prefix the salesorganization property with an "S" I have created a property on the SALESORG dimension called SALESORG.
Therefore I need to create a dynamic WHERE clause in the SELECT statement. Currently my script is:
*SELECT(%SORG%, "[SALESORG]",SALESORG, [ID]=%SALESORG_SET%)
*SELECT(%PROD%, "[ID]",PRODUCT, [%SORG%]="X")
My first SELECT find the Sxxx (equal to the property I need in the PRODUCT dimension). My second SELECT uses the variable in the first SELCT statement to use the correct property for the WHERE clause.
Unfortunately the code is not validated - any suggestions?
/LarsHi Lars,
If you run it from a DM package without validating it, does it still work? I would bet it does.
If this is the case I would open a message with SAP (it would be an enhancement request). Until they fix the validation code, you would just have to live with the script not validating.
Cheers,
Ethan -
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. -
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 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 Where Clause in a Loop ??
I need a dynamich where-clause in a Loop-Statement, like this:
LOOP AT gt_outtab INTO gs_outtab
WHERE ( delta IS INITIAL AND <f_per> IS INITIAL ).
gs_outtab-delta = gs_outtab-per01.
MODIFY gt_outtab FROM gs_outtab.
ENDLOOP.
First I tried this:
LOOP AT gt_outtab INTO gs_outtab
WHERE ( delta IS INITIAL AND (ls_per) IS INITIAL ).
gs_outtab-delta = gs_outtab-per01.
MODIFY gt_outtab FROM gs_outtab.
ENDLOOP.
but with both I get a syntax error.
Do you have an idea, how can I use the component I need dynamically?
thanks.
SamirHI
GOOD
Dynamic Conditions
To specify a condition dynamically, use:
SELECT ... WHERE (<itab>) ...
where <itab> is an internal table with line type C and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of <itab>. However, you may only use literals, and not the names of data objects. The internal table can also be left empty.
If you only want to specify a part of the condition dynamically, use:
SELECT ... WHERE <cond> AND (<itab>) ...
You cannot link a static and a dynamic condition using OR.
You may only use dynamic conditions in the WHERE clause of the SELECT statement.
===============================
DATA: TAB_SPFLI TYPE TABLE OF SPFLI,
TAB_SFLIGHT TYPE SORTED TABLE OF SFLIGHT
WITH UNIQUE KEY TABLE LINE,
WA LIKE LINE OF TAB_SFLIGHT.
SELECT CARRID CONNID
INTO CORRESPONDING FIELDS OF TABLE TAB_SPFLI
FROM SPFLI
WHERE CITYFROM = 'NEW YORK'.
SELECT CARRID CONNID FLDATE
INTO CORRESPONDING FIELDS OF TABLE TAB_SFLIGHT
FROM SFLIGHT
FOR ALL ENTRIES IN TAB_SPFLI
WHERE CARRID = TAB_SPFLI-CARRID AND
CONNID = TAB_SPFLI-CONNID.
LOOP AT TAB_SFLIGHT INTO WA.
AT NEW CONNID.
WRITE: / WA-CARRID, WA-CONNID.
ENDAT.
WRITE: / WA-FLDATE.
ENDLOOP.
THANKS
MRUTYUN -
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 -
Pass Pl/sql table into USING clause in EXECUTE IMMEDIATE statment
Getting error when I try to pass the PL/SQL table into USING clause in EXECUTE IMMEDIATE statment:
Declare
result NUMBER;
TYPE values_tab IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
lv_tab values_tab;
lv_exp varchar2(300);
lv_exec varchar2(300);
BEGIN
lv_tab(1) := 5;
lv_tab(2) := 48;
lv_tab(3) := 7;
lv_tab(4) := 6;
lv_exp := ':b1+:b2+(:b3*:b4)';
lv_exec := 'SELECT '||lv_exp ||' FROM DUAL';
EXECUTE IMMEDIATE
lv_exec
INTO
result
USING
lv_tab;
DBMS_OUTPUT.PUT_LINE(result);
END;
Error at line 1
ORA-06550: line 20, column 12:
PLS-00457: expressions have to be of SQL types
ORA-06550: line 15, column 8:
PL/SQL: Statement ignored
I am trying to evaluate the expression ":b1+:b2+(:b3*:b4)" which is stored in table. This table has different expressions (around 300 expressions). I want to use the bind variables in expression because each expression evaluated thousand of time may be more in some case. If I don't use bind variable then it fill shared pool.
Is there any way I can pass the USING (IN) parameters dynamically instead of writing "USING lv_tab(1), lv_tab(2), lv_tab(3), lv_tab(4)"? As number of input parameters change depend on the expression in the table.
If not possible please suggest any other ideas/approches
Please help..
Edited by: satnam on Jun 11, 2009 11:50 AMWell, you keep changing reqs faster I can keep up. Anyway, assuming N-th bind variable (left-to-right) corresponds to collection N-th element:
Declare
result NUMBER;
lv_tab values_tab := values_tab();
lv_exp varchar2(300);
lv_exec varchar2(300);
lv_i number := 0;
BEGIN
lv_tab.extend(4);
lv_tab(1) := 5;
lv_tab(2) := 48;
lv_tab(3) := 7;
lv_tab(4) := 6;
lv_exp := ':5000135+:5403456+(:5900111*:5200456)';
lv_exec := lv_exp;
While regexp_like(lv_exec,':\d+') loop
lv_i := lv_i + 1;
lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1);
end loop;
lv_exec := 'BEGIN :a := ' || lv_exec || '; END;';
DBMS_OUTPUT.PUT_LINE(lv_exec);
EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab;
DBMS_OUTPUT.PUT_LINE(result);
END;
BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END;
95
PL/SQL procedure successfully completed.
SQL> SY. -
Dynamic WHERE Clause in a Calendar
I would like to have a Calendar display values based on a dynamic WHERE clause created using PL/SQL anonymous block evaluating the values of items that the user uses as filters. I have done this dynamic SQL for reports and would lke to do the same for a Calendar.
I figured out how to do this.
I created a Hidden Item with the source value of &APP_USER.
named P50_APP_USER.
This is how my query looks now:
SELECT * FROM APX_EVENT WHERE APX_EVENT.STORE_NR IN (SELECT APX_Z.STORE_NR FROM APX_Z WHERE APX_Z.USERNAME = :P50_APP_USER)
And it works.
I got the answer from this thread:
CALENDAR - SQL ORDER BY CLAUSE NOT WORKING
Maybe you are looking for
-
Songs i bought on iphone dont show up on itunes
I bought 3 songs on my iphone 5 and they dont show up on itunes. Ive tried everything posted in previous forums with zero succes. Any help?
-
Extracting documents from Sharepoint 2013 Content Database
harepoint 2013 stores documents in the WSS_Content database in a table called DocStreams. Up until Sharepoint 2010, files where stored in a single row in a VarBinary column. Since Sharepoint 2013, files are stored in multiple rows using Shredded Blob
-
Problem when j2ee client try to access ejbs
Hi All i change my oracle app server prorts numbers for rmi, jms ,ajp, . After that i can not acces EJB using java standalong client.i show following error. "Oct 16, 2006 9:52:58 PM oracle.j2ee.clustering.ClusteringMessages warningInOpmnGetServers WA
-
during my last update I got an error message saying my apple mobile device did not have permissions. I also had a message about a missing file. I tried repairing in the control panel and I then uninstalled my itunes then tried to reinstall it to fix
-
Hi all, Oracle runs on a UNIX machine. And it always occurs that the Oracle Agent hangs up, occupies 49% CPU and leaves themselves, only over Services to stop. No error message, anything does not come. How can I solve this problem?