SQL & PL/SQL :: Strange Cost - Summary Lower Than Ingredients?

Aug 1, 2012

I've been experiencing strange Oracle behavior from time to time when using "explain plan". what could be the reason? (I'm going to create an Oracle ticket when I could find the cause...)

The total cost of a query was low (ex. ~500) while sub-parts of the query has high cost (ex. ~10000).I don't want to provide the query itself as the issue is observed for huge queries (like 2M characters!).The execution plan looks like this:

+- SELECT STATEMENT , ALL_ROWS, Cost 736
|
+--+- WINDOW SORT , Cost 736
|

[code]...

View 5 Replies


ADVERTISEMENT

Multi Table Query For A Summary Cost?

Aug 24, 2007

I'm wanting to create a query that will give me a summary of parts and labor from work orders. However there are three tables. work_order, parts, labor. Sometimes there will only be parts, sometimes just labor, or sometimes both. Well my query will only return results when they are on both. Sample query is below. Do I need to create a temp table to gather the data or is there a way to do this with a sub query.

select work_order.wono, sum(parts.cost), sum(labor.cost)
from work_order, parts, labor
where
work_order.wono = parts.wono and
work_order.wono = labor.wono
group by work_order.wono;

View 5 Replies View Related

Spatial :: Strange Lengths From SDO?

Oct 7, 2013

The SDO_LENGTH command appears to be giving us the length of only the first line segment in a mult-segmented polylines. ... For example..  for this

polyline.... MDSYS.SDO_GEOMETRY(3002,82212,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,4,2,1,2,1,7,2,2),MDSYS.SDO_ORDINATE_ARRAY(489308.53608219,5465823.43147879,0,489254.621813806,5465739.29869485,0,489223.453489433,5465690.81111309,0,489217.608149169,5465676.83952032,0,489213.696031073,5465662.20843221,0,489213.337168734,5465657.12388026,0,489213.259485918,5465652.02727197,0)) RunningUPDATE TEMP_1 SET LEN = SDO_GEOM.SDO_LENGTH (GEOMETRY,0.005,'unit=meter'); 

We get 99.925 meters,and not the 198.075 that we were expecting. 

View 5 Replies View Related

SQL & PL/SQL :: Strange Objects Of Type Table

Oct 9, 2010

When as scott, I run the following command select * from tab, I get the output that has been attached as pdf. This output contain some strange objects like-

BIN$Pjh/Uul1QJyWtCiF1oTUHQ==$0
BIN$fr3Ks/3LSdSHOFHhjdXCFQ==$0
BIN$ral0nTtJTG2f7dRgYXmCtQ==$0

and as per the attachment these are all of type table. When I try to delete them-

delete table BIN$ral0nTtJTG2f7dRgYXmCtQ==$0

I get the following error-

Error starting at line 1 in command:
delete table BIN$ral0nTtJTG2f7dRgYXmCtQ==$0
Error at Command Line:1 Column:7
Error report:
SQL Error: ORA-00903: invalid table name
00903. 00000 - "invalid table name"
*Cause:
*Action:

whether something is happening to the database?

View 2 Replies View Related

Server Utilities :: Import From 11g To 10g Results In Strange Errors

Jun 12, 2013

I wanted to migrate two schemas from:

Source Database machine OS: OEL 5.9 , 64-bit
Source Database version/addition: 11.2.0.1.0 SE

to:

Target Database machine OS: Red Hat Enterprise Linux Server release 5.4 , 64-bit
Target Database version/addition: 10.2.0.4.0 EE

Therefore, I did an export using Oracle Data Pump:

Export: Release 11.2.0.1.0 - Production on Tue Jun 11 13:13:28 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_04": system/******** directory=DATA_PUMP_DIR dumpfile=exp_PRODSCHEMAS_20130611.dmp schemas=PRD_100,SHR_100 logfile=exp_PRODSCHEMAS_20130611.log VERSION=10.2.0.4.0
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 1.026 GB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
[code]....

does it have to do with the VERSION parameter value? what can I check to investigate?

View 14 Replies View Related

Server Utilities :: Importing Into Lower Version Using (exp / Imp)

Jan 27, 2011

For importing higher version database exp dump e.g. 10g exp dump into 9i database it is suggested at many places "Always use a version of the EXPORT utility that is equal to the lowest version of either the source or the target database"

I understand from this is, I will be using 9i exp utility for exporting 10g database

I would like to know the ways it can be achieved.

