Sql query not using parallel option
I am working in oracle 11.2.0.2.0 .
I am trying to execute one query using parallel options but in explain plan it is not using that PX option ...
UPDATE /*+PARALLEL (emp,4) */
cust_sku_allocation_data emp
set emp.mean=
(select sum(dep.stock_to_sales)/count(distinct dep.destination_facility)
FROM cust_sku_allocation dep
WHERE dep.stock_to_sales_ratio NOT IN (0,9999)
AND dep.sku_id = emp.sku_id);
Any idea where to check..
Sorry I meant:
You cannot parallelize UPDATE or DELETE operations on a nonpartitioned table, or when the update only affects 1 partition in a partitioned one.
Similar Messages
-
SQL Query not using Composite Index
Hi,
Please look at the below query:
SELECT pde.participant_uid
,pde.award_code
,pde.award_type
,SUM(decode(pde.distribution_type
,'FORFEITURE'
,pde.forfeited_quantity *
pde.sold_price * cc.rate
,pde.distributed_quantity *
pde.sold_price * cc.rate)) AS gross_Amt_pref_Curr
FROM part_distribution_exec pde
,currency_conversion cc
,currency off_curr
WHERE pde.participant_uid = 4105
AND off_curr.currency_iso_code =
pde.offering_currency_iso_code
AND cc.from_currency_uid = off_curr.currency_uid
AND cc.to_currency_uid = 1
AND cc.latest_flag = 'Y'
GROUP BY pde.participant_uid
,pde.award_code
,pde.award_type
In oracle 9i, i"ve executed this above query, it takes 6 seconds and the cost is 616, this is due to non usage of the composite index, Currency_conversion_idx(From_currency_uid, To_currency_uid, Latest_flag). I wonder why this index is not used while executing the above query. So, I've dropped the index and recreated it. Now, the query is using this index. After inserting many rows or say in 1 days time, if the same query is executed, again the query is not using the index. So everyday, the index should be dropped and recreated.
I don't want this drop and recreation of index daily, I need a permanent solution for this.
Can anyone tell me, Why this index goes stale after a period of time???? Please take some time and Solve this issue.
-SankarHi David,
This is Sankar here. Thankyou for your reply.
I've got the plan table output for this problematic query, please go thro' it and help me out why the index CURRENCY_CONVERSION_IDX is used now and why it's not using while executing the query after a day or inserting some records...
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 26 | 15678 | 147 |
| 1 | TABLE ACCESS BY INDEX ROWID | PART_AWARD_PAYOUT_SCHEDULE | 1 | 89 | 2 |
|* 2 | INDEX UNIQUE SCAN | PART_AWARD_PAYOUT_SCHEDULE_PK1 | 61097 | | 1 |
| 3 | SORT AGGREGATE | | 1 | 67 | |
|* 4 | FILTER | | | | |
|* 5 | INDEX RANGE SCAN | PART_AWARD_PAYOUT_SCHEDULE_PK1 | 1 | 67 | 2 |
| 6 | SORT AGGREGATE | | 1 | 94 | |
|* 7 | FILTER | | | | |
|* 8 | TABLE ACCESS BY INDEX ROWID | PART_AWARD_PAYOUT_SCHEDULE | 1 | 94 | 3 |
|* 9 | INDEX RANGE SCAN | PART_AWARD_PAYOUT_SCHEDULE_PK1 | 1 | | 2 |
|* 10 | FILTER | | | | |
|* 11 | HASH JOIN | | 26 | 15678 | 95 |
|* 12 | HASH JOIN OUTER | | 26 | 11596 | 91 |
|* 13 | HASH JOIN | | 26 | 10218 | 86 |
| 14 | VIEW | | 1 | 82 | 4 |
| 15 | SORT GROUP BY | | 1 | 116 | 4 |
|* 16 | TABLE ACCESS BY INDEX ROWID | PART_AWARD_LEDGER | 1 | 116 | 2 |
|* 17 | INDEX RANGE SCAN | PARTICIPANT_UID_IDX | 1 | | 1 |
|* 18 | HASH JOIN OUTER | | 26 | 8086 | 82 |
|* 19 | HASH JOIN | | 26 | 6006 | 71 |
| 20 | NESTED LOOPS | | 36 | 5904 | 66 |
| 21 | NESTED LOOPS | | 1 | 115 | 65 |
| 22 | TABLE ACCESS BY INDEX ROWID | CURRENCY_CONVERSION | 18 | 756 | 2 |
|* 23 | INDEX RANGE SCAN | KLS_IDX_CURRENCY_CONV | 3 | | 1 |
| 24 | VIEW | | 1 | 73 | 4 |
| 25 | SORT GROUP BY | | 1 | 71 | 4 |
| 26 | TABLE ACCESS BY INDEX ROWID| PART_AWARD_VALUE | 1 | 71 | 2 |
|* 27 | INDEX RANGE SCAN | PAV_PARTICIPANT_UID_IDX | 1 | | 1 |
| 28 | TABLE ACCESS BY INDEX ROWID | PARTICIPANT_AWARD | 199 | 9751 | 1 |
|* 29 | INDEX UNIQUE SCAN | PARTICIPANT_AWARD_PK1 | 100 | | |
|* 30 | INDEX FAST FULL SCAN | PARTICIPANT_AWARD_TYPE_PK1 | 147 | 9849 | 4 |
| 31 | VIEW | | 1 | 80 | 10 |
| 32 | SORT GROUP BY | | 1 | 198 | 10 |
|* 33 | TABLE ACCESS BY INDEX ROWID | CURRENCY_CONVERSION | 1 | 42 | 2 |
| 34 | NESTED LOOPS | | 1 | 198 | 8 |
| 35 | NESTED LOOPS | | 2 | 312 | 4 |
| 36 | TABLE ACCESS BY INDEX ROWID| PART_DISTRIBUTION_EXEC | 2 | 276 | 2 |
|* 37 | INDEX RANGE SCAN | IND_PARTICIPANT_UID | 1 | | 1 |
| 38 | TABLE ACCESS BY INDEX ROWID| CURRENCY | 1 | 18 | 1 |
|* 39 | INDEX UNIQUE SCAN | CURRENCY_AK | 1 | | |
|* 40 | INDEX RANGE SCAN | CURRENCY_CONVERSION_AK | 2 | | 1 |
| 41 | VIEW | | 1 | 53 | 4 |
| 42 | SORT GROUP BY | | 1 | 62 | 4 |
|* 43 | TABLE ACCESS BY INDEX ROWID | PART_AWARD_VESTING | 1 | 62 | 2 |
|* 44 | INDEX RANGE SCAN | PAVES_PARTICIPANT_UID_IDX | 1 | | 1 |
| 45 | TABLE ACCESS FULL | AWARD | 1062 | 162K| 3 |
| 46 | TABLE ACCESS BY INDEX ROWID | CURRENCY | 1 | 18 | 2 |
|* 47 | INDEX UNIQUE SCAN | CURRENCY_AK | 102 | | 1 |
Predicate Information (identified by operation id):
2 - access("PAPS"."AWARD_CODE"=:B1 AND "PAPS"."PARTICIPANT_UID"=4105 AND "PAPS"."AWARD_TYPE"=:B2
"PAPS"."INSTALLMENT_NUM"=1)
4 - filter(4105=:B1)
5 - access("PAPS"."AWARD_CODE"=:B1 AND "PAPS"."PARTICIPANT_UID"=4105 AND "PAPS"."AWARD_TYPE"=:B2)
7 - filter(4105=:B1)
8 - filter("PAPS"."STATUS"='OPEN')
9 - access("PAPS"."AWARD_CODE"=:B1 AND "PAPS"."PARTICIPANT_UID"=4105 AND "PAPS"."AWARD_TYPE"=:B2)
10 - filter("CC_A_P_CURR"."FROM_CURRENCY_UID"= (SELECT /*+ */ "CURRENCY"."CURRENCY_UID" FROM
"EWAPDBO"."CURRENCY" "CURRENCY" WHERE "CURRENCY"."CURRENCY_ISO_CODE"=:B1))
11 - access("SYS_ALIAS_7"."AWARD_CODE"="A"."AWARD_CODE")
12 - access("SYS_ALIAS_7"."AWARD_CODE"="PVS"."AWARD_CODE"(+))
13 - access("SYS_ALIAS_8"."AWARD_CODE"="PALS"."AWARD_CODE" AND
"SYS_ALIAS_8"."AWARD_TYPE"="PALS"."AWARD_TYPE")
16 - filter(TRUNC("PAL1"."LEDGER_ENTRY_DATE")<=TRUNC(SYSDATE@!) AND "PAL1"."ALLOC_TYPE"='IPU')
17 - access("PAL1"."PARTICIPANT_UID"=4105)
filter("PAL1"."PARTICIPANT_UID"=4105)
18 - access("SYS_ALIAS_8"."AWARD_CODE"="PDES"."AWARD_CODE"(+) AND
"SYS_ALIAS_8"."AWARD_TYPE"="PDES"."AWARD_TYPE"(+))
19 - access("SYS_ALIAS_7"."AWARD_CODE"="SYS_ALIAS_8"."AWARD_CODE")
23 - access("CC_A_P_CURR"."TO_CURRENCY_UID"=1 AND "CC_A_P_CURR"."LATEST_FLAG"='Y')
27 - access("PAV"."PARTICIPANT_UID"=4105)
filter("PAV"."PARTICIPANT_UID"=4105)
29 - access("SYS_ALIAS_7"."AWARD_CODE"="SYS_ALIAS_9"."AWARD_CODE" AND
"SYS_ALIAS_7"."PARTICIPANT_UID"=4105)
30 - filter("SYS_ALIAS_8"."PARTICIPANT_UID"=4105)
33 - filter("CC"."LATEST_FLAG"='Y')
37 - access("PDE"."PARTICIPANT_UID"=4105)
filter("PDE"."PARTICIPANT_UID"=4105)
39 - access("OFF_CURR"."CURRENCY_ISO_CODE"="PDE"."OFFERING_CURRENCY_ISO_CODE")
40 - access("CC"."FROM_CURRENCY_UID"="OFF_CURR"."CURRENCY_UID" AND "CC"."TO_CURRENCY_UID"=1)
43 - filter("PV"."VESTING_DATE"<=SYSDATE@!)
44 - access("PV"."PARTICIPANT_UID"=4105)
filter("PV"."PARTICIPANT_UID"=4105)
47 - access("CURRENCY"."CURRENCY_ISO_CODE"=:B1)
Note: cpu costing is off
93 rows selected.
Please help me out...
-Sankar -
Sql query not executed using recordset
Hi All,
I am trying to first format and then execute SQL query statement using recordset object with DI API. the issue is with vb.net's string formatting. I want to use 'USE [DB_Name]' statement in SQL and then 'Alter Procedure ..' statement. as this has to be the first statement in sql , I am using 'GO' in between and seperating each sentence with following syntax.
Dim AltProc as string
AltProc = " USE [DB_name]" & Environment.NewLine
AltProc = AltProc & " GO " & Environment.NewLine
AltProc = AltProc & " ALTER proc [proc_name] " & Environment.NewLine
'---------------------and so on
Orec.DoQuery(AltProc)
this formatting does not recognize new line and gives 'incorrect syntax near 'Go'' error. strange thing is, if I take this query in SQL, it runs perfectly and I can see it getting formatted with each new line created. I tried even VbcrLf but it didnt work.
any one has any idea?
thanks in advance,
BinitaHI Binita
The reason:
GO is the "command" delimiter of MS Query Editor.
It is not working with RecordSet Object.
In MS SQL 2008 version you can define the schema before the procedure name but in SQL server 2000/2005 it is not possible.
IN SQL 2008 use the Fully Qualified name instead of GO:
Dim AltProc as string
AltProc = " ALTER proc [DB_name].[dbo].[proc_name] " + vbcrlf
'---------------------and so on
Orec.DoQuery(AltProc)
it is not working on MS SQL 2008 i have tried.
'CREATE/ALTER PROCEDURE' does not allow specifying the database name as a prefix to the object name.'
Regards,
J.
Edited by: Janos Nagy on Jun 22, 2009 2:55 PM -
How to write a SQL Query without using group by clause
Hi,
Can anyone help me to find out if there is a approach to build a SQL Query without using group by clause.
Please site an example if is it so,
RegardsI hope this example could illuminate danepc on is problem.
CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
CREATE OR REPLACE FUNCTION GET_ARR return my_array
as
arr my_array;
begin
arr := my_array();
for i in 1..10 loop
arr.extend;
arr(i) := i mod 7;
end loop;
return arr;
end;
select column_value
from table(get_arr)
order by column_value;
select column_value,count(*) occurences
from table(get_arr)
group by column_value
order by column_value;And the output should be something like this:
SQL> CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
2 /
Tipo creato.
SQL>
SQL> CREATE OR REPLACE FUNCTION GET_ARR return my_array
2 as
3 arr my_array;
4 begin
5 arr := my_array();
6 for i in 1..10 loop
7 arr.extend;
8 arr(i) := i mod 7;
9 end loop;
10 return arr;
11 end;
12 /
Funzione creata.
SQL>
SQL>
SQL> select column_value
2 from table(get_arr)
3 order by column_value;
COLUMN_VALUE
0
1
1
2
2
3
3
4
5
6
Selezionate 10 righe.
SQL>
SQL> select column_value,count(*) occurences
2 from table(get_arr)
3 group by column_value
4 order by column_value;
COLUMN_VALUE OCCURENCES
0 1
1 2
2 2
3 2
4 1
5 1
6 1
Selezionate 7 righe.
SQL> Bye Alessandro -
SQL query not calculating
gross_amount is giving the value of extended_amount and the gross_price_rc is giving the value of unit_selling_price
select customer_trx_line_id,
( extended_amount / 1- (decode(decode(attribute6,null,0)+decode(attribute7,null,0)+decode(attribute8,null,0)+decode(attribute9,null,0)/100,null,0,1,0))) GROSS_AMOUNT,
( unit_selling_price /1-(decode(decode(attribute6,null,0)+decode(attribute7,null,0)+decode(attribute8,null,0)+decode(attribute9,null,0)/100,null,0,1,0))) gross_price_rc
from ra_customer_trx_lines_all
where attribute6 is not null or attribute7 is not null or attribute8 is not null or attribute9 is not null
whats the isuue here??
Thanksdecode(attribute7,null,0)Looking at it again, this always returns 0 or NULL, so it not really surprising
DECODE
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions040.htm#i1017437
CASE
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions004.htm#i1033392 -
Why is this query not using the index?
check out this query:-
SELECT CUST_PO_NUMBER, HEADER_ID, ORDER_TYPE, PO_DATE
FROM TABLE1
WHERE STATUS = 'N'
and here's the explain plan:-
1
2 -------------------------------------------------------------------------------------
3 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
4 -------------------------------------------------------------------------------------
5 | 0 | SELECT STATEMENT | | 2735K| 140M| 81036 (2)|
6 |* 1 | TABLE ACCESS FULL| TABLE1 | 2735K| 140M| 81036 (2)|
7 -------------------------------------------------------------------------------------
8
9 Predicate Information (identified by operation id):
10 ---------------------------------------------------
11
12 1 - filter("STATUS"='N')
There is already an index on this column, as is shown below:-
INDEX_NAME INDEX_TYPE UNIQUENESS TABLE_NAME COLUMN_NAME COLUMN_POSITION
1 TABLE1_IDX2 NORMAL NONUNIQUE TABLE1 STATUS 1
2 TABLE1_IDX NORMAL NONUNIQUE TABLE1 HEADER_ID 1
So why is this query not using the index on the 'STATUS' Column?
I've already tried using optimizer hints and regathering the stats on the table, but the execution plan still remains the same, i.e. it still uses a FTS.
I have tried this command also:-
exec dbms_stats.gather_table_stats('GECS','GEPS_CS_SALES_ORDER_HEADER',method_opt=>'for all indexed columns size auto',cascade=>true,degree=>4);
inspite of this, the query is still using a full table scan.
The table has around 55 Lakh records, across 60 columns. And because of the FTS, the query is taking a long time to execute. How do i make it use the index?
Please help.
Edited by: user10047779 on Mar 16, 2010 6:55 AMIf the cardinality is really as skewed as that, you may want to look at putting a histogram on the column (sounds like it would be in order, and that you don't have one).
create table skewed_a_lot
as
select
case when mod(level, 1000) = 0 then 'N' else 'Y' end as Flag,
level as col1
from dual connect by level <= 1000000;
create index skewed_a_lot_i01 on skewed_a_lot (flag);
exec dbms_stats.gather_table_stats(user, 'SKEWED_A_LOT', cascade => true, method_opt => 'for all indexed columns size auto');Is an example. -
Using Parameters in SQL-Query not only in where clauses
Hi,
I try to use Publisher parameters in the SQL Query from a Data Set.
All of them have default values.
So far, this is no problem, unless I try to use such a parameter value as an ordinary attribute value:
>
select
case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."BETR_TEIL"
else :pv_some_Text end as Betr_Teil,
case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM"
else :pv_some_Text end as Suva_Nr,
case when (:pv_Group = 'no') then "DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH"
else sum("DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") end as Vollbesch
from "GDWH05"
where
"DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in (:pv_nim100)
fetch first 65001 rows ONLY
>
The parameters 'pv_Group' and 'pv_nim100' are working fine. (when or where clauses)
The parameter 'pv_some_Text' unfortunately not. (simple literals)
When I try to validate the above SQL, I get the following Error:
<font color="red">
java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46033] Datatype: 25 is not supported.
</font>
After use a cast function:
>
else CAST(:pv_some_Text AS CHARACTER)
>
I get this ERROR:
<font color="red">
java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 19002] Incorrect use of parameters. The parameters used in CAST cannot be resolved without ambiguity.
</font>
We use OBIEE 11.1.1.6.4 on a Win64-System.
Thank's for any help.Hi Alex,
let's leave away any unnecessary details.
This is the SQL, inserted in the window 'Edit Data Set' of BIP Data Model:
>
select
'--1' as Betr_Teil,
'--2' as Suva_Nr,
sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
from "GDWH05"
where
"DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
fetch first 65001 rows ONLY
>
Everything is fine when I click OK, the script goes back to the metadata.
Let's try this script with bind values in ORACLE SQL Developer.
This SQL is the physical part, found in the OBIEE-Log (Log level 5), except the bind values. Therefore we find, in the where clause, the join. In the logical sql, we don't have to join, because it's handled in the Common Enterprise Information Model (CEIM)
>
with
sawith0 as
select
sum(t39617.ris_vollbesch) as c1
from
dm15d_betriebsteil t39455,
dm15k_ris_fakten_pro_btt_jhr t39617
where
t39455.id_betriebsteil = t39617.id_betriebsteil
and t39455.suva_nr_form = '122-4.4'
select
d1.c1 as c1,
d1.c2 as c2,
d1.c3 as c3
from
select
:pv_some_text as c1,
:pv_some_text as c2,
sum(d1.c1) as c3
from
sawith0 d1
d1
where
rownum <= 65001
>
This SQL works fine, even with bind values for 'pv_some_text'.
But, when using the following SQL in the BIP Data Model:
>
select
:pv_Text as Betr_Teil,
:pv_Text as Suva_Nr,
sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
from "GDWH05"
where
"DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
fetch first 65001 rows ONLY
>
The following ERROR occurs:
<font color="red">java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\ServiceInterfaceMgr\Utility\Src\SQOIUTypeVisitor.cpp, line 643.</font>
In my opinion, either I use a wrong syntax, or BIP has a problem with parsing the script.
Thank you for your most welcome help. -
Set Column width in query (not using SQL*Plus)
How can I Set Column width in query
I understand you can set column width using
column col1 FORMAT A5
select col1 from table1;But this only works in SQL*Plus
I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
I am using a 'SQL window' in PL/SQL Developer IDE
and when I use this syntax it says:
ORA-00900: Invalid SQL statement
Any suggestions are appreciated...
thanks,
M.Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
e.g.
SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM -
select *
from hrm_career x
WHERE x.begin_date = ( SELECT MAX(begin_date)
FROM hrm_career y
WHERE y.employee_id = x.employee_id AND
begin_date <= SYSDATE AND
primary_job = 'Y') AND
x.primary_job = 'Y'
I have the above query which is not using the index created on the BEGIN_DT column
I tried to force using still not using
but when i apply a value say
select *
from hrm_career x
WHERE x.begin_date ='10-20-2007'
It is using index and resulting in very fast response
Can some throw some ideas on it...
Where should i look into here ..SQL> set autotrace traceonly
SQL> select *
2 from hrm_career x
3 WHERE x.begin_date = ( SELECT MAX(begin_date)
4 FROM hrm_career y
5 WHERE y.employee_id = x.employee_id AND
6 begin_date <= SYSDATE AND
7 primary_job = 'Y') AND
8 x.primary_job = 'Y';
13454 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1417 Card=152 Bytes=
35568)
1 0 FILTER
2 1 SORT (GROUP BY) (Cost=1417 Card=152 Bytes=35568)
3 2 HASH JOIN (Cost=254 Card=47127 Bytes=11027718)
4 3 INDEX (FAST FULL SCAN) OF 'HRM_CAREER_PK' (UNIQUE) (
Cost=12 Card=25026 Bytes=500520)
5 3 TABLE ACCESS (FULL) OF 'HRM_CAREER' (Cost=81 Card=25
335 Bytes=5421690)
Statistics
3671 recursive calls
9 db block gets
1758 consistent gets
2130 physical reads
0 redo size
2217762 bytes sent via SQL*Net to client
10359 bytes received via SQL*Net from client
898 SQL*Net roundtrips to/from client
128 sorts (memory)
1 sorts (disk)
13454 rows processed
TKPROF
TKPROF: Release 9.2.0.6.0 - Production on Wed Dec 12 18:40:56 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Trace file: qnhg_ora_500.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
ALTER SESSION SET EVENTS '10046 trace name context forever, level 8'
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 1 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 34.45 34.45
select condition
from
cdef$ where rowid=:1
call count cpu elapsed disk query current rows
Parse 4 0.00 0.00 0 0 0 0
Execute 4 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 0 8 0 4
total 12 0.00 0.00 0 8 0 4
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 TABLE ACCESS BY USER ROWID CDEF$
select *
from hrm_career x
WHERE x.begin_date = ( SELECT MAX(begin_date)
FROM hrm_career y
WHERE y.employee_id = x.employee_id AND
begin_date <= SYSDATE AND
primary_job = 'Y') AND
x.primary_job = 'Y'
call count cpu elapsed disk query current rows
Parse 1 0.00 0.07 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 898 0.00 2.39 2038 946 9 13454
total 900 0.00 2.46 2038 946 9 13454
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
Rows Row Source Operation
13454 FILTER
25335 SORT GROUP BY
67496 HASH JOIN
25333 INDEX FAST FULL SCAN HRM_CAREER_PK (object id 25292)
25336 TABLE ACCESS FULL HRM_CAREER
Rows Execution Plan
0 SELECT STATEMENT GOAL: CHOOSE
13454 FILTER
25335 SORT (GROUP BY)
67496 HASH JOIN
25333 INDEX GOAL: ANALYZED (FAST FULL SCAN) OF 'HRM_CAREER_PK'
(UNIQUE)
25336 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'HRM_CAREER'
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 898 0.00 0.00
SQL*Net more data to client 877 0.00 0.05
db file sequential read 1 0.01 0.01
db file scattered read 60 0.00 0.14
direct path write 9 0.00 0.00
direct path read 125 0.05 0.13
SQL*Net message from client 898 0.02 1.47
DELETE FROM PLAN_TABLE
WHERE
STATEMENT_ID=:1
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 6 6 6
Fetch 0 0.00 0.00 0 0 0 0
total 4 0.00 0.00 0 6 6 6
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
Rows Row Source Operation
0 DELETE
0 TABLE ACCESS FULL PLAN_TABLE
Rows Execution Plan
0 DELETE STATEMENT GOAL: CHOOSE
0 DELETE OF 'PLAN_TABLE'
0 TABLE ACCESS (FULL) OF 'PLAN_TABLE'
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 14.77 14.79
select o.owner#,o.name,o.namespace,o.remoteowner,o.linkname,o.subname,
o.dataobj#,o.flags
from
obj$ o where o.obj#=:1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 3 0 1
total 3 0.00 0.00 0 3 0 1
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: SYS (recursive depth: 1)
EXPLAIN PLAN SET STATEMENT_ID='PLUS74964' FOR select *
from hrm_career x
WHERE x.begin_date = ( SELECT MAX(begin_date)
FROM hrm_career y
WHERE y.employee_id = x.employee_id AND
begin_date <= SYSDATE AND
primary_job = 'Y') AND
x.primary_job = 'Y'
call count cpu elapsed disk query current rows
Parse 1 0.00 0.01 0 4 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.01 0 4 0 0
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
insert into plan_table (statement_id, timestamp, operation, options,
object_node, object_owner, object_name, object_instance, object_type,
search_columns, id, parent_id, position, other,optimizer, cost, cardinality,
bytes, other_tag, partition_start, partition_stop, partition_id,
distribution, cpu_cost, io_cost, temp_space, access_predicates,
filter_predicates )
values
(:1,SYSDATE,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,:19,
:20,:21,:22,:23,:24,:25,:26,:27)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 6 0.00 0.00 0 3 6 6
Fetch 0 0.00 0.00 0 0 0 0
total 7 0.00 0.00 0 3 6 6
Misses in library cache during parse: 1
Misses in library cache during execute: 2
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN) (recursive depth: 1)
Rows Execution Plan
0 INSERT STATEMENT GOAL: CHOOSE
select o.name, u.name
from
sys.obj$ o, sys.user$ u where obj# = :1 and owner# = user#
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 0 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 1 0.00 0.00 0 0 0 0
Misses in library cache during parse: 1
Parsing user id: SYS (recursive depth: 1)
SELECT ID ID_PLUS_EXP,PARENT_ID PARENT_ID_PLUS_EXP,LPAD(' ',2*(LEVEL-1))
||OPERATION||DECODE(OTHER_TAG,NULL,'','*')||DECODE(OPTIONS,NULL,'','
('||OPTIONS||')')||DECODE(OBJECT_NAME,NULL,'',' OF '''||OBJECT_NAME||'''')
||DECODE(OBJECT_TYPE,NULL,'',' ('||OBJECT_TYPE||')')||DECODE(ID,0,
DECODE(OPTIMIZER,NULL,'',' Optimizer='||OPTIMIZER))||DECODE(COST,NULL,'','
(Cost='||COST||DECODE(CARDINALITY,NULL,'',' Card='||CARDINALITY)
||DECODE(BYTES,NULL,'',' Bytes='||BYTES)||')') PLAN_PLUS_EXP,OBJECT_NODE
OBJECT_NODE_PLUS_EXP
FROM
PLAN_TABLE START WITH ID=0 AND STATEMENT_ID=:1 CONNECT BY PRIOR ID=PARENT_ID
AND STATEMENT_ID=:1 ORDER BY ID,POSITION
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 0 22 0 6
total 4 0.00 0.00 0 22 0 6
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
Rows Row Source Operation
6 SORT ORDER BY
6 CONNECT BY WITH FILTERING
1 NESTED LOOPS
1 TABLE ACCESS FULL PLAN_TABLE
1 TABLE ACCESS BY USER ROWID PLAN_TABLE
5 NESTED LOOPS
6 BUFFER SORT
6 CONNECT BY PUMP
5 TABLE ACCESS FULL PLAN_TABLE
Rows Execution Plan
0 SELECT STATEMENT GOAL: CHOOSE
6 SORT (ORDER BY)
6 CONNECT BY (WITH FILTERING)
1 NESTED LOOPS
1 TABLE ACCESS (FULL) OF 'PLAN_TABLE'
1 TABLE ACCESS (BY USER ROWID) OF 'PLAN_TABLE'
5 NESTED LOOPS
6 BUFFER (SORT)
6 CONNECT BY PUMP
5 TABLE ACCESS (FULL) OF 'PLAN_TABLE'
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 0.09 0.09
SELECT ID ID_PLUS_EXP,OTHER_TAG OTHER_TAG_PLUS_EXP,OTHER OTHER_PLUS_EXP
FROM
PLAN_TABLE WHERE STATEMENT_ID=:1 AND OTHER_TAG IS NOT NULL ORDER BY ID
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 3 0 0
total 3 0.00 0.00 0 3 0 0
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
Rows Row Source Operation
0 SORT ORDER BY
0 TABLE ACCESS FULL PLAN_TABLE
Rows Execution Plan
0 SELECT STATEMENT GOAL: CHOOSE
0 SORT (ORDER BY)
0 TABLE ACCESS (FULL) OF 'PLAN_TABLE'
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 0.00 0.00
ALTER SESSION SET EVENTS '10046 trace name context off'
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 0
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 30 (ADMIN)
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 7 0.00 0.09 0 4 0 0
Execute 8 0.00 0.00 0 6 6 6
Fetch 901 0.00 2.39 2038 971 9 13460
total 916 0.00 2.49 2038 981 15 13466
Misses in library cache during parse: 6
Misses in library cache during execute: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 906 0.00 0.00
SQL*Net message from client 906 34.45 50.82
SQL*Net more data to client 877 0.00 0.05
db file sequential read 1 0.01 0.01
db file scattered read 60 0.00 0.14
direct path write 9 0.00 0.00
direct path read 125 0.05 0.13
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 7 0.00 0.00 0 0 0 0
Execute 11 0.00 0.00 0 3 6 6
Fetch 5 0.00 0.00 0 11 0 5
total 23 0.00 0.00 0 14 6 11
Misses in library cache during parse: 4
Misses in library cache during execute: 2
9 user SQL statements in session.
6 internal SQL statements in session.
15 SQL statements in session.
5 statements EXPLAINed in this session.
Trace file: qnhg_ora_500.trc
Trace file compatibility: 9.02.00
Sort options: default
3 sessions in tracefile.
12 user SQL statements in trace file.
8 internal SQL statements in trace file.
15 SQL statements in trace file.
11 unique SQL statements in trace file.
5 SQL statements EXPLAINed using schema:
ADMIN.prof$plan_table
Default table was used.
Table was created.
Table was dropped.
3945 lines in trace file.
Message was edited by:
Maran Viswarayar -
SQL Query (PL/SQL function body returning SQL query) when using to_char
we are trying to build a report page of Type SQL Query (PL/SQL function body returning SQL query).
our query is so simple, we need to extract the month from the recording_date column.
declare
l_query varchar2(1000);
begin
l_query:='select to_char(recording_date,'MM')from re_productive';
return l_query;
end;
but we are having the following problem for this query
Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the generic columns checkbox below the region source to proceed without parsing.
(ORA-06550: line 4, column 42: PLS-00103: Encountered the symbol "MON" when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like between || multiset member SUBMULTISET_ The symbol ". was inserted before "MON" to continue.)
Notes:
1-the query is correct and it was tested under Toad and SQL Plus.
2- we tried Use Generic Column Names (parse query at runtime only) option but we get the same problem.
any quick help please.Hi
You haven't escaped your quotes in the string. Try this...
DECLARE
l_query VARCHAR2(32767);
BEGIN
l_query:= 'select to_char(recording_date,''MM'') from re_productive';
RETURN l_query;
END;Cheers
Ben -
Insert query is using parallel mode
Hi All,
Insert query is running against below tables. It is using Parallelism as the below explain shows.
Execution Plan
Id Operation Name Rows Bytes Cost (%CPU) Time TQ IN-OUT PQ Distrib
0 INSERT STATEMENT 779K(100)
1 LOAD TABLE CONVENTIONAL
2 PX COORDINATOR
3 PX SEND QC (RANDOM) :TQ10002 4116K 443M 779K (0) 999:59:59 Q1,02 P->S QC (RAND)
4 HASH JOIN ANTI BUFFERED 4116K 443M 779K (0) 999:59:59 Q1,02 PCWP
5 BUFFER SORT Q1,02 PCWC
6 PX RECEIVE 4116K 235M 36221 (0) 758:17:06 Q1,02 PCWP
7 PX SEND HASH :TQ10000 4116K 235M 36221 (0) 758:17:06 S->P HASH
8 TABLE ACCESS FULL GL_POSTING_INTERIM_50123 4116K 235M 36221 (0) 758:17:06
9 PX RECEIVE 471M 23G 742K (0) 999:59:59 Q1,02 PCWP
10 PX SEND HASH :TQ10001 471M 23G 742K (0) 999:59:59 Q1,01 P->P HASH
11 PX BLOCK ITERATOR 471M 23G 742K (0) 999:59:59 Q1,01 PCWC
12 TABLE ACCESS FULL GL_BALANCES 471M 23G 742K (0) 999:59:59 Q1,01 PCWP WE are not using any parallel hint again all the tables in the insert query.
Environment details.
DB version - 11.2.0.1
OS version - IBM AIX 6.1
Please let me know why query is going for parallelism automatically as i am not using any parallel hint or any auto parallel.
NAME TYPE VALUE
fast_start_parallel_rollback string FALSE
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_degree_limit string CPU
parallel_degree_policy string MANUAL
parallel_execution_message_size integer 16384
parallel_force_local boolean FALSE
parallel_instance_group string
parallel_io_cap_enabled boolean FALSE
parallel_max_servers integer 8
parallel_min_percent integer 0
NAME TYPE VALUE
parallel_min_servers integer 0
parallel_min_time_threshold string AUTO
parallel_server boolean FALSE
parallel_server_instances integer 1
parallel_servers_target integer 64
parallel_threads_per_cpu integer 2
recovery_parallelism integer 0Please suggest.
ThanksThat will depend on the query and whether it decides to use parallel or not. Having PARALLEL_AUTOMATIC_TUNING set to FALSE does not disable parallel query in your database. Unless you are talking about some other parameter when you say "parallel auto is manual"?
Here is a worked example. Note my parallel settings at the end:
create table rj_test (id number(10), name varchar2(20));
exec dbms_stats.set_table_stats(ownname=>'SYS',tabname=>'RJ_TEST',numrows=>'1000000',numblks=>'10000');
SQL> explain plan for
2 select id, count(*)
3 from rj_test
4 group by id;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3757798270
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1000K| 12M| 1058 (12)| 00:00:06 |
| 1 | HASH GROUP BY | | 1000K| 12M| 1058 (12)| 00:00:06 |
| 2 | TABLE ACCESS FULL| RJ_TEST | 1000K| 12M| 962 (3)| 00:00:05 |
9 rows selected.
SQL> select degree from user_tables where table_name = 'RJ_TEST';
DEGREE
1
SQL> alter table rj_test parallel (degree 8);
Table altered.
SQL> explain plan for
2 select id, count(*)
3 from rj_test
4 group by id;
Explained.
SQL> select * from table(dbms_xplan.display);
SQL> set lines 120
SQL> set pages 1000
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 2739002282
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 1000K| 12M| 145 (11)| 00:00:01 | | | |
| 1 | PX COORDINATOR | | | | | | | | |
| 2 | PX SEND QC (RANDOM) | :TQ10001 | 1000K| 12M| 145 (11)| 00:00:01 | Q1,01 | P->S | QC (RAND) |
| 3 | HASH GROUP BY | | 1000K| 12M| 145 (11)| 00:00:01 | Q1,01 | PCWP | |
| 4 | PX RECEIVE | | 1000K| 12M| 145 (11)| 00:00:01 | Q1,01 | PCWP | |
| 5 | PX SEND HASH | :TQ10000 | 1000K| 12M| 145 (11)| 00:00:01 | Q1,00 | P->P | HASH |
| 6 | HASH GROUP BY | | 1000K| 12M| 145 (11)| 00:00:01 | Q1,00 | PCWP | |
| 7 | PX BLOCK ITERATOR | | 1000K| 12M| 133 (3)| 00:00:01 | Q1,00 | PCWC | |
| 8 | TABLE ACCESS FULL| RJ_TEST | 1000K| 12M| 133 (3)| 00:00:01 | Q1,00 | PCWP | |
15 rows selected.
SQL> show parameter parallel
NAME TYPE VALUE
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_degree_limit string CPU
parallel_degree_policy string MANUAL
parallel_execution_message_size integer 16384
parallel_force_local boolean FALSE
parallel_instance_group string
parallel_io_cap_enabled boolean FALSE
parallel_max_servers integer 16
parallel_min_percent integer 0
parallel_min_servers integer 1
parallel_min_time_threshold string AUTO
parallel_server boolean FALSE
parallel_server_instances integer 1
parallel_servers_target integer 16
parallel_threads_per_cpu integer 2
recovery_parallelism integer 0
SQL> -
Query not using remote table primary key.
Hello all,
My following query is not using the PK of remote database. vem_business_event_attribute is having a PK on ATTRIBUTE_TYPE_ID and business_event_id. The table is last analyzed on 04-dec-2010. It has around 5 milloin rows.
select /*+ DRIVING_SITE(ve) */
ve.ATTRIBUTE_TYPE_ID ,
ve.BUSINESS_EVENT_ID ,
ve.ATTRIBUTE_VALUE ,
ve.ATTRIBUTE_AS_NUMBER
from
vem_business_event_attribute@hello ve,
vem_attribute_types@hello va,
delta_insert_businessevent de
where
ve.ATTRIBUTE_TYPE_ID = va.ATTRIBUTE_TYPE_ID
ve.business_event_id = de.business_event_id
and de.business_event_id < 90000000;
Pls help.
RegardsIf you need to move 150 million rows from one database to another, it is going to take some time, and a full scan would definitely be the most efficient sql way to do it. I would be surprised if 15 inserts of 10 million rows each would be faster than a single insert of 150 million rows.
Depending on your exact requirements, it might be faster to use datapump to export the rows from the remote database and import them on the local database, but you will still be moving those 150 million rows across the network. You might get some advantage from the export/ftp/import option if you compress the dump file before the ftp, and uncompress it on the target, but that would depend on the additional time required to compress and uncompress.
John -
Inline transform for Sql Query not working in SAP MII 12.1 Version 12.1.8 B
Hi All,
I applied an xslt for an sql query which returns an xml file.
I used inline transform icon in sql query to load an xsl file which has to return me a string
Any idea why is not working for me..?
My Sample XML file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/XMII/CM/BatchDisposition/BatchQueueManagement/StyleSheets/ProductXsl.xsl"?>
<Rowsets DateCreated="2011-05-05T07:27:45" EndDate="2011-05-05T07:27:45" StartDate="2011-05-05T06:27:45" Version="12.1.8 Build(20)">
<Rowset>
<Columns>
<Column Description="ProductName" MaxRange="1" MinRange="0" Name="ProductName" SQLDataType="12" SourceColumn="ProductName"/>
</Columns>
<Row>
<ProductName>Asprin 100mg Tablets 12 x10 strip</ProductName>
</Row>
<Row>
<ProductName>Asprin 300mg Tablets 12 x10 strip</ProductName>
</Row>
<Row><ProductName>Ibprooven 200mg Tablets 12 x 10 strip</ProductName></Row>
<Row><ProductName>RipTide 50mg Tablets 40 x10 strip</ProductName></Row>
<Row><ProductName>Seroquel 200mg Tablets 6 x10 strip</ProductName></Row>
<Row><ProductName>Seroquel 400mg Tablets 12 x10 strip</ProductName></Row>
</Rowset>
</Rowsets>
My Sample XSl File:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:text>["</xsl:text>
<xsl:for-each select="Rowsets/Rowset/Row">
<xsl:value-of select="ProductName"/>
<xsl:if test="position() < last()">
<xsl:text>","</xsl:text>
</xsl:if>
<xsl:if test="position()=last()">
<xsl:text>"]</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Any Suggestions are Welcome:
ThanksSomething like this should work...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">
<xsl:copy-of select="/Rowsets/FatalError"/>
<xsl:copy-of select="/Rowsets/Messages"/>
<Rowset>
<Columns>
<Column Description="Mycol1" MaxRange="1" MinRange="0" Name="Mycol1" SQLDataType="12" SourceColumn="Mycol1" />
</Columns>
<Row>
<Mycol1>
<xsl:text>["</xsl:text>
<xsl:for-each select="/Rowsets/Rowset/Row">
<xsl:value-of select="." />
<xsl:choose>
<xsl:when test="position() < last()"><xsl:text>","</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>"]</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</Mycol1>
</Row>
</Rowset>
</Rowsets>
</xsl:template>
</xsl:stylesheet> -
Hi Forum
i made an application which run on JRun server.
In many of my jsps i used sql query like this:
" select id, name, rollno from student where add = 'jj';"
and retrieve the record from resultset like this:
rs.getString("id");
rs.getString("name");
rs.getString("rollno");
I got no error.
BUT WHEN I RETRIEVE THE RECORDS LIKE THIS
rs.getString("name");
rs.getString("id");
rs.getString("rollno");
i got the error:
java.sql.SQLException: [Oracle][ODBC]Invalid column number <1>.
I can not understand what is the problem ?
all the datatypes are correct.
all coding is correct.
and everything is correct.
pls help me & suggest a solution.
is there any problem of jdbc API OR of JRUN SERVER SETTINGS?
thanks
mail me at [email protected]
Arvind GoelI would advise against ever using SELECT * - the order of the columns is undetermined so you're bound to hit this problem sooner or later. Besides, it assumes the column names and you know what happens when you assume things...
I would recommend retrieving only the columns you need, in the order you want them and to call ResultSet.getXXX for each of the columns, in order. -
Hi All,
Please help with the error ORA-00923: FROM keyword not found where expected.
I am trying to execute the following SQL query.
SELECT
CASE
WHEN (Grouping("PRICECATEGORY"."PriceCategoryName")=1) THEN "PriceCatTotal"
ELSE "PRICECATEGORY"."PriceCategoryName"
END AS "PRICECATEGORY"."PriceCategoryName",
CASE
WHEN (Grouping("LINEITEM"."LineDescription")=1) THEN "LineTotal"
ELSE "LINEITEM"."LineDescription"
END AS "LINEITEM"."LineDescription" ,
*"INVOICE"."InvoiceDate",*
Sum("TRANSACTION"."TotalPrice") as "TotalPrice",
Sum("INVOICE_CHILD"."QUANTITY") as "Quantity"
FROM "LINEITEM","INVOICE","TRANSACTION","PRICECATEGORY", "INVOICE_CHILD"
WHERE "TRANSACTION"."InvoiceID"="INVOICE"."InvoiceNumber"
and "TRANSACTION"."PriceCategoryID"="PRICECATEGORY"."PriceCategoryID"
and "INVOICE_CHILD"."INVOICEID"="INVOICE"."InvoiceID"
and "PRICECATEGORY"."PriceCategoryID"="TRANSACTION"."PriceCategoryID"
and "TRANSACTION"."PriceCategoryID"="PRICECATEGORY"."PriceCategoryID"
and "PRICECATEGORY"."PriceCategoryID"="TRANSACTION"."PriceCategoryID"
and "LINEITEM"."LINEITEMID"="TRANSACTION"."LineItemID"
and "LINEITEM"."PRICECATEGORYID"="PRICECATEGORY"."PriceCategoryID"
and "INVOICE"."InvoiceDate" >= :STARTDATE and "INVOICE"."InvoiceDate" <= to_date(:ENDDATE,'DD-MON-YY')+1
GROUP BY "PRICECATEGORY"."PriceCategoryName", "LINEITEM"."LineDescription" WITH ROLLUP
I am using a from keyword at the right place and all the aliases are properly used.
Please advice.
Regards,
Sandeep ReddyJaydip and Jeff are correct:
<li>Jaydip points out that <tt>"PRICECATEGORY"."PriceCategoryName"</tt> and <tt>"LINEITEM"."LineDescription"</tt> are not valid column alias names. They must be unqualified, nonquoted/quoted identifiers.
<li>Jeff indicates that <tt>WITH ROLLUP</tt> is not Oracle SQL syntax, and provides a sample of the required ROLLUP/CUBE clauseOracle SQL <tt>ROLLUP/CUBE clause</tt>.
Additionally, <tt>TRANSACTION</tt> is an Oracle keyword and therefore a poor choice as a database identifier: change the name of this table as soon as possible.
You're having this problem because not all "SQL" is created equal. Your OdeToCode source appears to be a site dealing with Microsoft technologies (SQL Server in this case). Unless you are very familiar with Oracle and SQL Server and the inherent differences between them you'd be advised to stick to purely Oracle resources (I know I do). There are plenty of good Oracle resources out there.
You'll also find it a lot easier to write, read and spot problems in SQL and PL/SQL code if you avoid using quoted identifiers (please tell us the database objects don't have case-sensitive names?) and use short table aliases rather than full table names. And we'll find it easier to help you on this forum if you post code samples wrapped in \...\wrapped in <tt>\...\</tt> tags.
Maybe you are looking for
-
Oracle - maximum open cursors exceeded
Hi! I'm constatly getting the error I pasted below, when this line is executed: PreparedStatement stmt = connection.prepareStatement(sqlStatement); 'connection' is of course an instance of oracle.jdbc.driver.OracleConnection, and 'sqlStatement' is a
-
I have set up my apple id years ago in my name- my husband recently used my id for his phone and has the email password changes going to him- I want to change this and no longer allow him access to my apple id. How do I do this? I don't know the se
-
Dear Team, i had brought a APPLE IPHONE4 from APPLE STORE, MANCHESTER ARNDALE. new cannon street mall. when i was visiting for purchasing this device the sales team told me that the phone is unlocked and can use all around the world with any other ne
-
I have 2 iPads, why can't I connect them via Bluetooth?
Both my iPads show up under Bluetooth, but they will not connect. I'm not sure how to get them too. The manual is absolutely no help! Thanks to whoever can answer my dilemma.
-
''Turned on computer this am(2-17-2011) and opened Firefox and everything in Japaness. Had to manually chage the address bar and add correct address. Finally uninstall Mozilla Foxfire from the computer. When I reinstalled the same problem continues t