SQL Query Logic to to Calculate Shipment price
Hi Experts,
As i have created a thread already regarding this. You Can Refer my previous thread in [Previous Thread|http://forums.oracle.com/forums/thread.jspa?threadID=1027799&tstart=0]
I will post my question again in this thread too,
Table Records
SHIPMENT_ID SHIPMENT_PRICE SHIPMENT_ADDT_PRICE PRODUCT_ID PRODUCT_QTY VIRTUAL_COLUMN (Just for your Reference)
1000 6.95 2 11 4 1
1000 6.95 2 11 4 2
1000 3.95 1 13 2 3
1000 3.95 1 12 2 4
1001 12.95 2 11 4 5
1001 12.95 1 13 2 6
1001 12.95 2 11 4 7
1001 12.95 1 12 2 8
1002 20.95 1 12 2 9
1002 20.95 2 11 4 10
1002 20.95 2 11 4 11
1002 20.95 1 13 2 12
Repeated values in table with Maximum Value,
SHIPMENT_ID SHIP_PRICE SHIPMENT_ADDT_PRICE PRODUCT_QTY PRODUCT_ID VIRTUAL_COLUMN
1000 6.95 2 4 11 1
1000 6.95 2 4 11 2
1001 12.95 2 4 11 5
1001 12.95 2 4 11 7
1002 20.95 2 4 11 10
1002 20.95 2 4 11 11*
In this Case, There are two rows same with maximum value for all three shipments,
but need to take one row as maximum and to consider the other as like not maximum row to process the logic
I have considered the Record with VIRTUAL_COLUMN value 1,5 and 10 as maximum value and others as not maximum values
Expected Result (For Each Row) - Just listed for one shipment_id = 1000 here
SHIPMENT_ID SHIP_PRICE CALCULATION STEPS VIRTUAL_COLUMN
1000 41.7 (1*6.95)+((4-1)*2) Maximum ShipPrice + (PRODUCT_QTY-1)*SHIPMENT_ADDT_PRICE 1
1000 8 (4*2) PRODUCT_QTY*SHIPMENT_ADDT_PRICE 2
1000 2 (2*1) PRODUCT_QTY*SHIPMENT_ADDT_PRICE 3
1000 2 (2*1) PRODUCT_QTY*SHIPMENT_ADDT_PRICE 4*Note: The virtual column in the provided data is just for reference and not exists in table
Thanks,
Dharan V
Both query 1 and query 2 are wrong because both of them use the SHIPMENT_PRICE of the row and not the MAXIMUM SHIPMENT_PRICE for that product id as you requested in the original post.
To get the MAXIMUM SHIPMENT_PRICE you should use my last query:
SQL> with shipment_table as (
2 select 1000 SHIPMENT_ID, 6.95 SHIPMENT_PRICE, 2 SHIPMENT_ADDT_PRICE,
3 11 PRODUCT_ID, 4 PRODUCT_QTY, 1 VIRTUAL_COLUMN from dual union
4 select 1000,6.95,2,11,4,2 from dual union
5 select 1000,6.95,2,11,4,3 from dual union
6 select 1000,6.95,2,11,4,4 from dual union
7 select 1001,12.95,2,11,4,5 from dual union
8 select 1001,12.95,2,11,4,6 from dual union
9 select 1001,12.95,2,11,4,7 from dual union
10 select 1001,12.95,2,11,4,8 from dual union
11 select 1002,20.95,1,12,2,9 from dual union
12 select 1002,20.95,1,12,2,10 from dual union
13 select 1002,20.95,1,12,2,11 from dual union
14 select 1002,20.95,1,12,2,12 from dual)
15 SELECT shipment_id,
16 shipment_price,
17 shipment_addt_price,
18 product_id,
19 product_qty,
20 CASE
21 WHEN ROW_NUMBER() OVER (PARTITION BY shipment_id
22 ORDER BY shipment_addt_price DESC) = 1
23 THEN
24 (max(shipment_price) over (PARTITION BY shipment_id))
25 + (product_qty - 1) * shipment_addt_price
26 ELSE
27 product_qty * shipment_addt_price
28 END price
29 FROM shipment_table;
SHIPMENT_ID SHIPMENT_PRICE SHIPMENT_ADDT_PRICE PRODUCT_ID PRODUCT_QTY PRICE
1000 6,95 2 11 4 12.9500
1000 6,95 2 11 4 8.0000
1000 6,95 2 11 4 8.0000
1000 6,95 2 11 4 8.0000
1001 12,95 2 11 4 18.9500
1001 12,95 2 11 4 8.0000
1001 12,95 2 11 4 8.0000
1001 12,95 2 11 4 8.0000
1002 20,95 1 12 2 21.9500
1002 20,95 1 12 2 2.0000
1002 20,95 1 12 2 2.0000
1002 20,95 1 12 2 2.0000
12 rows selected.Look at line 24 of the query and you'll see the difference.
On your data there is no difference because the same product as always the same shipment_price...
Let's change a value in sample data:
Query 1
SQL> with shipment_table as (
2 select 1000 SHIPMENT_ID, 6.95 SHIPMENT_PRICE, 2 SHIPMENT_ADDT_PRICE,
3 11 PRODUCT_ID, 4 PRODUCT_QTY, 1 VIRTUAL_COLUMN from dual union
4 select 1000,6.95,2,11,4,2 from dual union
5 select 1000,100.95,2,11,4,3 from dual union
6 select 1000,6.95,2,11,4,4 from dual union
7 select 1001,12.95,2,11,4,5 from dual union
8 select 1001,12.95,2,11,4,6 from dual union
9 select 1001,12.95,2,11,4,7 from dual union
10 select 1001,12.95,2,11,4,8 from dual union
11 select 1002,20.95,1,12,2,9 from dual union
12 select 1002,20.95,1,12,2,10 from dual union
13 select 1002,20.95,1,12,2,11 from dual union
14 select 1002,20.95,1,12,2,12 from dual)
15 SELECT
16 SHIPMENT_ID,
17 SHIPMENT_PRICE,
18 SHIPMENT_ADDT_PRICE,
19 PRODUCT_ID,
20 PRODUCT_QTY,
21 CASE
22 WHEN ROW_NUMBER() OVER (PARTITION BY SHIPMENT_ID
23 ORDER BY SHIPMENT_ADDT_PRICE DESC) = 1
24 THEN
25 SHIPMENT_PRICE + (PRODUCT_QTY - 1) * SHIPMENT_ADDT_PRICE
26 ELSE
27 PRODUCT_QTY * SHIPMENT_ADDT_PRICE
28 END NEW_SHIP_PRICE
29 FROM shipment_table;
SHIPMENT_ID SHIPMENT_PRICE SHIPMENT_ADDT_PRICE PRODUCT_ID PRODUCT_QTY NEW_SHIP_PRICE
1000 6,95 2 11 4 12,95
1000 6,95 2 11 4 8
1000 6,95 2 11 4 8
1000 100,95 2 11 4 8
1001 12,95 2 11 4 18,95
1001 12,95 2 11 4 8
1001 12,95 2 11 4 8
1001 12,95 2 11 4 8
1002 20,95 1 12 2 21,95
1002 20,95 1 12 2 2
1002 20,95 1 12 2 2
1002 20,95 1 12 2 2
12 rows selected.My query:
SQL> with shipment_table as (
2 select 1000 SHIPMENT_ID, 6.95 SHIPMENT_PRICE, 2 SHIPMENT_ADDT_PRICE,
3 11 PRODUCT_ID, 4 PRODUCT_QTY, 1 VIRTUAL_COLUMN from dual union
4 select 1000,6.95,2,11,4,2 from dual union
5 select 1000,100.95,2,11,4,3 from dual union
6 select 1000,6.95,2,11,4,4 from dual union
7 select 1001,12.95,2,11,4,5 from dual union
8 select 1001,12.95,2,11,4,6 from dual union
9 select 1001,12.95,2,11,4,7 from dual union
10 select 1001,12.95,2,11,4,8 from dual union
11 select 1002,20.95,1,12,2,9 from dual union
12 select 1002,20.95,1,12,2,10 from dual union
13 select 1002,20.95,1,12,2,11 from dual union
14 select 1002,20.95,1,12,2,12 from dual)
15 SELECT shipment_id,
16 shipment_price,
17 shipment_addt_price,
18 product_id,
19 product_qty,
20 CASE
21 WHEN ROW_NUMBER() OVER (PARTITION BY shipment_id
22 ORDER BY shipment_addt_price DESC) = 1
23 THEN
24 (max(shipment_price) over (PARTITION BY shipment_id))
25 + (product_qty - 1) * shipment_addt_price
26 ELSE
27 product_qty * shipment_addt_price
28 END price
29 FROM shipment_table;
SHIPMENT_ID SHIPMENT_PRICE SHIPMENT_ADDT_PRICE PRODUCT_ID PRODUCT_QTY PRICE
1000 6,95 2 11 4 106.9500
1000 6,95 2 11 4 8.0000
1000 6,95 2 11 4 8.0000
1000 100,95 2 11 4 8.0000
1001 12,95 2 11 4 18.9500
1001 12,95 2 11 4 8.0000
1001 12,95 2 11 4 8.0000
1001 12,95 2 11 4 8.0000
1002 20,95 1 12 2 21.9500
1002 20,95 1 12 2 2.0000
1002 20,95 1 12 2 2.0000
1002 20,95 1 12 2 2.0000
12 rows selected.Max
http://oracleitalia.wordpress.com
Edited by: Massimo Ruocchio on Feb 12, 2010 3:10 PM
Added examples
Similar Messages
-
Hi everyone,
i have source table r_dott , column: Top_d, datatype: number
sample records:
2654.6559048
1446.800001
1438
1438.800001
6559048.2654
6559048.6559048
my requirement is before and after (.) i want six characters using sql query i.e, out put should get
2654.655904
1446.800001
1438
1438.800001
655904.2654
655904.655904
Edited by: karteek on Oct 9, 2012 7:11 AMkarteek wrote:
i think 9i will not support Regular expressions.
SQL> select top_d,
2 to_number(
3 case when top_d > 0 then
4 substr(to_char(top_d-(top_d-floor(top_d))),1,6)
5 else
6 substr(to_char(top_d+
7 (abs(top_d)-floor(abs(top_d)))),1,7) end) +
8 to_number(case when to_char(top_d) like '%.%'
9 then
10 substr(to_char(top_d),
11 instr(to_char(top_d),'.'),7)
12 else '0' end)*
13 decode(sign(top_d),-1,-1,1) t
14 from r_dott;
TOP_D T
124.776000976562 124.776
112.670997619629 112.670997
-.858999013900757 -.858999
302.476013183594 302.476013
289.075988769531 289.075988
27.4636993408203 27.463699
6.33843994140625 6.338439
-3.66371989250183 -3.663719
76.119499206543 76.119499
111.182998657227 111.182998
1247760009.76562 124776.76562
1126709976.19629 112670.19629
-123456789.663719 -123456.663719 -
Need sql query logic for requirement
Hi gurus,
i have requirement. please find below details.
For one item having lot of purchase orders,the output should display like that
Item Po Numbers FileName
==========================================
A 1,2,3 Http:\\\
B 4,5,6 Http:\\\
Please let me know is it possible to display similar kind of output.
Please share a code it will be much helpful.
Let us know if any concerns.
Thanks
ManjuHi,
Try something like:
WITH TAB AS
select 'A' ITEM, 1 PO_NUMBER, 'HTTP:\\\' FILENAME FROM DUAL UNION ALL
select 'A' ITEM, 2 PO_NUMBER, 'HTTP:\\\' FILENAME FROM DUAL UNION ALL
select 'A' ITEM, 3 PO_NUMBER, 'HTTP:\\\' FILENAME FROM DUAL UNION ALL
select 'B' ITEM, 4 PO_NUMBER, 'HTTP:\\\' FILENAME FROM DUAL UNION ALL
select 'B' ITEM, 5 PO_NUMBER, 'HTTP:\\\' FILENAME FROM DUAL UNION ALL
select 'B' ITEM, 6 PO_NUMBER, 'HTTP:\\\' FILENAME FROM DUAL
SELECT
ITEM
,LISTAGG(PO_NUMBER,',') WITHIN GROUP (ORDER BY PO_NUMBER) PO_NUMBERS
,MAX(FILENAME) FILENAME
FROM
TAB
GROUP BY
ITEM
ORDER BY
ITEM
ITEM PO_NUMBERS FILENAME
A 1,2,3 HTTP:\\\
B 4,5,6 HTTP:\\\
Regards,
Peter -
Extracting the Logical sql query for the specified report in OBIEE 11g
Hi ,
I want to extract the logical SQL Query for the Particular report in OBIEE 11.1.1.5.
Any pointers related to this will be very helpful.
Thanks,
Sonalifor a try please add Logical sql view to ur report it will dispaly the Logical sql for that Report..
Hope it will helps you. -
Creating logical view using sql query
hi
i'm new in OBIEE,
would like to know if its possible to create a custom view (logical table) by writing a sql query (without use the existing tables in the business model).
how can i do that? i didnt find the place where i can write the sql manually...
thanksNot in BMM layer but you can achieve this in Physical layer.
In physical layer --> Create New Physical Table --> select table type as Select -
How to calculate IO on SQL Query.
Hi all,
Could u please tell me how to calculate IO for specific SQL Query.
Regards,
Santosh.In what context you are looking the IO consumed for the query? One option you have got is Autotrace,another can be tracing the query and formatting the results using Tkprof.
Aman.... -
Informix / SQL Query to calculate Service Level Met %
Hi,
We have a client running UCCX 7.0 and we are upgrading it to 8.5.
They have a custom .net application that display different stats on IP Phone. I have converted all of them except i am having problem calculating Service Level Met %
Existing SQL query converts boolean into Float but Informix gives error that boolean can't be converted to float or integer.
here is part of existing query (SQl Server) to calculate service level met %
ROUND((SUM(CAST(ssl.metServiceLevel AS FLOAT))/COUNT(CAST(ssl.metServiceLevel AS FLOAT))) * 100,2) AS serviceLevelMet
I will greatly appreciate if anyone can help converting this query into Informix query format.
Thank youHi Sonain
Try this, it won't display a service level until you have received at least one call on the CSQ.
SELECT csqsum.CSQName,loggedInAgents,talkingAgents,availableAgents,workingAgents,reservedAgents,servicelevel
FROM RtCSQsSummary csqSum left outer join
(SELECT csqname, ROUND(sum(100 * (MetSL)/ (case when (MetSL + NotSL = 0) then 1 else (MetSL + NotSL) end)) ) as servicelevel
FROM(
SELECT
trim( csqname) csqname
,sum( case cqd.metServiceLevel when 't' then 1 else 0 end) MetSL
,sum( case cqd.metServiceLevel when 't' then 0 else 1 end) NotSL
FROM ContactServiceQueue csq
inner join contactqueuedetail cqd on cqd.targetID = csq.recordID
inner join contactroutingdetail crd on crd.sessionID = cqd.sessionID
inner join contactcalldetail ccd on crd.sessionID = ccd.sessionID
WHERE Date(current) - Date(crd.StartDateTime ) = 0
GROUP BY csqname
)z
GROUP BY z.csqname
)y
ON y.CSQName = csqsum.CSQName
Please rate helpfull posts.
Graham -
Cartesian join in the SQL query
Hi,
I have a problem when joining two tables that cannot join directly. As I read (please correct me if I'm wrong), two dims have to join by one fact in order to extract information from them. This way, I created logical source tables with SQL query that join both dims. So, if for example Dim A and Dim B cannot join directly, I created a "mapping table" which is a select that joins these 2 tables in the proper way and the fields are the row_wids from these tables. This way, I created the following model diagram for this relationship:
DimActivity -< FactMapping >- DimPNR
DimActivity -< FactActivity >- DimMapping
DimPNR -< FactPNR >- DimMapping
Now, I can extract information from both dims and their metrics, except in one case; If I extract info from ("Segment Designer") "Dim-Activity", "Dim-PNR", "Fact-Activity" and "Fact-PNR", I get a query that first calculates the metric from Activity, then calculates the metric from PNR, and when it joins both queries, I get cardinality because it doesn't join through the "mapping tables". The whole query is:
WITH
SAWITH0 AS (select sum(T690608."QTY") as c1,
T690608."ASSET_NUM" as c2
from "W_ASSET_D" T690608 /* Dim_W_ASSET_D */
group by T690608."ASSET_NUM"),
SAWITH1 AS (select sum(T682428."COST") as c1,
T682428."STATUS_WID" as c2
from "W_ACTIVITY_F" T682428 /* Dim_W_ACTIVITY_F */
group by T682428."STATUS_WID")
select distinct SAWITH0.c2 as c1,SAWITH1.c2 as c2,SAWITH1.c1 as c3,SAWITH0.c1 as c4
from
SAWITH0,SAWITH1
Why there is no condition joining SAWITH0 and SAWITH1? Is there a way to force this to be an inner join? I'm looking forward to your answer, since this problem is urgent within this project. Thank you in advanceOk.
I assume that you have for one activity several asset PNR and for one asset several activity.
The factPNR is on this way a real bridge table. It's a way to be able to design a many-to-many relationship.
Have a look here for more detail on how to build a many-to-many relationship :
http://gerardnico.com/wiki/dw/data_quality/relationships#many-to-many
Therefore I assume that you want this design :
DimActivity -< FactActivity >- < FactPNR >- DimPNR and you will have :
DimActivity -< FactActivity >- < BridgeTable >- DimPNR How to build your bridge table ?
In the physical layer, :
* create a new table BridgeActivityPNR, open it and select "statement"
* enter your sql statement
SELECT DISTINCT A.ROW_WID ACTIVIDAD_WID, B.ROW_WID ASSET_WID
FROM W_ACTIVITY_F A,
W_ASSET_D B,
W_SRVREQ_D C,
X_S_CMPT_MTRC_F D,
X_S_ASSET_FEA_D E
WHERE A.X_SRA_SR_ID=C.INTEGRATION_ID AND
C.X_VLG_FLIGHT_ID=D.X_ROW_ID AND
D.X_ROW_ID=E.X_CM_ID AND
E.X_ASSET_ID=B.X_ROW_ID* add two columns in the column tab : ACTIVIDAD_WID and ASSET_WID
* create the physical join with the table FactActivity and DimPNR
* drag and drop in the business model your table BridgeActivityPNR
* in the BMM, create the complex join like this :
DimActivity -< FactActivity >- < BridgeTable >- DimPNR * open your logical bridge table and check the bridge table option.
And you are done if I didn't forget anything.
A complete example here :
http://gerardnico.com/wiki/dat/obiee/obiee_bridge_table -
Hi all,
I think I'm being really stupid but I'm having SQL query issues.
I have a table with lots of lines of transactions which all refer to different stores, for example:
Store..............._Sales_............._Month_
Reading............200k..............April
Leeds...............50k................April
Manchester........70k................May
Reading............100k..............May
I need to come up with the average Sales for the combined months as a total. I.e. the average Store revenue for a given period is 200k+ 50k + 70k +100k / *3* (As there are only 3 unique stores) - hopefully this makes sense!
So essentially I am trying to do both a SUM query (and grouping by store) and then outputting the average of all stores together. Is this possible?
Thank you,Hello,
This query returns 140 what seems to be the correct value:
with data as
( select 'Reading' Store
, 200 sales
from dual
union
select 'Leeds'
, 50
from dual
union
select 'Manchester'
, 70
from dual
union
select 'Reading'
, 100
from dual
select sum(sales)
, count( distinct store )
, sum(sales)/count(distinct store)
from dataThere are multiple options:
1. You can get two IR's on one page (by using IFRAMEs - search for that word on the Forum)....
2. You create another region with the query above and position that just below the report
3. In the Region Footer call a PL/SQL process (using AJAX) that calculates the value using the query and prints it there (using htp.p)
Greetings,
Roel
http://roelhartman.blogspot.com/
http://www.bloggingaboutoracle.org/
http://www.logica.com/
You can award this reply to your question by marking it as either Helpful or Correct ;-) -
hi Experts,
while running SQL Query i am getting an error as
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
T2.LineText
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,T2.LineText
how to resolve the issueDear Meghanath,
Please use the following query, Hope your purpose will serve.
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
CAST(T2.LineText as nvarchar (MAX))[LineText]
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,CAST(T2.LineText as nvarchar (MAX))
Regards,
Amit -
How to run a SQL query which is stored in a column using PL/SQL?
Hello
I have a table A and one of the column values is select * from emp where empno :=xyz;
Now I would like to call this SQL query using a cursor in PL/SQL and run this for all the empno's and insert them into a temp table.
Can anybody help me in writing this PL/SQL query?
With Regards,
Mohanuser525114 wrote:
The primary reason for doing this is we are calculating percentiles on an entity sales for different range periods, and there are several sql queries stored in a cloumn, so we would like to know whether we can run these queries by calling them in a pl/sql query, Its not necessary that we need to use a cursor, but once fetching the result set of the query we would like to insert them in a table.Vamsi,
As said in response to Satya, executing dynamic SQL, looping over the result set and inserting the results one by one in a temporary table, is a horribly bad idea. Especially in terms of performance, but also regarding the maintainability of your code. It's just way more complex than necessary.
If you want to calculate percentages, then use analytic or aggregate functions in SQL to do so. If you want to store them, use a single INSERT SELECT statement.
If you want to continue on the same path, use Satya's code and use it inside a loop.
Regards,
Rob. -
How to configure a sql query of 110 lines in a DB Adapter
Hi all,
I have a sql query which is 110 lines and i need to use "select"operation in DB Adapter.I dont understand where to put the query in DB Adapter.I worked on a sql query which is 3 or 4 lines but this is the first time iam working on a sql Query with 110 lines.
Please help me.Give me sme link or any document that i can refer.
Thanks,
KiranHI,
Please use the option of Custom Sql and paste it there.
it does not matter what operation are you using but the xsd will form accordingly.
If you need to do only via Select operation in the wizard, than select the tables and add pararmeters in the next screen and try to give the logic there.
I feel the best thing to do would be with the Custom Sql query.
And whatever variables you need to pass dyanamically.
Just put an # symbol before to the column name .
The variable will be formed.
Thanks,
Tirumala Dixit. -
How to measure the performance of sql query?
Hi Experts,
How to measure the performance, efficiency and cpu cost of a sql query?
What are all the measures available for an sql query?
How to identify i am writing optimal query?
I am using Oracle 9i...
It ll be useful for me to write efficient query....
Thanks & Regardspsram wrote:
Hi Experts,
How to measure the performance, efficiency and cpu cost of a sql query?
What are all the measures available for an sql query?
How to identify i am writing optimal query?
I am using Oracle 9i... You might want to start with a feature of SQL*Plus: The AUTOTRACE (TRACEONLY) option which executes your statement, fetches all records (if there is something to fetch) and shows you some basic statistics information, which include the number of logical I/Os performed, number of sorts etc.
This gives you an indication of the effectiveness of your statement, so that can check how many logical I/Os (and physical reads) had to be performed.
Note however that there are more things to consider, as you've already mentioned: The CPU bit is not included in these statistics, and the work performed by SQL workareas (e.g. by hash joins) is also credited only very limited (number of sorts), but e.g. it doesn't cover any writes to temporary segments due to sort or hash operations spilling to disk etc.
You can use the following approach to get a deeper understanding of the operations performed by each row source:
alter session set statistics_level=all;
alter session set timed_statistics = true;
select /* findme */ ... <your query here>
SELECT
SUBSTR(LPAD(' ',DEPTH - 1)||OPERATION||' '||OBJECT_NAME,1,40) OPERATION,
OBJECT_NAME,
CARDINALITY,
LAST_OUTPUT_ROWS,
LAST_CR_BUFFER_GETS,
LAST_DISK_READS,
LAST_DISK_WRITES,
FROM V$SQL_PLAN_STATISTICS_ALL P,
(SELECT *
FROM (SELECT *
FROM V$SQL
WHERE SQL_TEXT LIKE '%findme%'
AND SQL_TEXT NOT LIKE '%V$SQL%'
AND PARSING_USER_ID = SYS_CONTEXT('USERENV','CURRENT_USERID')
ORDER BY LAST_LOAD_TIME DESC)
WHERE ROWNUM < 2) S
WHERE S.HASH_VALUE = P.HASH_VALUE
AND S.CHILD_NUMBER = P.CHILD_NUMBER
ORDER BY ID
/Check the V$SQL_PLAN_STATISTICS_ALL view for more statistics available. In 10g there is a convenient function DBMS_XPLAN.DISPLAY_CURSOR which can show this information with a single call, but in 9i you need to do it yourself.
Note that "statistics_level=all" adds a significant overhead to the processing, so use with care and only when required:
http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/
http://jonathanlewis.wordpress.com/2007/04/26/heisenberg/
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Update Field On Change For A SQL Query (updateable report)
Hi,
I'd like to request help from anyone with ideas on how to solve this.
We are using APEX 4.2, 10GR2, RedHat5.
I have a report that comes from SQL Query (updateable report).
I'm using the apex_item.text and apex_item.hidden on fields.
I'm using a button to submit and after submit process to add some logic that I need.
There could be 1 - 10 records in the report.
There is only 1 field that is needed to enter a value, but the value of this field determines the value of another field.
I think that I can do this with a submit button and an after submit process where I loop through all the records. I think I have this handled.
This is the question
When the value of that field is changed then the value of another field in the same row changes immediately.
Is this possible?
All the examples I've seen so far are for a single record and that doesn't work for us.
I guess this is a MRU process but I haven't seen an example where a dynamic action is possible on a Multi Row Update.
Could anyone direct me to where I can see an example or help me get directions?
I appreciate all your help an comments and I thank you in advance.Yes why not...what you looking for is a ajax call
See {message:id=10390979}
Please note:-you can also do this as a dynamic action as shown below
Event: Change
Selection type: jQuery Selector
jQuery Selector: input[name="f01"]
True action with Execute JavaScript Code and put all code inside the test funtion, you may need to amend the code to use this.triggeringElemnt in place of this -
How to get cm:search to use the max attribute when creating the SQL query?
When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work as intended, but the performance will be sub optimal when the SQL query returns unnecessary rows to the application.
We use the cm:search tag to list the latest news (ordered by date), and with the current implementation we have to expect a decrease in performance over time as more news is published. But we can’t live with that. We need to do the constraint in the SQL query, not in the application.
The sortBy attribute of cm:search is translated to “order by” in the SQL query, as expected.
Is it possible to get cm:search to generate the SQL query with an addition of “where rownum <= maxRows”?Hi Erik,
The behavior of a repository in regards to the search tag's max results parameter is dependent on the underlying repository's implementation. That said, the OOTB repository in WLP does augment the generated SQL to limit the number of rows returned from the database. This is done in the parsing logic. This behavior may differ with other repository implementations.
-Ryan
Maybe you are looking for
-
A few thoughts and experiences after a few hours using my new ThinkPad E440 with Win 8.1
After waiting 36 days for my new ThinkPad to arrive, I guess I'm just "eh" about it after using it some. Here are some of my thoughts, opinions, and experiences I've had after using it for a few hours... Hope this helps other people. I should not be
-
When I try to add my Apple ID to Facetime or iMessage, I get an error message "username or password is incorrect " even though its the same username and password I use for everything else. anyone else getting this problem?
-
Hello friends!! What 2T external HD should I buy for my macbook pro for photo, music and videos storage? Thank U!!
-
Hi Gurus, While creating PGI, it is picking one G/L account for Intercompany transaction. I have already checked in OBYC it is not there. Kindly let me know from where that a/c code is being picked during PGI. Kindly give your inputs.
-
How to clean tables in Ides database of Mobile Sales
Hello experts, I'm working with Mobile Sales v 4 SP08, and SQL Server 2000 Standard Edition. I have created a new extract for a site. In order to go faster loading the new extract synchronizing MSA client, how could I clean the Ides database into MSA