1) Installing oracle 9i client on 10g database Do I still need to execute 9i catexp.sql after that? If answer to above is 'yes', I assume catexp.sql of 9i wont be created after 9i client is installed as such I will need to copy it from 9i database server and execute on 10g database server. Correct? For above question I have assumed catexp.sql has different contents for 9i and 10g

2) After configuring tns file in 9i database, can I use?

exp user/password@10gdbconnstring ....

(of course for small amount of data)

Is there any other option for achieving the same?

Also I understand export and import between any 9.* into any 9.* wont be issue e.g. import from 9.2 into 9.1 Similarly any 10.* to another 10.* wont be issue.

View 6 Replies View Related

SQL & PL/SQL :: How To Connect To Oracle 10g From Lower Client Version

Oct 6, 2010

We have a Oracle 10g database in the server. We are trying to connect to the server using oracle6 client and we are able to do so. How ever when retrieving the "time stamps" field , getting an error "ORA-03115: unsupported network datatype or representation". I understood from the error that, the client version need an upgrade.

How ever , We have another server which is having Oracle6 installed in the server and hence If i install/upgrade the client in my local system , I will be having trouble.

My question is , is there any way to get the timestamps from oracle6 client with out any issue.

View 5 Replies View Related

Server Administration :: Dropping Lower Case Tablespace

Nov 18, 2011

How can I drop a lower case tablespace name from my DB?

SQL> select * from v$version;
BANNER
------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
[code]....

View 2 Replies View Related

Server Utilities :: Importing Dump From Higher Database Version 2 Lower

Aug 3, 2010

We can Import dump from higher database version to lower database version.

View 26 Replies View Related

SQL & PL/SQL :: Units Of Cost?

Sep 28, 2010

I was questioned in an interview what is the unit of cost and based on what was it calculated.

View 1 Replies View Related

SQL & PL/SQL :: Sum (cost) Basing On ID Entered

Oct 1, 2012

my data :

id cost
aa_aa 100
ab_aa 100
bb_bb 100
ba_bb 100
ab_aa 100

I need to get my data as
if id like 'aa_%' then it should sum cost for ids for aa_aa and ab_aa and print only 1 row with putput as

id cost
aa_aa 300
If id is like 'ab_%' then it should sum up
ids only for ab_aa..
Output as:
id cost
ab_aa 200

View 7 Replies View Related

SQL & PL/SQL :: Finding The Cost Of Query

Sep 2, 2010

I am using oracle 10g, i want to know the cost of query. In the explain plan and by auto trace am able to get some query cost, but i dont know how to calculate the query cost.

How i will know the query is costly and take more time..? But i know about the hash table and nested tables in the explain plan.
Other than this how to calculate the query cost..?

View 5 Replies View Related

PL/SQL :: Lag Function Cost Almost All Of CPU Resource

May 24, 2013

select *from v$version where rownum=1;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

prepare data:
CREATE TABLE a AS SELECT LEVEL ID ,decode(mod(LEVEL,10),1,'CODE'||LEVEL) CODE from dual CONNECT BY LEVEL<20001;

sql1:
CREATE TABLE TEST AS
SELECT ID,
NVL(CODE,LAG(CODE ignore nulls) OVER(ORDER BY ID )) CODE
FROM a;

the sql is slow,most of the waits on session is resmgr:cpu quantum and almost all of the cpu resource is occupied

sql2:
CREATE TABLE TEST AS
SELECT ID,
NVL(CODE,last_value(CODE ignore nulls) OVER(ORDER BY ID ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)) CODE
FROM a;

this sql is fast

How lag function is implemented if the offset is not deterministic?

View 10 Replies View Related

SQL & PL/SQL :: Summary (Row To Column)

Jun 1, 2011

SQL summary for below data:

Table: temp_user_access
NAME Null? Type
------------------------------- --------- -----
USERGROUP VARCHAR2(255)
USERNAME NOT NULL VARCHAR2(40)
NICKNAME VARCHAR2(40)
AAACC VARCHAR2(70)
SYSTEM VARCHAR2(10)

I need the expected result as per attached photo

View 23 Replies View Related

SQL & PL/SQL :: Query Is Using More Cost When Executing Using DB Link?

Oct 5, 2010

I am trying to insert data from 9i to 11g using db link with the below query but while doing so the select statement is going for a full table scan even though rowid is used. But when we execute the same select statement without this insert command it is using proper index. Similar issues I am facing for updates.

Query:

