Same sql statement gives output in different lines in 12.1.3 vs 11i
Hi all,
DB:11.2.0.3.0
EBS:11i and 12.1.3
O/S: Solaris SPARC 64 bits 5.10
The below query gives the output in one line in 11i as expected but it gives the output in two separate lines in 12.1.3. Are there any server level settings for linesize and pagesize to be performed?
set term off;
set serveroutput on size 1000000;
set feedback off;
set pagesize 0;
set head off;
set linesize 72;
set pause off;
set colsep '';
select
lpad(code_combination_id,15,0)||
rpad(to_char(start_date_active,'YYYYMMDD'),8,' ')||
rpad(to_char(end_date_active,'YYYYMMDD'),8,' '),
substr(SEGMENT1,1,3)|| --entity
rpad(substr(SEGMENT2,1,6),6,' ')|| --account
rpad(substr(SEGMENT3,1,5),5,' ')|| --costcenter
rpad(substr(SEGMENT4,1,6),6,' ')|| --activity
substr(SEGMENT6,1,3)|| --product
substr(SEGMENT7,1,3)|| --service
substr(SEGMENT5,1,3)|| --country
substr(SEGMENT8,1,3)|| --intercompany
rpad(substr(SEGMENT9,1,8),8,' ')|| --regional
substr(enabled_flag,1,1) -- active flag
from gl_code_combinations
where last_update_date >=
(select nvl(max(actual_start_date),'01-JAN-1951')
from fnd_concurrent_requests
where concurrent_program_id = (select concurrent_program_id
from fnd_concurrent_programs
where
concurrent_program_name = 'XYZACCT')
and status_code = 'C'
and actual_completion_date is not null)
order by 1;
OUTPUT in 11i
============
00000000000100020120930 7014912000000000000000000000000000000000Y
00000000000100120120930 5014912000000000000000000000000000000000Y
OUTPUT in 12.1.3
==============
00000000000116020120930
4881124010000000000000000000000000000000Y
000000000001161
6103229990000000000000000000000000000000Y
11i and 12.1.3 should get the output in one line as per the above sql statement.
Could anyone please share the fix on the above issue?
Thanks for your time
Regards,
Hi,
Can you confirm in what session are you running this query.
Try this
Column Code_Date_Range format a25
Column Segments format a50
set lines 300
set pages 200
set term off;
set serveroutput on size 1000000;
set feedback off;
set pagesize 0;
set head off;
set linesize 72;
set pause off;
set colsep '';
select
lpad(code_combination_id,15,0)||
rpad(to_char(start_date_active,'YYYYMMDD'),8,' ')||
rpad(to_char(end_date_active,'YYYYMMDD'),8,' ') Code_Date_Range,
substr(SEGMENT1,1,3)|| --entity
rpad(substr(SEGMENT2,1,6),6,' ')|| --account
rpad(substr(SEGMENT3,1,5),5,' ')|| --costcenter
rpad(substr(SEGMENT4,1,6),6,' ')|| --activity
substr(SEGMENT6,1,3)|| --product
substr(SEGMENT7,1,3)|| --service
substr(SEGMENT5,1,3)|| --country
substr(SEGMENT8,1,3)|| --intercompany
rpad(substr(SEGMENT9,1,8),8,' ')|| --regional
substr(enabled_flag,1,1) Segments -- active flag
from gl_code_combinations
where last_update_date >=
(select nvl(max(actual_start_date),'01-JAN-1951')
from fnd_concurrent_requests
where concurrent_program_id = (select concurrent_program_id
from fnd_concurrent_programs
where
concurrent_program_name = 'XYZACCT')
and status_code = 'C'
and actual_completion_date is not null)
For more details, please see:
Formatting SQL*Plus Reports
Thanks &
Best Regards
Similar Messages
-
Multiple Executions Plans for the same SQL statement
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.
Below is the awrsqrpt's output for your reference.
WORKLOAD REPOSITORY SQL Report
Snapshot Period Summary
DB Name DB Id Instance Inst Num Release RAC Host
TESTDB 2157605839 TESTDB1 1 10.2.0.3.0 YES testhost1
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 32541 11-Oct-08 21:00:13 248 141.1
End Snap: 32542 11-Oct-08 21:15:06 245 143.4
Elapsed: 14.88 (mins)
DB Time: 12.18 (mins)
SQL Summary DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
Elapsed
SQL Id Time (ms)
51szt7b736bmg 25,131
Module: SQL*Plus
UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
TEST_BATCH_DT = (:B1 )
SQL ID: 51szt7b736bmg DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> 1st Capture and Last Capture Snap IDs
refer to Snapshot IDs witin the snapshot range
-> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
Plan Hash Total Elapsed 1st Capture Last Capture
# Value Time(ms) Executions Snap ID Snap ID
1 2960830398 25,131 1 32542 32542
2 3834848140 0 0 32542 32542
Plan 1(PHV: 2960830398)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 25,131 25,130.7 3.4
CPU Time (ms) 23,270 23,270.2 3.9
Executions 1 N/A N/A
Buffer Gets 2,626,166 2,626,166.0 14.6
Disk Reads 305 305.0 0.3
Parse Calls 1 1.0 0.0
Rows 371,735 371,735.0 N/A
User I/O Wait Time (ms) 564 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 1110 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS FULL | TEST | 116K| 2740K| 1110 (2)| 00:00:14 |
| 3 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 5 (0)| 00:00:01 |
| 4 | INDEX RANGE SCAN | ACCT_DT_ACC_IDX | 1 | | 4 (0)| 00:00:01 |
Plan 2(PHV: 3834848140)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 0 N/A 0.0
CPU Time (ms) 0 N/A 0.0
Executions 0 N/A N/A
Buffer Gets 0 N/A 0.0
Disk Reads 0 N/A 0.0
Parse Calls 0 N/A 0.0
Rows 0 N/A N/A
User I/O Wait Time (ms) 0 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 2 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 28 | 2 (0)| 00:00:01 |
| 3 | INDEX RANGE SCAN | TEST_DT_IND | 1 | | 1 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 4 (0)| 00:00:01 |
| 5 | INDEX RANGE SCAN | INDX_ACCT_DT | 1 | | 3 (0)| 00:00:01 |
Full SQL Text
SQL ID SQL Text
51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )Your input is highly appreciated.
Thanks for taking your time in answering my question.
RegardsOracle Lover3 wrote:
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.If you're using bind variables and you've histograms on your columns which can be created by default in 10g due to the "SIZE AUTO" default "method_opt" parameter of DBMS_STATS.GATHER__STATS it is quite normal that you get different execution plans for the same SQL statement. Depending on the values passed when the statement is hard parsed (this feature is called "bind variable peeking" and enabled by default since 9i) an execution plan is determined and re-used for all further executions of the same "shared" SQL statement.
If now your statement ages out of the shared pool or is invalidated due to some DDL or statistics gathering activity it will be re-parsed and again the values passed in that particular moment will determine the execution plan. If you have skewed data distribution and a histogram in place that reflects that skewness you might get different execution plans depending on the actual values used.
Since this "flip-flop" behaviour can sometimes be counter-productive if you're unlucky and the values used to hard parse the statement leading to a plan that is unsuitable for the majority of values used afterwards, 11g introduced the "adaptive" cursor sharing that attempts to detect such a situation and can automatically re-evaluate the execution plan of the statement.
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/ -
Different result from same SQL statement
The following SQL statement brings back records using query
analyzer on the SQL server. However when I run it in a cold fusion
page it comes back with no results. Any idea why????????
SELECT COUNT(h.userID) AS hits, u.OCD
FROM dbo.tbl_hits h INNER JOIN
dbo.tlkp_users u ON h.userID = u.PIN
WHERE (h.appName LIKE 'OPwiz%') AND (h.lu_date BETWEEN
'05/01/07' AND '06/01/07')
GROUP BY u.OCD
ORDER BY u.OCDAnthony Spears wrote:
> That didn't work either.
>
> But here is something interesting. If we use the dates
05/01/2007 and
> 06/01/2007 we get results in SQL Server Query Analyzer
but not using a cold
> fusion page. But if we use the dates 05/01/2007 and
09/01/2007 both get back
> the same results.
>
Are you absolutely, 100% sure that you are connecting to the
same
database instance with both CF and Query Analyzer? That kind
of symptom
is 9 out of 10 times because the user is looking at different
data. One
is looking at production and the other development or an
backup or
recent copy or something different. -
Pl/sql statement with output in reports
Hello,
I am quite new to reports and pl/sql, i have built a pl/sql statement with some loops that works fine when running it in sqlplus.
I would really like to have this running in reports with the variables (v_year, v_month and v_sumvalue) in a table/record in the data view, so i can use them just like any ordinary fields in a table for example in a diagram.
I have tried to create a package spec, setting up a record with the variables as fields. And then a pl/sql function with the following sql (which was a bit modified to work in the pl/sql function). Everything seemed to work since the pl/sql table/record was there with the variables as fields in it, but it never returned anything... just fatal error.
Here is the original pl/sql statement which is working in sqlplus, any help/directions in how to get this working so i can use the variables like fileds in a regular table would be fantastic:
DECLARE
v_year number(4);
v_month number(2);
v_sumvalue number(9,3);
v_sta varchar2(10);
v_end varchar2(10);
v_stopmonth number(2);
BEGIN
--## Get last 5 years ##--
select
to_char(add_months(sysdate,-60),'YYYY'),
to_char(sysdate,'MM')
into v_year, v_stopmonth
from
dual;
--dbms_output.put_line(v_year);
--## Loop 5 years ##--
for i in 1..5 loop
v_year := v_year + 1;
--dbms_output.put_line(v_year);
--## Loop 12 times (months) ##--
for k in 0..11 loop
v_month := k +1;
--dbms_output.put_line(v_year ||'-'|| v_month);
select
sum(nvl(p.value,0)) / 3,
last_day(add_months(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'),-3))+1,
last_day(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'))
into v_sumvalue, v_sta, v_end
from
project p
where
p.country_code = 'SWE'
and
p.project_type_code = 'P'
and
p.start_date between last_day(add_months(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'),-3))+1 and last_day(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'))
and
p.q_category_code between 1000 and 1299
and
p.geography_code between 2100 and 2199;
dbms_output.put_line(v_year ||'-'|| v_month ||' '|| v_sumvalue);
--dbms_output.put_line(v_year ||'-'|| v_month ||' '|| v_sumvalue ||' '|| v_sta ||' '|| v_end);
--## Stop monthloop ##--
end loop;
--## Stop yearloop ##-
end loop;
END;Output:
2003-1 19.1
2003-2 20.1
2007-11 164.5
2007-12 135.167Best regards,
OlleHi,
Maybe pipelined functions will be useful for you:
http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/x/Table_Functions_Cursor_Expressions/Pipelined_Table_Functions.htm
Regards
Jakub Flejmer -
Same sql statement two different results?
Hi,
I was wondering if anyone knows why I am getting different
results on the same query.
Basically... when I run this query in "view" in sql server, I
get the results I need, however when I run in Coldfusion, I am
getting totally different results.... It is a totally different
result...
the query:
SELECT DISTINCT
tbl_employees.indexid, tbl_employees.[Employee ID] as
employeeid, tbl_employees.[First Name] as firstname,
tbl_employees.[Last Name] as lastname,
tbl_employees.[Supervisor ID] as supervisorid,
tbl_workaddress_userdata.firstname,
tbl_workaddress_userdata.lastname,
tbl_workaddress_userdata.supervisorid,
tbl_workaddress_userdata.location,
tbl_workaddress_userdata.employeeid,
tbl_workaddress_userdata.locationdescription
FROM tbl_employees FULL OUTER JOIN
tbl_workaddress_userdata ON tbl_employees.[Employee ID] =
tbl_workaddress_userdata.employeeid
WHERE (tbl_employees.[Supervisor ID] = 7) AND
(tbl_workaddress_userdata.location IS NULL)I suspect you and your CF DSN are looking at two different
DBs...
Adam -
Same SQL Statement Works in Data Service but not in its Input Port
Hi Experts,
I am using this query in one of my data service. Test execute success which returned:
E U H M L
2 Less Than 1 Week 0 0 0 0 0
3 1 - 2 weeks 0 0 0 0 0
4 2 - 4weeks 0 0 0 0 0
5 More Than 1 Month 0 0 6 0 0
However, when i copy the same query to the input port, enclosing it with "[my query]"
Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
#1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
[EXCEPTION]
#1#java.lang.NullPointerException
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
Any idea what is the mistake?
Thanks in Advance,
SarahHi Experts,
I am using this query in one of my data service. Test execute success which returned:
E U H M L
2 Less Than 1 Week 0 0 0 0 0
3 1 - 2 weeks 0 0 0 0 0
4 2 - 4weeks 0 0 0 0 0
5 More Than 1 Month 0 0 6 0 0
However, when i copy the same query to the input port, enclosing it with "[my query]"
Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
#1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
[EXCEPTION]
#1#java.lang.NullPointerException
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
Any idea what is the mistake?
Thanks in Advance,
Sarah -
SQL statement gives a strange error
Hey!
We are running Oracle Database 10.2.0.2 x86_64 on SLES9
The statment is:
select distinct
p.PRIO_REF_NUM as "Prioriteet",
m.CODE as "Meede",
p.project_number as "Proj. nr.",
p.alternative_number as "Alternat. nr.",
p.project_name as "Proj. nimi",
i.type as "Ind. tüüp",
pi.indi_level as "Ind. level",
i.code as "Ind. kood",
i.name as "Ind. nimi",
pi.value_before as "Algväärtus",
pi.target_value as "Sihtmäär (arv)",
( select dv.text
from domain_value dv
where dv.DOMA_TYPE_CODE = i.CHOICE_DOMAIN
and dv.VALUE_CODE = pi.selected_choice
) as "Sihtmäär (tekst)",
( select avg( ip.CUMULATIVE_VALUE )
keep ( dense_rank first order by ip.report_date desc )
from PROJECT_INDICATOR_PROGRESS ip
where ip.PROJECT_INDICATOR_REF_NUM = pi.REF_NUM
-- väärtus raporteeritud enne kindlat kuupäeva
--AND ip.report_date <= to_date('15.10.2005', 'dd.mm.yyyy')
) as "Saavutusmäär",
( select ps.status_code
from project_status ps
where
ps.ref_num = (
select max(ps2.ref_num)
from project_status ps2
where ps2.project_ref_num = p.ref_num
and ps.project_ref_num = p.ref_num
) as "Projekti staatus"
from project p,
project_indicator pi,
indicator i
,measure m
,project_status ps
where p.ref_num = pi.PROJECT_REF_NUM
and i.ref_num = pi.INDICATOR_REF_NUM
AND m.REF_NUM = p.MEAS_REF_NUM
AND ps.PROJECT_REF_NUM = p.REF_NUM
AND ps.STATUS_CODE in ('ACCEPTED', 'FINISHED')
order by p.PRIO_REF_NUM, m.CODE, i.code;
And the error is ORA-03113: end-of-file on communication channel
Looked into alert log
ORA-07445: exception encountered: core dump [_intel_fast_memcpy.A()+10] [SIGSEGV] [Address not mapped to object] [0x2A97A67000] [] []
Searched metalink and google, but no help.
Any idea?This is likely an Oracle bug. You should contact Oracle support for this kind of errors.
-
SQL Statement taking different path on 2 servers
I ran the same SQL statement on two servers (8.1.7.3).
One is taking the index path and returns results quickly but the second server, which is our production server, is going about a very different path and timing out on the query. I ran the explain plan and see the differences.
How can I identify the cause to behave differently?
Can you suggest some ideas and steps that I can further
investigate?
Thanks, Moling1. The statistics are run nightly on all tables.
exec sys.dbms_stats.gather_schema_stats ...
2. What causes BITMAP CONVERSION (TO ROWIDS)and
BITMAP CONVERSION (From ROWIDS) that I see for table
U_SUPPLIER_PART_PLANT_MAP? This table has DOMAIN index.
FAST QUERY
==============
i p PLAN_PLUS_EXP OBJECT_N
0 SELECT STATEMENT optimizer=FIRST_ROWS (cost=123 card=1 bytes
=884)
1 0 NESTED LOOPS (cost=123 card=1 bytes=884)
2 1 NESTED LOOPS (OUTER) (cost=122 card=1 bytes=877)
3 2 NESTED LOOPS (OUTER) (cost=121 card=1 bytes=861)
4 3 NESTED LOOPS (cost=120 card=1 bytes=856)
5 4 NESTED LOOPS (cost=119 card=2 bytes=1658)
6 5 NESTED LOOPS (OUTER) (cost=118 card=3 bytes=2472
7 6 NESTED LOOPS (cost=117 card=3 bytes=2448)
8 7 NESTED LOOPS (cost=116 card=3 bytes=1506)
9 8 NESTED LOOPS (OUTER) (cost=115 card=3 byte
s=1284)
10 9 NESTED LOOPS (OUTER) (cost=114 card=3 by
tes=1260)
11 10 NESTED LOOPS (cost=113 card=3 bytes=12
39)
12 11 NESTED LOOPS (OUTER) (cost=112 card=
3 bytes=1161)
13 12 NESTED LOOPS (OUTER) (cost=111 car
d=3 bytes=1137)
14 13 NESTED LOOPS (OUTER) (cost=110 c
ard=3 bytes=1113)
15 14 NESTED LOOPS (cost=109 card=3
bytes=1089)
16 15 NESTED LOOPS (cost=101 card=
87 bytes=30798)
17 16 TABLE ACCESS (BY INDEX ROW
ID) of 'U_SUPPLIER_PART_PLANT_MAP' (cost=99 card=87 bytes=30
363)
18 17 DOMAIN INDEX of 'CTX_100
26328' (cost=88)
19 16 INDEX (UNIQUE SCAN) of 'UK
USITE1' UNIQUE)
20 15 TABLE ACCESS (BY INDEX ROWID
) of 'U_ORGANIZATION_DIMENSION' (cost=1 card=1 bytes=9)
21 20 INDEX (UNIQUE SCAN) of 'UK
UORGANIZATION_DIMENSION' UNIQUE)
22 14 TABLE ACCESS (BY INDEX ROWID)
of 'SPM_MATERIAL_GROUP' (cost=1 card=120 bytes=960)
23 22 INDEX (UNIQUE SCAN) of 'UK_S
PM_MATERIAL_GROUP' UNIQUE)
24 13 TABLE ACCESS (BY INDEX ROWID) of
'U_PURCHASING_GROUP' (cost=1 card=269 bytes=2152)
25 24 INDEX (UNIQUE SCAN) of 'UK_U_P
URCHASING_GROUP' UNIQUE)
26 12 TABLE ACCESS (BY INDEX ROWID) of '
SPM_UOM' (cost=1 card=428 bytes=3424)
27 26 INDEX (UNIQUE SCAN) of 'UK_SPM_U
OM' UNIQUE)
28 11 TABLE ACCESS (BY INDEX ROWID) of 'SP
M_SUPP_PART' (cost=1 card=423258 bytes=11004708)
29 28 INDEX (UNIQUE SCAN) of 'SYS_C00192
66' UNIQUE)
30 10 TABLE ACCESS (BY INDEX ROWID) of 'SPM_
CURRENCY' (cost=1 card=1 bytes=7)
31 30 INDEX (UNIQUE SCAN) of 'UK_SPM_CURRE
NCY' UNIQUE)
32 9 TABLE ACCESS (BY INDEX ROWID) of 'SPM_UO
M' (cost=1 card=428 bytes=3424)
33 32 INDEX (UNIQUE SCAN) of 'UK_SPM_UOM' UN
IQUE)
34 8 TABLE ACCESS (BY INDEX ROWID) of 'SPM_REFE
RENCE_ITEM1' (cost=1 card=385224 bytes=28506576)
35 34 INDEX (UNIQUE SCAN) of 'UK_SPM_REFERENCE
_ITEM11' UNIQUE)
36 7 TABLE ACCESS (BY INDEX ROWID) of 'SPD_MANUFA
CTURER_PART' (cost=1 card=385175 bytes=120944950)
37 36 INDEX (UNIQUE SCAN) of 'UK_SPD_MANUFACTURE
R_PART' UNIQUE)
38 6 TABLE ACCESS (BY INDEX ROWID) of 'SPM_UOM' (co
st=1 card=428 bytes=3424)
39 38 INDEX (UNIQUE SCAN) of 'UK_SPM_UOM' UNIQUE)
40 5 INDEX (UNIQUE SCAN) of 'UK_U_SUPPLIER' UNIQUE)
41 4 TABLE ACCESS (BY INDEX ROWID) of 'U_SUPPLIER_DIMEN
SION' (cost=1 card=2 bytes=54)
42 41 INDEX (UNIQUE SCAN) of 'UK_U_SUPPLIER_DIMENSION'
UNIQUE)
43 3 INDEX (UNIQUE SCAN) of 'UK_U_SUPPLIER' UNIQUE)
44 2 TABLE ACCESS (BY INDEX ROWID) of 'U_SUPPLIER_DIMENSION
' (cost=1 card=8276 bytes=132416)
45 44 INDEX (UNIQUE SCAN) of 'UK_U_SUPPLIER_DIMENSION' UNI
QUE)
46 1 TABLE ACCESS (BY INDEX ROWID) of 'S_ROT_CLASS' (cost=1 c
ard=12943407 bytes=90603849)
47 46 INDEX (UNIQUE SCAN) of 'UK_S_ROT_CLASS' UNIQUE)
48 rows selected.
SLOW QUERY
===========
i p PLAN_PLUS_EXP OBJECT_N
0 SELECT STATEMENT optimizer=FIRST_ROWS (cost=28278 card=52 by
tes=49452)
1 0 NESTED LOOPS (cost=28278 card=52 bytes=49452)
2 1 NESTED LOOPS (OUTER) (cost=28273 card=52 bytes=48932)
3 2 NESTED LOOPS (OUTER) (cost=28268 card=52 bytes=48412)
4 3 NESTED LOOPS (OUTER) (cost=28263 card=52 bytes=47892
5 4 NESTED LOOPS (cost=28257 card=52 bytes=47372)
6 5 NESTED LOOPS (cost=28252 card=52 bytes=46800)
7 6 NESTED LOOPS (cost=28251 card=52 bytes=46488)
8 7 NESTED LOOPS (OUTER) (cost=305 card=70 bytes
=37240)
9 8 NESTED LOOPS (OUTER) (cost=298 card=70 byt
es=36540)
10 9 NESTED LOOPS (cost=291 card=70 bytes=359
10)
11 10 NESTED LOOPS (cost=285 card=64 bytes=3
0784)
12 11 NESTED LOOPS (OUTER) (cost=279 card=
64 bytes=25792)
13 12 NESTED LOOPS (OUTER) (cost=272 car
d=64 bytes=24640)
14 13 NESTED LOOPS (OUTER) (cost=271 c
ard=64 bytes=24256)
15 14 NESTED LOOPS (cost=265 card=64
bytes=23616)
16 15 NESTED LOOPS (cost=7 card=2
bytes=72)
17 16 TABLE ACCESS (FULL) of 'U_
SUPPLIER_DIMENSION' (cost=6 card=2 bytes=60)
18 16 INDEX (UNIQUE SCAN) of 'UK
USUPPLIER' UNIQUE)
19 15 TABLE ACCESS (BY INDEX ROWID
) of 'SPD_MANUFACTURER_PART' (cost=129 card=375810 bytes=125
144730)
20 19 INDEX (RANGE SCAN) of 'NIS
_P649987' NON-UNIQUE)
21 14 TABLE ACCESS (BY INDEX ROWID)
of 'SPM_UOM' (cost=1 card=428 bytes=4280)
22 21 INDEX (UNIQUE SCAN) of 'UK_S
PM_UOM' UNIQUE)
23 13 INDEX (UNIQUE SCAN) of 'UK_U_SUP
PLIER' UNIQUE)
24 12 TABLE ACCESS (BY INDEX ROWID) of '
U_SUPPLIER_DIMENSION' (cost=1 card=8652 bytes=155736)
25 24 INDEX (UNIQUE SCAN) of 'UK_U_SUP
PLIER_DIMENSION' UNIQUE)
26 11 TABLE ACCESS (BY INDEX ROWID) of 'SP
M_REFERENCE_ITEM1' (cost=1 card=375842 bytes=29315676)
27 26 INDEX (UNIQUE SCAN) of 'UK_SPM_REF
ERENCE_ITEM11' UNIQUE)
28 10 TABLE ACCESS (BY INDEX ROWID) of 'SPM_
SUPP_PART' (cost=1 card=409148 bytes=13092736)
29 28 INDEX (RANGE SCAN) of 'NIS_P651218'
NON-UNIQUE)
30 9 TABLE ACCESS (BY INDEX ROWID) of 'SPM_CU
RRENCY' (cost=1 card=1 bytes=9)
31 30 INDEX (UNIQUE SCAN) of 'UK_SPM_CURRENC
Y' UNIQUE)
32 8 TABLE ACCESS (BY INDEX ROWID) of 'SPM_UOM'
(cost=1 card=428 bytes=4280)
33 32 INDEX (UNIQUE SCAN) of 'UK_SPM_UOM' UNIQ
UE)
34 7 TABLE ACCESS (BY INDEX ROWID) of 'U_SUPPLIER
PARTPLANT_MAP' (cost=28251 card=304053 bytes=110067186)
35 34 BITMAP CONVERSION (TO ROWIDS)
36 35 BITMAP AND
37 36 BITMAP CONVERSION (FROM ROWIDS)
38 37 INDEX (RANGE SCAN) of 'NIS_P651535'
NON-UNIQUE) (cost=765)
39 36 BITMAP CONVERSION (FROM ROWIDS)
40 39 SORT (ORDER BY)
41 40 DOMAIN INDEX of 'CTX_10026328' (co
st=25098 card=304053)
42 6 INDEX (UNIQUE SCAN) of 'UK_U_SITE1' UNIQUE)
43 5 TABLE ACCESS (BY INDEX ROWID) of 'U_ORGANIZATION
_DIMENSION' (cost=1 card=1 bytes=11)
44 43 INDEX (UNIQUE SCAN) of 'UK_U_ORGANIZATION_DIME
NSION' UNIQUE)
45 4 TABLE ACCESS (BY INDEX ROWID) of 'SPM_MATERIAL_GRO
UP' (cost=1 card=119 bytes=1190)
46 45 INDEX (UNIQUE SCAN) of 'UK_SPM_MATERIAL_GROUP' U
NIQUE)
47 3 TABLE ACCESS (BY INDEX ROWID) of 'U_PURCHASING_GROUP
' (cost=1 card=269 bytes=2690)
48 47 INDEX (UNIQUE SCAN) of 'UK_U_PURCHASING_GROUP' UNI
QUE)
49 2 TABLE ACCESS (BY INDEX ROWID) of 'SPM_UOM' (cost=1 car
d=428 bytes=4280)
50 49 INDEX (UNIQUE SCAN) of 'UK_SPM_UOM' UNIQUE)
51 1 TABLE ACCESS (BY INDEX ROWID) of 'S_ROT_CLASS' (cost=1 c
ard=13126048 bytes=131260480)
52 51 INDEX (UNIQUE SCAN) of 'UK_S_ROT_CLASS' UNIQUE)
53 rows selected. -
PASSING PARAMETER IN SQL STATEMENT .
HI,
Can any one tell me how to use on of the field name as a parameter in the same sql statement ? Here is what i am looking for :
SELECT EMPNO, DEPTNO, (SELECT COUNT(ORDERNO) FROM ORDERS WHERE DEPTNO = :DEPTNO AND EMPNO = :EMPNO) TOTAL_ORDER FROM EMP;
Here the embeded sql statment should take the paramter :DEPTNO , :EMPNO from the main sql statement. That means , each DEPTNO, EMPNO should be passed as a aparameter to the embeded SQL statement.
Thanks
FerozWHATS THE CONACT, ||, +, HOW TO USE IT, CAN U GIVE ME AN EXAMPLE.
SORRY , HERE IS THE ACTUAL THING WHAT I AM LOOKING FOR, I WANT TO GET THE MEDIAN AND MODE VALUE IN ORACLE, BUT COZ ORACLE DOES NOT HAVE IN BUILT FUNCTION TO ET THE ABOVE TOW , I WROTE MY SQL STATEMENTS, FOR EXAMPLE THE MEDIAN OF SAL FOR DEPT 20 IS IS
SELECT AVG(SAL) FROM
(SELECT RowNum The_Rownum, SAL FROM
(SELECT SAL FROM EMP WHERE DEPTNO = 20 ORDER BY 1)) V
WHERE V.The_Rownum = ( SELECT FLOOR((COUNT(SAL)+1)/2) FROM EMP WHERE DEPTNO = 20)
OR V.the_rownum = (SELECT CEIL((count(SAL)/2) + 1/2) FROM EMP WHERE DEPTNO = 20)
This median value ncalculation i can put in a functio and return it, but for a record os 1,800,000 volume, calling this function that many times, the sql never executes. It just hangs. so i thought if i can emabede the whole calculaton in the main sql statement instead of writing a function and calling that function in the sql statement. But the median calculation needs the department no as a parameter to calculate the median for that perticular department. Here , where the requirement of PARAMETER comes. ANY IDEA ???
Thanks
Feroz -
Explain plan for a sql statement
Hi,
I have a simple sql statement which has a cost of 122, cardinality 59 and CPU cost 1966777.
Same sql statement written in another way (using a nested select in the 'from' clause), has a cost of 58, cardinality 24 but cpu cost is much higher 29078895.
What should I look for? For a better cost overall, or for a better cpu cost? Which statement should I consider? What is most important?
Thanks.Roger25 wrote:
... Based on this, my question is what statement to choose? which is more important, the cost or the cpu cost?
Thanks.
Based on this, sorry, but my reply will remain unchanged:
Again, you cannot compare explain plan of two different queries.
Find out more:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:313416745628
Nicolas. -
Many sessions simultaneously executing a sql statement ?
Hi gurus,
I'm on a sittuation which affect to system performance. When i monitor current activities, i notice that many session is executing the same sql statement.
SPID SQL_ID
16133 5ptuft7h7y8jk
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
21385 9yayt7t5wsv07
It's up to 70-80 session executing one same sql. Is there any idea or suggest for this my case.
So thanks
ChYou could look at the SQL (from V$SQLSTATS, V$SQL or V$SQLAREA) and then determine what it is doing and then get some clues as to why one database has multiple executions of the SQL . Most developer leads would be able to say "ah ... this SQL is executed by this module in this part of the application when the user chooses this option". Then you figure out why you have multiple users choosing the option.
OR there could be dependencies between different statements or enqueue waits -- and multiple sessions waiting on the same lock !
Hemant K Chitale -
Position - images ouput on different lines
For some reason the images are output on different lines, how
can I make them be output on the same line? Thanks
<html><head><style>
#navimagel {
position:relative;
width:85px;
height:115px;
z-index:1;
left: 13px;
top: 0px;
clear: left;
#navimager {
position:relative;
width:239px;
height:90px;
z-index:2;
left: 550px;
top: 0px;
#logo {
position:relative;
width:238px;
height:73px;
z-index:3;
left: 100px;
top: 46px;
</style>
</head>
<body>
<div id="navimagel"><img
src="../images/lake3.jpg"></div>
<div id="logo"><img src="../images/lodgeadog.jpg"
/></div>
<div id="navimager"><img
src="../images/dog1.jpg"></div>
</body>
</html>Or try this -
#imagel {
width:85px;
height:115px;
float: left;
#navimager {
width:239px;
height:90px;
float:left;
#logo {
width:238px;
height:73px;
float:left;
</style>
</head>
<body>
<div id="images"><img id="imagel"
src="../images/lake3.jpg"><img
id="imagelogo" src="../images/lodgeadog.jpg" /><img
id="imager"
src="../images/dog1.jpg"></div>
</body>
</html>
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Hydrowizard" <[email protected]> wrote in
message
news:e6i632$q5m$[email protected]..
> For some reason the images are output on different
lines, how can I make
> them
> be output on the same line? Thanks
<html><head><style>
> #navimagel {
> position:relative;
> width:85px;
> height:115px;
> z-index:1;
> left: 13px;
> top: 0px;
> clear: left;
> }
> #navimager {
> position:relative;
> width:239px;
> height:90px;
> z-index:2;
> left: 550px;
> top: 0px;
> }
> #logo {
> position:relative;
> width:238px;
> height:73px;
> z-index:3;
> left: 100px;
> top: 46px;
> </style>
> </head>
>
> <body>
> <div id="navimagel"><img
src="../images/lake3.jpg"></div>
> <div id="logo"><img
src="../images/lodgeadog.jpg" /></div>
> <div id="navimager"><img
src="../images/dog1.jpg"></div>
> </body>
> </html>
> -
Assigning values to 2 fields using sql statement
db11g , apex 4.0 and firefox 24 ,
hi all ,
i am trying to follow this tutorial to assign values to 2 items on a page using sql statement ,
and i am using the same sql statement the tutorial uses
select d.loc location, count(e.empno) num_employees from dept d, emp e where d.deptno = e.deptno(+) and d.deptno = :P3_DEPTNO group by d.loc -- btw , what does the "+" sign mean?
after the e.deptno in the where condition .
but i am facing this error
1 error has occurred
Wrong number of columns selected in the SQL query. See Help of attribute for details.
and it does not work with two columns in the select statement under any conditions , i tried to remove the group function and the group clause ,
it does not work unless i use only one column in the select statement ??
thanksPars
And how exactly is this rewrite of the sql statement resolving the OP's issue.
You are still using more than 1 column which will still result in the error message:
Wrong number of columns selected in the SQL query.
As mentioned in my earlier post APEX 4.0 (the version the OP is using) does not handle a sql statement with multiple columns for the dynamic action Set Value.
Which means the fastest and simplest solution is splitting up the dynamic action in multiple Set Value actions.
Using this plugin or upgrade to a newer apex version would also be a possibility.
Nicolette -
Group by sql statement is not sorted.
execut sql statement include group by clause in a oci program, the result is not sorted.
I don't know why..
in SqlPlus, same sql statement return sorted data.
SELECT A.SHOP_ID,A.RESALE_TYPE,
SUM(A.DEAL_AMT,0) DEAL_AMT
FROM SHOP_ACC A, CD_TAB C
WHERE A.RESALE_TYPE = C.CD(+)
AND C.GB = 'AB'
AND A.ACC_M = :s_AccMonth
AND DEAL_GB='FOD'
GROUP BY A.SHOP_ID,A.RESALE_TYPE
But, RESALE_TYPE is outer join on CD_TAB..
if remove outer join between CD_TAB and SHOP_ACC,
sql statement is return sorted result.
and if modify the column RESALE_TYPE like
RESALE_TYPE||']' or NVL(RESALE_TYPE,'AAA')
return sorted result..
please help..
thanks for your kind.thank you.. for reply..
I knew that order by clause make to sort.
but, using group by clause alone in SQL statement, that return sorted results too.
I was found a fault that outer join table CD_TAB column of one is not symbloc "(+)" in SQL statement
SELECT A.SHOP_ID,A.RESALE_TYPE,
SUM(A.DEAL_AMT,0) DEAL_AMT
FROM SHOP_ACC A, CD_TAB C
WHERE A.RESALE_TYPE = C.CD(+)
AND C.GB = 'AB' <----------- AND C.GB(+) = 'AB'
AND A.ACC_M = :s_AccMonth
AND DEAL_GB='FOD'
GROUP BY A.SHOP_ID,A.RESALE_TYPE
I want to know that why in other application - such as SqlPlus or SqlGate and ..etc. - this fault was ignore.. but OCI application such as my application programs is not ignore.. and is not sorted..
thank you.. -
Maximum SQL statement on ODBC 8176 or higher ?
Hello.
I am developing a DB reporting program using ODBC.
My customer complained that the program shut down when query the SQL statement.
But, my computer didn't shut down when I queried the same SQL statement.
The difference is my customer used 8177 ODBC driver, but my computer installed 8176 driver, so I changed ODBC driver 8176 to 8177 and the problem appeared too.
I debugged and I found that the program shut down at SQLPrepare API.
The size of the SQL statement is 8238 bytes.
I tested and I found that the program shut down when the SQL statement size was around 5900bytes or larger.
I think, this is the Oracle ODBC drivers bug, does anybody meet the same problem?
I noticed to my customer this situation and he tried to downgrade ODBC driver 8177 to 8176 but he failed.
How can I solve this problem? I tried that the same SQL statement with OCI but it was no problem.I've never encountered a situation where the ODBC driver improperly handled a statement that the Oracle database could, and I've seen cases where the ODBC driver was given statements longer than Oracle's maximum.
My recollection is that Oracle itself doesn't support SQL statements longer than 8k (though I think it depends on the version of the database-- it may have been 4k in the past). If you want to generate SQL statements this long (and I'm not sure you do-- perhaps there are views, etc that you need to create to simplify your queries) you really ought to by using the DBMS_SQL package. You populate a table with 256 byte chunks of data and then call this package, so you can have infinitely long SQL statements.
Justin
Maybe you are looking for
-
Contabilização de Remessa em doação
Pessoal, Temos um item cadastrado em nosso sistema em que as contas contábeis são definidas pelo Grupo de Itens em que a conta de receita está criada como (Venda de Mercadorias - Matriz). Numa determinada operação teremos que enviar um destes produto
-
My Ipod nano doesn't want to turn on
Hey I hope someone can help me with this problem. I really don't know what to do. I was planning on restoring my Ipod, because my laptop indicated there was some kind of problem with Itunes.exe after I plugged it in. So I started up the Ipod Updater
-
How do I retrieve call history from my iPhone 4S? It only seems to log for about a month and I need an earlier date?
-
Hi all, I've written a very simple encrypter/decrypter using JCE and the sun provider. It seems to encrypt fine, but it doesn't decrypt at all. The code is below: import java.io.*; import java.net.*; import java.security.spec.*; import javax.crypto.*
-
Change Keyboard Layout, But Keep Language
I have a MacBook with USA keyboard layout. While installing, by mistake i selected Latin American keyboard. Now, i want my language to still be "Spanish/Argentina", but they keyboard layout should be USA. How can i do that? Note that I don't want to