How to change report query dynamically in Oracle APEX?
Hi,
I want to dynamically change the where condition in APEX report query. Can anyone help me solve my this problem?
(Just want to change the query which we change in Oracle Reports using lexical parameter to change &Where, &Order by etc. dynamically!!)
Thanks, Praful
Hi
I've been using flexible queries in APEX for a few years now, and your question just added a whole new dimension to the flexible and powerful nature or writing reports in APEX.
While APEX Interactive reporting has almost completely removed the need the equivalent of Lexicals in Oracle Reports, I thought it might be fun to try and use lexicals in an APEX report.
Before we start I should summarise the powerful capability of APEX reporting to have oprtional parameters (lots and lots of them if this is needed).
For each parameter, you simply add a page item which will hold the value of the parameter.
The item/parameter can be populated by typing in the value, defining an LOV, using a date-picker etc.
To make the parameter optional simply use an OR in the where clause.
So for a apge item P200_PARAM1.....include
WHERE (:P200_PARAM1 IS NULL
OR COLUMN1 = :P200_PARAM1)
This way you can either leave the page item null or type in / select a value from a LOV.
There is a small quirk in APEX LOV's which sometimes returns a value of '%' or '%null%' - depending on the version - when no value is selected.
See Patrick Wolf's solution for this at Re: Null value handling in LOVs
I include this Application Process in all my APEX applications ;)
Now let's look at using the equivalent of Oracle Reports Lexicals......
First-off - this is based on the APEX SQL report - NOT Interactive Report.
It relies on the fact that you can let the query be parsed only at runtime.
1. Define an SQL report entering the 'core' of your query.
With a query like SELECT ENAME, JOB FROM EMP
Select 'Generic Columns' option in the 'Column Headings' section
Finish the report creation
2. Define a page item - say P200_LEXICAL - type text on the page
3. Edit the report and update the SQL query to include your lexical page item
SELECT ENAME, JOB FROM EMP &P200_LEXICAL. (REMEMBER THE '.' AT THE END)
Ensure that the option "Use Generic Column Names (parse query at runtime only)" is selected at the bottom of the query
4. Add a button to the page -using 'Create a button displayed among this region's items' the will submit the page.
5. Run the page - you will see all the employee names and job desdriptions
6. Enter a where clause into the 'Lexical' textbox - say "WHERE ENAME LIKE 'K%'" and click the 'Go' button
Voila! your where clause is magically applied.
Try any variant you like adding an ORDER BY clause etc...... this is FUN!
7. Clear the value of the LEXICAL and click go.
Edit the report and move the &P200_LEXICAL. into the selected columns (or add another one)
SELECT ENAME, JOB &P200_LEXICAL. FROM EMP
8. Run the page
Enter ",SAL" in the textbox and "Go"
We can add as many columns as we like (subject to the "Maximum number of generic report columns:" set below the SQL query in the report edit section)
Now because we have all the flexibility in APEX of setting page items using SQL or PLSQL you can set the value of the lexical programatically, or just pre-set a few values in an LOV - the options are limitless.
While I've never had the need to use lexicals - you can see that APEX provides the most Flexible Lexicals in town.
Eat your heart out "Oracle Reports"!!!
Have fun
Mike
Similar Messages
-
How to change VO query dynamically
Hi,
Iam trying to change the VO query dynamically. My req. is I have 6 columns in a header page 3 columns(default single column) for sorting purpose and another 3 columns(default single column) for data querying purpose.
al these are in one view so I have created one VO.
Sorting Searching
A A
B B
C C
When I give any values in Sorting and hit submit button VO query should change dynamically.
I have searched older post regarding this.
My query is some thing like this
SELECT * from cust_table where a = NVL(:1 ,a)
UNION
SELECT * from cust_table where a<> NVL(:1 ,a)
order by a
Iam trying to pas the below part dynamicaly in my AM method
vo.setWherecaluse("where a = NVL(:1 ,a)
UNION
SELECT * from cust_table where a<> NVL(:1 ,a)
order by a ")
and trying to pass the params to that query. But it is not working.Giving error "Bind variable could not find"
Can any one suggest how to solve the issue.
Thanks,
MaheshHello Ajay,
THanks for your response.
My vo query is select col1,col2,col3,col4,col5,col6 from cust_table;
and and changing vo.setwhereclause dynamically based on different scenerios.
in one scenerio i need my query to be some thing like
SELECT col1,col2,col3,col4,col5,col6 from cust_table where a = NVL(:1 ,a)
UNION
SELECT col1,col2,col3,col4,col5,col6 from cust_table where a <> NVL(:1 ,a)
order by a
so can i concatenate my vo.setwhereclause like *"where a = NVL(:1 ,a) UNION SELECT col1,col2,col3,col4,col5,col6 from cust_table where a NVL(:2 ,a) order by a"*
in the setwhereclause iam setting bind variables is this method correct? Hope it is clear pleaselet me know if it is not clear I will explain in detail.
Thanks, -
How to change report title dynamically??
Hi,
I need to change the report title dynamically. The report title must contain the value of a particular culumn in the same report.
ex:
col1----col2
123----abcd
Report title should be report123
ThanksHi BIPUser,
Thanks for your answer.
@1 in title view is not working. It shows @1 in the title view.
But Narrative view is working fine.
Thanks again
Have great weekend
Edited by: bob123 on Apr 2, 2010 8:41 AM -
How to generate report with dynamic variable number of columns?
How to generate report with dynamic variable number of columns?
I need to generate a report with varying column names (state names) as follows:
SELECT AK, AL, AR,... FROM States ;
I get these column names from the result of another query.
In order to clarify my question, Please consider following table:
CREATE TABLE TIME_PERIODS (
PERIOD VARCHAR2 (50) PRIMARY KEY
CREATE TABLE STATE_INCOME (
NAME VARCHAR2 (2),
PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD) ,
INCOME NUMBER (12, 2)
I like to generate a report as follows:
AK CA DE FL ...
PERIOD1 1222.23 2423.20 232.33 345.21
PERIOD2
PERIOD3
Total 433242.23 56744.34 8872.21 2324.23 ...
The TIME_PERIODS.Period and State.Name could change dynamically.
So I can't specify the state name in Select query like
SELECT AK, AL, AR,... FROM
What is the best way to generate this report?SQL> -- test tables and test data:
SQL> CREATE TABLE states
2 (state VARCHAR2 (2))
3 /
Table created.
SQL> INSERT INTO states
2 VALUES ('AK')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AL')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AR')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('CA')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('DE')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('FL')
3 /
1 row created.
SQL> CREATE TABLE TIME_PERIODS
2 (PERIOD VARCHAR2 (50) PRIMARY KEY)
3 /
Table created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD1')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD2')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD3')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD4')
3 /
1 row created.
SQL> CREATE TABLE STATE_INCOME
2 (NAME VARCHAR2 (2),
3 PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
4 INCOME NUMBER (12, 2))
5 /
Table created.
SQL> INSERT INTO state_income
2 VALUES ('AK', 'PERIOD1', 1222.23)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('CA', 'PERIOD1', 2423.20)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('DE', 'PERIOD1', 232.33)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('FL', 'PERIOD1', 345.21)
3 /
1 row created.
SQL> -- the basic query:
SQL> SELECT SUBSTR (time_periods.period, 1, 10) period,
2 SUM (DECODE (name, 'AK', income)) "AK",
3 SUM (DECODE (name, 'CA', income)) "CA",
4 SUM (DECODE (name, 'DE', income)) "DE",
5 SUM (DECODE (name, 'FL', income)) "FL"
6 FROM state_income, time_periods
7 WHERE time_periods.period = state_income.period (+)
8 AND time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
9 GROUP BY ROLLUP (time_periods.period)
10 /
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> -- package that dynamically executes the query
SQL> -- given variable numbers and values
SQL> -- of states and periods:
SQL> CREATE OR REPLACE PACKAGE package_name
2 AS
3 TYPE cursor_type IS REF CURSOR;
4 PROCEDURE procedure_name
5 (p_periods IN VARCHAR2,
6 p_states IN VARCHAR2,
7 cursor_name IN OUT cursor_type);
8 END package_name;
9 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY package_name
2 AS
3 PROCEDURE procedure_name
4 (p_periods IN VARCHAR2,
5 p_states IN VARCHAR2,
6 cursor_name IN OUT cursor_type)
7 IS
8 v_periods VARCHAR2 (1000);
9 v_sql VARCHAR2 (4000);
10 v_states VARCHAR2 (1000) := p_states;
11 BEGIN
12 v_periods := REPLACE (p_periods, ',', ''',''');
13 v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
14 WHILE LENGTH (v_states) > 1
15 LOOP
16 v_sql := v_sql
17 || ',SUM(DECODE(name,'''
18 || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
19 || '"';
20 v_states := LTRIM (SUBSTR (v_states, 3), ',');
21 END LOOP;
22 v_sql := v_sql
23 || 'FROM state_income, time_periods
24 WHERE time_periods.period = state_income.period (+)
25 AND time_periods.period IN (''' || v_periods || ''')
26 GROUP BY ROLLUP (time_periods.period)';
27 OPEN cursor_name FOR v_sql;
28 END procedure_name;
29 END package_name;
30 /
Package body created.
SQL> -- sample executions from SQL:
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR
PERIOD1 1222.23
PERIOD2
1222.23
SQL> -- sample execution from PL/SQL block
SQL> -- using parameters derived from processing
SQL> -- cursors containing results of other queries:
SQL> DECLARE
2 CURSOR c_period
3 IS
4 SELECT period
5 FROM time_periods;
6 v_periods VARCHAR2 (1000);
7 v_delimiter VARCHAR2 (1) := NULL;
8 CURSOR c_states
9 IS
10 SELECT state
11 FROM states;
12 v_states VARCHAR2 (1000);
13 BEGIN
14 FOR r_period IN c_period
15 LOOP
16 v_periods := v_periods || v_delimiter || r_period.period;
17 v_delimiter := ',';
18 END LOOP;
19 v_delimiter := NULL;
20 FOR r_states IN c_states
21 LOOP
22 v_states := v_states || v_delimiter || r_states.state;
23 v_delimiter := ',';
24 END LOOP;
25 package_name.procedure_name (v_periods, v_states, :g_ref);
26 END;
27 /
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
PERIOD4
1222.23 2423.2 232.33 345.21 -
How to change the image dynamically depend upon the input parameter
Hi All
I have one report running depend upon the Organization specific, I have 15 operating unit and 15 different logo for each operating unit.
How to change the Logo dynamically depend upon the input passed by the user.
If I have three or four logo i can add in my layout using if else statement and its works fine but i have more that 10 logos so its no possible to keep these in My RTF Template.
Is it possible to change the logo according to the input without keeping this in Template.
I have seen this link but its not working fine
http://erpschools.com/articles/display-and-change-images-dynamically-in-xml-publisher
Regards
Srikkanth.MHi,
I have not completed fully,so sorry i cant able to share the files, could you please give me some tips and steps to do.
Without having the logo in RTF if it possible to bring the logo depends on the user input (Ie Operating unit).
Regards
Srikkanth -
How to change timeout parameter value in Oracle 10g R2
Anyone knows how to change timeout parameter value in Oracle 10g Database R2?
Waheed Azhar wrote:
actually i am getting ORA-01013 exception which directly relates to the timeout value but i think it's hidden parameter...What makes you think it's a hidden parameter?
A search of MetaLink for that error turns up a number of hits, most of which a very situational specific. Exactly what are you doing when you get this error? Are you connecting over an ODBC connection? Are you getting it on a connection request? At db shutdown? During a long-running query? -
How to change the images dynamically in a table.
Hai,
How to change the images dynamically in a table based on the condition in webdynpro abap.
Edited by: Ravi.Seela on Oct 13, 2011 2:17 PMThis has been much discussed earlier. Do search posts.
For your scenario i would do the following.
inside your node which is binded to the table, i create a new node image with cardinality 1 ..1 and a attribute called path of type string.
create a supply function for the node image .
Supply method now has a Element (Parent element ) and node.
Based on your record in element, set the right image source to path attribute and bind the node.
This will make sure that the framework calls the image supply function for every row in a table. -
How to change the query ?
Gurus,
Please clarify this
Select ils.item,(nvl(sum(decode(tdh.loc_type,'S',decode(tdh.tran_code, 1,tdh.units,0),
'W',decode(tdh.tran_code,30,0,31,0,32, tdh.units,33, tdh.units,37,0,38, tdh.units,20,0,1,0))),0))"result"
from tran_data_history tdh, item_loc_soh ils
where tdh.item = ils.item
and ils.item in('100002513','100002484')
and trunc(tdh.TRAN_DATE)
between (*select first_date from (select item,min(trunc(first_received)) first_date From Item_loc_soh*
where item in('100002513','100002484') and first_received is not null
group by item ))
and trunc(sysdate)
group by ils.item
Problem with this query is, the block mentioned in BOLD is returning two rows, and I am writing between and clause .. since the query in bold is returning more than one row, it is throwing error stating that single query returns more than one row .. Requirement is, whatever date which is returned with value 100002513 should be compared with sysdate, and other value 100002484 should be compared with sysdate .. Irrespective of number of items (whether 1 or more than 1) should simultaneously be compared with sysdate
How to change my query
RegardsInner query
Select First_Date From (Select Item, Min(Trunc(First_Received)) First_Date
From Item_Loc_Soh *
Where Item In ('100002513', '100002484')
And First_Received Is Not Null
Group By Item)
this will return 2 rows for each of the item id 2513 and 2484 because you write query for this 2 rows
and select min date
which means
item id 2513 min date
item id 2482 min date
if you want to compare just a date to sysdate then do it directly,
Select Ils.Item,
(Nvl(Sum(Decode(Tdh.Loc_Type,
'S',
Decode(Tdh.Tran_Code, 1, Tdh.Units, 0),
'W',
Decode(Tdh.Tran_Code,
30,
0,
31,
0,
32,
Tdh.Units,
33,
Tdh.Units,
37,
0,
38,
Tdh.Units,
20,
0,
1,
0))),
0)) "result"
From Tran_Data_History Tdh, Item_Loc_Soh Ils
Where Tdh.Item = Ils.Item
And Ils.Item In ('100002513', '100002484')
And Trunc(First_Received) = Sysdate;
however i dont understand importance of Tdh.Tran_Date and which date you exactly want to compare
hope this helps,
if not plz clarify more on the questionsEdited by: Nicloei W on Sep 24, 2008 11:51 PM -
How to change redo log size in oracle 10g
Hi Experts,
Can anybody confirm how to change redo log size in oracle 10g?
AmitDear Amit,
You can enlarge the size of existing Online Redo log files, by adding new groups with different size of files (origlog$/mirrlog$) and then carefully droping the old groups with their associated inactive files.
Please refer SAP Note 309526 - Enlarging redo log files to perform the activity.
Steps to perform:
STEP-1. Analyze the exisiting situation and prepare an action plan.
A. You have to ensure that no more than one log switch per minute occurs during peak times.
It may also be necessary to increase the size of the online redo logs until they are large enough.
Too many log switches lead to too many checkpoints, which in turn lead to a high writing load in the I/O subsystem.
Use ST04 -> Additional Functions --> Display GV$-Views
There you can select
Gv$LOG_HISTORY --->for determing your existing LOG switching frequency.
GV$LOG -
> list the status(INACTIVE/CURRENT/ACTIVE) /size/sequence no. of existing online redolog files
GV$LOGFILE --- > list the information of existing online redolog files with their storage paths
You can document the existing situation of Online Redo Log Fiile management before going to enlarge Redo Log Files.
It will be helpful, if something goes wrong while performing activities.
B. Based on above Situation analysis, Plan your New Redo Log Group and there Members with new optimal size.
e.g.
Group No. Redo Log File Locations u201C/oracle/<SID>/u201D Size
/origlogA /mirrlogA
15 log_g15m1.dbf log_g15m2.dbf 100 MB
17 log_g17m1.dbf log_g17m2.dbf 100 MB
/origlogB /mirrlogB
16 log_g16m1.dbf log_g16m2.dbf 100 MB
18 log_g18m1.dbf log_g18m2.dbf 100 MB
Continue to next..... -
How to change report region fields in read only mode?
How to change report region fields in read only mode?
skud.add the following javascript fuction to page header(or Javascript function and variables section)
function disableItems(pRegionStaticId,pDisableFlag) {
$('#'+pRegionStaticId).find('[name^=f]').each( function(){ /* matches fxx */
if( $(this).attr('name').match(/f[0-9][0-9]/) ){
return $(this);
}).attr('disabled',pDisableFlag);
pRegionStaticId is the region's static Id+
Note that this code specifically disables only application arrays. Disabled items are not available after submission (and hence are different from readonly) . But any page javascript can modify disabled or readonly items(client side), so you must check at the server side to validate the data.
You can disable items using
disableItems('MY_REGION_ID' ,true);and enable them by passing false
disableItems('MY_REGION_ID' ,false); -
HOW TO CHANGE SQL QUERY TO GET SPECIFIC RESULT
I HAVE FOLLOWING QUERY AND ITS FUNCTIONING BUT I WANT ALL THOSE RECORD SHOULD BE DISPLADE WICH HAVE NO TRANSACTION IN SALES ANS SALES RETURN WHILE RETREVING DATA FROM DATABASE.
I TRIED TO USE + OPERATOR BUT I DON'T KNOW HOW TO CHANGE THE QUERY TO GET THE RESULT
MAIN TABLE IS BEING USED TO FETCH RECORD
SALES_HEADER,SALES_DETAIL
SALES_HEADERR,SALES_DETAILR
STOCK_REG
AND THE QUERY IS
select s.item_code,S.DESCR,s.GRAND_TOTAL,
sum(decode(d.dayno,01,NVL(S.QTY,0),0)) DAY1,
sum(decode(d.dayno,02,NVL(S.QTY,0),0)) DAY2,
sum(decode(d.dayno,03,NVL(S.QTY,0),0)) DAY3,
sum(decode(d.dayno,04,NVL(S.QTY,0),0)) DAY4,
sum(decode(d.dayno,05,NVL(S.QTY,0),0)) DAY5,
sum(decode(d.dayno,06,NVL(S.QTY,0),0)) DAY6,
sum(decode(d.dayno,07,NVL(S.QTY,0),0)) DAY7,
sum(decode(d.dayno,08,NVL(S.QTY,0),0)) DAY8,
sum(decode(d.dayno,09,NVL(S.QTY,0),0)) DAY9,
sum(decode(d.dayno,10,NVL(S.QTY,0),0)) DAY10,
sum(decode(d.dayno,11,NVL(S.QTY,0),0)) DAY11,
sum(decode(d.dayno,12,NVL(S.QTY,0),0)) DAY12,
sum(decode(d.dayno,13,NVL(S.QTY,0),0)) DAY13,
sum(decode(d.dayno,14,NVL(S.QTY,0),0)) DAY14,
sum(decode(d.dayno,15,NVL(S.QTY,0),0)) DAY15,
sum(decode(d.dayno,16,NVL(S.QTY,0),0)) DAY16,
sum(decode(d.dayno,17,NVL(S.QTY,0),0)) DAY17,
sum(decode(d.dayno,18,NVL(S.QTY,0),0)) DAY18,
sum(decode(d.dayno,19,NVL(S.QTY,0),0)) DAY19,
sum(decode(d.dayno,20,NVL(S.QTY,0),0)) DAY20,
sum(decode(d.dayno,21,NVL(S.QTY,0),0)) DAY21,
sum(decode(d.dayno,22,NVL(S.QTY,0),0)) DAY22,
sum(decode(d.dayno,23,NVL(S.QTY,0),0)) DAY23,
sum(decode(d.dayno,24,NVL(S.QTY,0),0)) DAY24,
sum(decode(d.dayno,25,NVL(S.QTY,0),0)) DAY25,
sum(decode(d.dayno,26,NVL(S.QTY,0),0)) DAY26,
sum(decode(d.dayno,27,NVL(S.QTY,0),0)) DAY27,
sum(decode(d.dayno,28,NVL(S.QTY,0),0)) DAY28,
sum(decode(d.dayno,29,NVL(S.QTY,0),0)) DAY29,
sum(decode(d.dayno,30,NVL(S.QTY,0),0)) DAY30,
sum(decode(d.dayno,31,NVL(S.QTY,0),0)) DAY31,
sum(S.qty) TU
FROM
(select nvl(sales_detail.qty+sales_detail.bonus,0) as qty,
sales_detail.item_code AS ITEM_CODE,
stock_reg.descr AS descr,
s_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
SALES_DETAIL,SALES_HEADER,STOCK_REG
WHERE SALES_DETAIL.S_ID = SALES_HEADER.S_ID AND
SALES_DETAIL.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
STOCK_REG.COMCODE='C1'
UNION all
select -1*nvl(sales_detailR.qty+sales_detailR.bonus,0) as qty,
sales_detailR.item_code AS ITEM_CODE,
stock_reg.descr AS descr,
RETURN_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
SALES_DETAILR,SALES_HEADERR,STOCK_REG
WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
SALES_DETAILR.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
STOCK_REG.COMCODE='C1') S,
(select level as dayno
from dual
connect by level <= 31) d
where d.dayno = to_char(s.sALE_date, 'DD') AND TO_DATE(S.SALE_DATE) BETWEEN '&FROMDATE' AND '&TODATE'
GROUP BY S.ITEM_CODE,S.DESCR,S.GRAND_TOTALwell my query running successfully just the quesion was that i wanted to bring some changes in the query to retrieve the complete record which has no transaction in sales
for exmple
if i write the quey
select dept.deptno,sum(sal) from emp,dept
where dept.deptno = emp.deptno
group by dept.deptno
the recult comes as
DEPTNO SUM(SAL)
10 8750
20 10875
30 9400
though there is another deptno which is deptno no 40
have no sal
and when i use this query
select dept.deptno,sum(sal) from emp,dept
where dept.deptno = emp.deptno(+)
group by dept.deptno
it shows the dept no 40 also
DEPTNO SUM(SAL)
10 8750
20 10875
30 9400
40
so to get this i posted query which was to long to understand easily.
i accept that i sholud post short query to make other understand
so check out this
select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
FROM
SALES_DETAILR,SALES_HEADERR,STOCK_REG
WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
SALES_DETAILR.STOCKCODE = STOCK_REG.STOCKCODE
AND RETURN_DATE = '01-APR-08'
GROUP BY STOCK_rEG.item_code
ORDER BY TO_NUMBER(ITEM_CODE) ASC
when i execute this query i get the following result
ITEM_CODE QTY
84 2
102 3
108 3
116 6
166 3
170 3
thoug there is other items are aalso available in stock which transaction
yet not been done or not been sold out/
so when i use the outer join i get the same result
select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
FROM
SALES_DETAILR,SALES_HEADERR,STOCK_REG
WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
SALES_DETAILR.STOCKCODE(+) = STOCK_REG.STOCKCODE
AND RETURN_DATE = '01-APR-08'
GROUP BY STOCK_rEG.item_code
ORDER BY TO_NUMBER(ITEM_CODE) ASC
ITEM_CODE QTY
84 2
102 3
108 3
116 6
166 3
170 3
hope i tried to make u understand on better way -
Create a query builder in oracle Apex
Hi
We have a request to create a query builder in oracle Apex particularly.But it provide the application builder and Utilities when we create the apex workspace.My question is any possibility are to make the application builder and utilizes as invisible
regards
apexuserhi scott,
we no need to buid a report.we want generate a sql query using GUI drag and drop query builder.
our suggestion is provide synonym for all objects and give to clinet,but in apex query builder only show view and table...
it not show synonym thats the problem..
simply we want oracle query browser.just want build a query.through synonym schema.
we cerate a oracle user and provide synonym for live tables.then we provide the synonym user to client place,so they want build a query simpl.
they dont have sql knowledge.
regards
apexuser -
How to chnge report heading dynamically
Good day Experts
I trust you are all well. I need to borrow your expertise..
I have an query regarding Report Heading. presently i am working on Quarterly report. In report data starts from Jan 2008
Report will run on every quarter on
1st of April
1st of July
1st of Oct
1st of Jan
so the query is : if the report executes on 1st of April then it should be for Jan 2008 – December 2013 paid through March 31, 2014 . If the report generates again on July 1st, it should be for Jan 2008 - March 2014 paid through June 30, 2014.
I am using SAP BO INFOVIEW 3.1
All and every contribution is welcome.
Thanks in Advance
RanjeetHi Anurag
Thanks for your reply, I know how to Hardcode. i am struggling with
Jan 2008 – December 2013 paid through March 31, 2014
Jan 2008 - March 2014 paid through June 30, 2014
these Bold letter are changing dynamically on quarterly basis rest are hard coded value
i want to know how to how to change dynamically this dates
Thanks
Ranjeet -
How to change Reports where clasue
Hi
How can I change Report's where clause If I'm calling it from Oracle Forms.
Oracle Version 9.0.2.9.0
Any ideas please?
Thanks!I guess this questions belongs to Reports Forum?
But anyways, you can create a host/bind variable, and emmbed it into your query definition statement like this:
SELECT columns
FROM yourtable
&WhereVariable
.. where wherevariable is the name of your bind variable. -
Forming a report query dynamically with the value of an item
Hi Gurus,
We wanted to create a report based on the value of an item in the page.
For example
There is a text box named p1_table depending on the value of this item the query of the report should change
1) when p1_table = emp then report query should be select * from emp
2) when p1_table = dept then report query should be select * from dept
I tried doing this using
select * from :p1_table and select * from v('p1_table') , it is not working.
Kindly help me in achieving the requirement.
Thanks & Regards,
Vikas KrishnaHi Vikas,
You have to do this as a report based on a function that returns the query as a string. You build up the string dynamically in the function.
Regards
Andre
Maybe you are looking for
-
Is there any object in labview that contains a list of data for the user to select (selection one at a time) or add a new data?
-
I can't access the computers at a remote location that uses Windows Home Server. The remote location (my office) has a static ip address and is running the original home server software. I'm running XP. When I connect to the Home Server Web Site usin
-
Reverify a download of Solaris
I am having an issue where i have completed the 3GB download of Solaris using the Sun download manager and when i am going to extract the files i get a CRC error on part A of the file. Is there any way i can get the file back into the Sun download ma
-
Computer Lags changing the volume
Any time I want to change the volume with the keys on my bluetooth keyboard, it seems that there is a significant lag bringing up the volume box on the screen that shows the volume level. Once it's up, I can go up / down anything rather quickly. Just
-
Hi, Is there a working example to expose AQ's as Webservices. Regards Deepak