INSERT INTO /*+ APPEND */ emp@db_link
select *
from emp where rowid ='AAC2SmAIIAAAHQgAAZ'

View 6 Replies View Related

Performance Tuning :: Low Cost And High Cpu?

Jul 23, 2010

I am facing one performance issue, in which the query cost is very low compare to cpu cost and as a result the cpu always show the high graph.I am also attaching the gv$sql and gv$sql_plan data of this query.

This is the query:

SELECT PTLS.ITEMTYPE , PTLS.ITEMID , PTLS.STAGEID, TS.USERID, SUM(PREVIOUSHOURS) AS PREVIOUSHOURS, MIN(STARTDATE) AS STARTDATE, MAX(STARTDATE) AS ENDDATE FROM PROJECTTIMELOGSSTAGE PTLS, PROJECTTIMESHEETITEM PTSI, TIMESHEET TS WHERE PTLS.PROJECTID = :B2 AND TS.TIMESHEETID = PTSI.TIMESHEETID AND TS.USERID = :B1 AND PTSI.TIMESHEETID = PTLS.TIMESHEETID AND PTSI.ITEMTYPE = PTLS.ITEMTYPE AND PTSI.ITEMID = PTLS.ITEMID AND (PTSI.ISPWFITEM = 'N' OR PTSI.ISPWFITEM IS NULL) AND PTLS.ITEMTYPE NOT IN ('OtherTsk','NewTsk','Loc','Glb') AND (PTLS.ITEMTYPE, PTLS.ITEMID ) IN (SELECT ITEMTYPE, ITEMID FROM PROJECTTIMELOGSSTAGE PTLS1 WHERE PTLS1.PROJECTID = :B2 AND PTLS1.TIMESHEETID = :B3 ) GROUP BY PTLS.ITEMTYPE, PTLS.ITEMID, PTLS.STAGEID, TS.USERID

View 17 Replies View Related

What Is Oracle Cost-Based Optimizer

Jun 3, 2013

what is oracle Cost-Based Optimizer? Any material easy to follow?

View 3 Replies View Related

How To Find Summary Value By Range

Jul 22, 2011

this is my table

create table sequence ( id int not null primary key);

insert into sequence(id) values
(1), (2), (3), (4), (6), (7), (8), (9),
(10), (15), (16), (17), (18), (19), (20),(22);

i need the answer to group the sequence like this

start_number | end_number | count
1 | 4 | 4
6 | 10 | 5
15 | 20 | 6
22 | 22 | 1

what should i do?

View 1 Replies View Related

SQL & PL/SQL :: How To Find Summary Value By Range

Jul 22, 2011

this is my table

create table sequence (
id int not null primary key
);

insert into sequence(id) values
(1), (2), (3), (4), (6), (7), (8), (9),
(10), (15), (16), (17), (18), (19), (20),(22);

i need the answer to group the sequence like this

start_number | end_number | count
1 | 4 | 4
6 | 10 | 5
15 | 20 | 6
22 | 22 | 1

what should i do?

View 7 Replies View Related

SQL & PL/SQL :: Summary Column To Details?

Sep 25, 2011

I have one table which has two columns name,qty and it has data like arif,3 pcs i want to display it in 3 lines if the qty is 3 and in 2 lines if the qty is 2 using sql query

View 6 Replies View Related

Performance Tuning :: Difference Between Cost And Bytes

Aug 4, 2010

I am working on Tuning a Materialized view. I was getting an error saying ORA-12008: error in materialized view refresh path

ORA-12801: error signaled in parallel query server P002, instance hrms-stg-db01:HRSTG1 (1)
ORA-01652: unable to extend temp segment by 16 in tablespace TEMP1.

so i increased the temp size. I am trying out various hints to get it rectified. But i am not sure if i should go for less cost or less bytes.

View 1 Replies View Related

Performance Tuning :: High CPU Cost And Low Optimizer?

Jan 22, 2009

how to reduce the cpu cost for a query at query level.

View 10 Replies View Related

Performance Tuning :: How To Reduce Cost Of Query

Mar 21, 2013

I have Following wjich takes some minutes to executes i want to be tune so this query Executes fast.

Query :

SELECT a.CHDR_EXCH_CD ,TMHR_EXCH_TM_CD,'S' Sec_type,
round(SUM (Decode(csdt_Depo_Typ,'I',(Cal_Scheme_Rate(csdt_rsm_code,TO_DATE(:P_DT_FR,'DD-MM-RR'),csdt_stsc_cd,csdt_scp_qty)*csdt_scp_qty)-
(Cal_Scheme_Rate(csdt_rsm_code,TO_DATE(:P_DT_FR,'DD-MM-

[Code]...

Explain Plan Result :

Plan
SELECT STATEMENT ALL_ROWS
Cost: 1,669 Bytes: 67 Cardinality: 1
15 HASH GROUP BY
Bytes: 67 Cardinality: 1
14 CONCATENATION

[Code].....

After i see result , no 4 in explain plan result gives TABLE ACCESS FULL . i want to be indexing on that how to do this..

This table MG_COLL_SCP_DTL have index like this

CREATE UNIQUE INDEX CSDT_PK ON MG_COLL_SCP_DTL
(CSDT_CHDR_TRANS_NUM, CSDT_PROD_TYP, CSDT_TRAN_SR_NO, CSDT_CHDR_CDTL_COLL_TYP, CSDT_CHDR_CDTL_COLL_TYP_CD,
CSDT_STSC_CD, CSDT_CHDR_CLNT_CD, CSDT_CHDR_CLNT_TM_CD)

[Code]....

How to Reduce cost ???

View 4 Replies View Related

Database - Summary Of Sales By Quarter?

Nov 30, 2010

I brought in the Northwind database 2003 in to SQL Developer. I was looking at the view 'Summary of Sales by Quarter' But this report brings in everything. It doesent give me summary of sales for Qtr1, Qtr4 etc

These are the columns:

ShippedDate
OrderId
Subtotal
CREATE OR REPLACE FORCE VIEW "NORTHWIND"."SUMMARY_OF_SALES_BY_QUARTER" ("SHIPPEDDATE", "ORDERID", "SUBTOTAL")
AS

[code]....

How can i recreate this view to show me summary data for qtr1, qtr2, qtr3 and qtr 4 for the year 1997??

View 1 Replies View Related

SQL & PL/SQL :: Summary Report From Detail Table

Mar 26, 2012

I have been sweating on this since the weekend.

My source table

SELECT
'182383' EMPLOYEE_NO
, 'ABACUS' FULL_NAME
, 'ADMIN' DEPARTMENT
, 'ADMIN' PREV_DEPARTMENT
, TO_DATE(20090104,'YYYYMMDD') EMP_START_DATE

[Code]....

EFFECTIVE_START_DATE: SCD field, Date ABACUS moves from one department to another.

EFFECTIVE_END_DATE: SCD field, Date ABACUS left the department from another. To keep history of movement.

The sample report shows possible scenario on my data.

I want to build monthly report to cater from departmental headcount on monthly basis, starting from from ABACUS start date.

see sample report below

MONTH | DEPARTMENT |NEW_HIRES | RELOCATION (OUT) | RELOCATION (IN) | NET TOTAL PREV MONTH | NET TOTAL PRESENT MONTH |
WHERE
MONTH: REPORT MONTH
DEPARTMENT: THE DEPARTMENTS IN THE ORGANIZATION
NEW_HIRES: NUMBER OF NEW STAFFS HIRED THAT MONTH BASE ON EMP_START_DATE
RELOCATION_OUT: NUMBER OF STAFFS MOVEMENT TO ANOTHER DEPARTMENT (EMP_END_DATE IS NULL, EFFECTIVE_START_DATE AND

[Code]....

View 4 Replies View Related

SQL & PL/SQL :: Procedure To Calculate Summary Session?

Aug 13, 2013

I have a below requirement from client.

Create a procedure generate_daily_session_summary that will read the pcm_session_summary (pk sess_id) table and create a per day summary in the pcm_session_summary_daily table.

1. Summarize all records from pcm_session_summary for session start timestamp (START_TS) greater than the max existing SESS_DT from pcm_session_summary_daily table and less than the start of current day. Insert the records into the pcm_session_summary_daily table.

2. Populate the fields in pcm_session_summary_daily as follows :

sess_dt - truncated date from pcm_session_summary.start_ts unique_user_cnt - count of unique cws ids encountered in that day, sess_cnt number - count of total sessions in that day , max_concurrent_sess_cnt number - maximum number of concurrent sessions at any point of time in that day. Concurrent sessions are defined as those that have overlapping start_ts or end_ts - sessions that were active at the same moment in time would be concurrent with each other.

3. The procedure will be scheduled to run every day in a batch job and will summarize session data until the end of the previous day

I have the table with below details.

desc PCM_SESSION_SUMMARY
Name Null Type
---------- -------- ------------
SESS_ID NOT NULL NUMBER
USER_CUPID VARCHAR2(10)
START_TS TIMESTAMP(6)
END_TS TIMESTAMP(6)
ACT_CNT NUMBER

[code]....

I have written the below query to get the result for question no:1

select trunc(start_ts,'DDD') start_ts,count(distinct(user_cupid)) user_cnt,count(SESS_ID) Sess_cnt
from PCM_SESSION_SUMMARY
where START_TS < sysdate or START_TS > (select max(sess_dt) from pcm_session_summary_daily where sess_dt < sysdate)
group by trunc(start_ts,'DDD')
order by start_ts;

However i tried a lot but not sure how to get maximum concurrent session count for a day.One of my friend comment below.

The Pcm_session_summary_daily is empty so you need to handle nulls when doing max. That will fix the issue of no results for the Greater Than condition.

You need to get concurrent count of sessions with respect to one another, the query that you have will not work. Do it in PL/SQL using procedural logic. The queries would return multiple rows, you need to handle that.

View 3 Replies View Related

PL/SQL :: An Extra Parameter For Summary Function

Dec 19, 2012

Why cant oracle give an extra parameter for summary function like MAX and MIN...For example

select max(salary,2)
from empWill give the second max salary.

View 11 Replies View Related

Reports & Discoverer :: Creating Summary Folders

Apr 9, 2013

we have just upgraded discoverer from 3.1 to 4.1

and we click on create summary folders we got this error Summary management not available because : this user has no privilige or quota to create materialized view in the current schema External summary registeration not available because : this user has no privilige or quota to create materialized view in the current schema

altough i granted privilige for materialized view

View 1 Replies View Related

Reports & Discoverer :: Detail And Summary In One Report

Aug 25, 2012

I have one group wise report and my requirement is i need to print both the Outputs in one single report first, is group with details and the summary in the last page showing machine code and summary of qty as totals ,I have given below test case .

create table ot_cut_detail (mach_code varchar2(12),batch_code varchar2(12),pos_no varchar2(12),pos_qty number)

insert into ot_cut_detail values ('L1','01','1001',2);
insert into ot_cut_detail values ('L1','01','1002',2);
insert into ot_cut_detail values ('L1','01','1003',2);
insert into ot_cut_detail values ('L2','01','1004',2);
insert into ot_cut_detail values ('L2','01','1005',2);

SQL> SELECT * FROM OT_CUT_DETAIL;

MACH_CODE BATCH_CODE POS_NO POS_QTY
------------ ------------ ------------ ---------
L1 01 1001 2
L1 01 1002 2
L1 01 1003 2
L2 01 1004 2
L2 01 1005 2

--Detailed output is like this as below

MACH_CODE BATCH_CODE POS_NO A
------------ ------------ ------------ ---------
L1 01 1001 2
1002 2
1003 2
L1 Total 6
L2 01 1004 2
1005 2
L2 Total 4
Grand 10

--Summary report will be as below both in one report.

MACH_CODE BATCH_CODE totals
------------ ------------ ---------
L2 01 4
L1 01 6

View 14 Replies View Related

Forms :: Taking Summary When Value In Field Changed?

Nov 25, 2010

I have a datablock like this

datablock name : jou_tra1_tab
No. of record dispalyed is 5

so datablock display like this

jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
----------------------------
ck_amt_tot

ck_amt is checkbox..
ck_amt_tot is total of jtt_amt_1 [but total only those record whose checkbox is checked]

My task is like this When i checked checkbox whatever value in jtt_amt transfer to jtt_amt_1 field

but i can change value in jtt_amt_1 field ...i want to take addition of that changed field and show that sumation in ck_amt_tot.

I write trigger when-checkbox-changed like this
-------------------------------------------------
IF :jou_tra1_tab.ck_amt = 'Y' THEN
set_item_INSTANCE_property ('jou_tra1_tab.jtt_amt_1',CURRENT_RECORD, UPDATE_ALLOWED, PROPERTY_TRUE);
:jou_tra1_tab.jtt_amt_1 := :jou_tra1_tab.jtt_amt;
else
:jou_tra1_tab.jtt_amt_1 := 0;
END IF;

and when validation item trigger for jtt_amt_1 :
--------------------------------------------------
IF :jou_tra1_tab.ck_amt = 'Y' then
:jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot + :jtt_amt_1 ;
else
:jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot - :jtt_amt_1 ;

But when i changed value in jtt_amt_1 field i cant get write summation .

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved