Bug 2679062 - Wrong results possible from multi-column INLIST - though stat
Hi,
The following test case is supplied in the metalink in bug no. 2871341, the base bug for this bug is 2679062.
REPRODUCIBILITY:
Reproduces constantly with simple test case below:
TEST CASE:
DROP TABLE A1
CREATE TABLE A1 (X1 VARCHAR2(10), X2 VARCHAR2(10))
REM *********** Create the second table: ***************
DROP TABLE A2
CREATE TABLE A2 (X1 VARCHAR2(10), X2 VARCHAR2(10))
INSERT INTO A1 VALUES ('1','2');
INSERT INTO A2 VALUES ('3','4');
COMMIT;
CREATE INDEX A1_X1 ON A1(X1 );
CREATE INDEX A1_X2 ON A1(X2);
CREATE INDEX A2_X1 ON A2(X1);
CREATE INDEX A2_X2 ON A2(X2);
CREATE OR REPLACE VIEW A_ALL AS SELECT * FROM A1 UNION ALL SELECT * FROM A2;
ANALYZE TABLE A1 COMPUTE STATISTICS;
ANALYZE TABLE A2 COMPUTE STATISTICS;
SELECT * FROM A_ALL;
SELECT * FROM A_ALL WHERE (X1='1' AND X2='2') ;
SELECT * FROM A_ALL WHERE ((X1='1' AND X2='2') OR (X1='3' AND X2='4'));
The 2nd query returns answer while the second is not !
The following is published in the 9.2.0.4 fixed bug list:
" 9204 - 2679062 - Wrong results possible from multi-column INLIST "
I have installed 9.2.0.4 patch set on a win 2000 machine Oracle and saw that the above case is actually solved but our application which has a very similar case doesn't.
After investigating I found the following test case that fails, it reproduces only when you have index on all columns (covering index):
drop table t1_1;
drop table t1_2;
create table t1_1(c1 number, c2 number, c3 number);
create table t1_2(c1 number, c2 number, c3 number);
create index t1_1_ix on t1_1(c1, c2, c3);
create index t1_2_ix on t1_2(c1, c2, c3);
create or replace view t1 as select * from t1_1 union all select * from t1_2;
insert into t1_1 values(1, 2, 100);
insert into t1_2 values(1, 2, 200);
commit;
analyze table t1_1 compute statistics;
analyze table t1_2 compute statistics;
prompt
prompt #######################################
prompt try 1 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( (c2=2) and (c3=100)
prompt
prompt #######################################
prompt try 2 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
(c2=2) and (c3=200)
prompt
prompt #######################################
prompt try 3 - try 1 OR try 2 does not work !
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( ( (c2=2) and (c3=100) )
or
( (c2=2) and (c3=200) )
opened a TAR and wanted to share with you.
Tal Olier ([email protected]).
Hi,
The following test case is supplied in the metalink in bug no. 2871341, the base bug for this bug is 2679062.
REPRODUCIBILITY:
Reproduces constantly with simple test case below:
TEST CASE:
DROP TABLE A1
CREATE TABLE A1 (X1 VARCHAR2(10), X2 VARCHAR2(10))
REM *********** Create the second table: ***************
DROP TABLE A2
CREATE TABLE A2 (X1 VARCHAR2(10), X2 VARCHAR2(10))
INSERT INTO A1 VALUES ('1','2');
INSERT INTO A2 VALUES ('3','4');
COMMIT;
CREATE INDEX A1_X1 ON A1(X1 );
CREATE INDEX A1_X2 ON A1(X2);
CREATE INDEX A2_X1 ON A2(X1);
CREATE INDEX A2_X2 ON A2(X2);
CREATE OR REPLACE VIEW A_ALL AS SELECT * FROM A1 UNION ALL SELECT * FROM A2;
ANALYZE TABLE A1 COMPUTE STATISTICS;
ANALYZE TABLE A2 COMPUTE STATISTICS;
SELECT * FROM A_ALL;
SELECT * FROM A_ALL WHERE (X1='1' AND X2='2') ;
SELECT * FROM A_ALL WHERE ((X1='1' AND X2='2') OR (X1='3' AND X2='4'));
The 2nd query returns answer while the second is not !
The following is published in the 9.2.0.4 fixed bug list:
" 9204 - 2679062 - Wrong results possible from multi-column INLIST "
I have installed 9.2.0.4 patch set on a win 2000 machine Oracle and saw that the above case is actually solved but our application which has a very similar case doesn't.
After investigating I found the following test case that fails, it reproduces only when you have index on all columns (covering index):
drop table t1_1;
drop table t1_2;
create table t1_1(c1 number, c2 number, c3 number);
create table t1_2(c1 number, c2 number, c3 number);
create index t1_1_ix on t1_1(c1, c2, c3);
create index t1_2_ix on t1_2(c1, c2, c3);
create or replace view t1 as select * from t1_1 union all select * from t1_2;
insert into t1_1 values(1, 2, 100);
insert into t1_2 values(1, 2, 200);
commit;
analyze table t1_1 compute statistics;
analyze table t1_2 compute statistics;
prompt
prompt #######################################
prompt try 1 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( (c2=2) and (c3=100)
prompt
prompt #######################################
prompt try 2 - works fine
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
(c2=2) and (c3=200)
prompt
prompt #######################################
prompt try 3 - try 1 OR try 2 does not work !
prompt #######################################
prompt
select * from t1
where
(c1=1)
and
( ( (c2=2) and (c3=100) )
or
( (c2=2) and (c3=200) )
opened a TAR and wanted to share with you.
Tal Olier ([email protected]).
Similar Messages
-
Retrieving multiple values from one column in SELECT statement
Hi,
I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
e.g.
at the DB level :
SELECT role_name, CC_ID FROM votetbl a
INNER JOIN APPROVERS b ON
a.BUSVP = b.BUSVP AND
a.BRANCH = b.BRANCH
WHERE CC_ID = 1688this will return:
ROLE_NAME CC_ID
ops 1688
ops 1688
comply 1688
legal 1688
comply 1688
When run in my JSP, like so:
String primID3a = request.getParameter("primID");
Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
"a.BRANCH = b.BRANCH WHERE CC_ID = ?";
PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
prepvotstmt.setString(1, primID3a);
ResultSet rest3 = prepvotstmt.executeQuery();
rest3.next();
String votecat = rest3.getString(1);
out.println("Vote category: "+votecat);I only get ops returned.
Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
Any feedback and direction here is welcomed!
Thanks!Actually, I tried looping and still only get 1, but returned several times.
i.e.
PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
prepvotstmt.setString(1, primID3a);
ResultSet rest3 = prepvotstmt.executeQuery();
rest3.next();
String votecat = rest3.getString(1);
while (rest3.next()) {
out.print("category roles "+votecat);
}then I get returned the following:
admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
like so.
Where as at the DB level I get
ROLE_NAME CC_ID
admin 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
risk 1688
comply 1688
legal 1688
legal 1688
ops 1688
comply 1688
Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
Other times, it will not return a value at all, even though one resides in the db.
Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
Yeeeeeeesh!!! : (
Message was edited by:
bpropes20 -
OBIEE 10g Getting wrong results when adding calculated columns to a report
Hi,
I'm experiencing a possible misbehaviour with OBIEE 10g (10.1.3.4.1).
I have a simple report with a table. Columns are simply selected from dimensions and facts. In this case the generated query is:
WITH
SAWITH0 AS (select sum(T30604.TOTAL_TIME) as c1,
sum(T30604.MATERIALS_QTT_COST) as c2,
sum(T30604.AMNT) as c3,
sum(T30604.QNTY) as c4,
T30622.BRANCH_CODE as c5,
T25064.SRP1_CODE as c6,
T25064.SRP1_DESC as c7,
T25064.SRP2_CODE as c8
from
THK_BRANCHES T30622,
THK_ITEMS T25064,
THK_INVENTORY_TRANSACTIONS T30604
where ( T25064.ITEM_ID = T30604.ITEM_ID and T30604.BRANCH_ID = T30622.BRANCH_ID )
group by T25064.SRP1_CODE, T25064.SRP1_DESC, T25064.SRP2_CODE, T30622.BRANCH_CODE)
select distinct SAWITH0.c5 as c1,
SAWITH0.c6 as c2,
SAWITH0.c7 as c3,
SAWITH0.c8 as c4,
SAWITH0.c4 as c5,
SAWITH0.c3 as c6,
SAWITH0.c2 as c7,
SAWITH0.c1 as c8,
SAWITH0.c4 as c9,
SAWITH0.c3 as c10,
SAWITH0.c2 as c11,
SAWITH0.c1 as c12,
SAWITH0.c4 as c13,
SAWITH0.c3 as c14,
SAWITH0.c2 as c15,
SAWITH0.c1 as c16,
SAWITH0.c4 as c17,
SAWITH0.c3 as c18,
SAWITH0.c2 as c19,
SAWITH0.c1 as c20
from
SAWITH0
Results of this report / query are correct.
I then add a simple calculation (subtraction between two fields). The generated query is:
WITH
SAWITH0 AS (select sum(T30604.MATERIALS_QTT_COST) as c1,
sum(T30604.AMNT) as c2,
T30622.BRANCH_CODE as c3,
T25064.SRP1_CODE as c6,
T25064.SRP1_DESC as c7,
sum(T30604.TOTAL_TIME) as c8,
sum(T30604.QNTY) as c11,
T25064.SRP2_CODE as c12
from
THK_BRANCHES T30622,
THK_ITEMS T25064,
THK_INVENTORY_TRANSACTIONS T30604
where ( T25064.ITEM_ID = T30604.ITEM_ID and T30604.BRANCH_ID = T30622.BRANCH_ID )
group by T25064.SRP1_CODE, T25064.SRP1_DESC, T25064.SRP2_CODE, T30622.BRANCH_CODE),
SAWITH1 AS (select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4,
D1.c5 as c5,
D1.c6 as c6,
D1.c7 as c7,
D1.c8 as c8,
D1.c9 as c9,
D1.c10 as c10,
D1.c11 as c11,
D1.c12 as c12
from
(select sum(SAWITH0.c1) over (partition by SAWITH0.c3) as c1,
sum(SAWITH0.c2) over (partition by SAWITH0.c3) as c2,
SAWITH0.c3 as c3,
sum(SAWITH0.c1) over (partition by SAWITH0.c6, SAWITH0.c3) as c4,
sum(SAWITH0.c2) over (partition by SAWITH0.c6, SAWITH0.c3) as c5,
SAWITH0.c6 as c6,
SAWITH0.c7 as c7,
sum(SAWITH0.c8) over (partition by SAWITH0.c6, SAWITH0.c12, SAWITH0.c3) as c8,
sum(SAWITH0.c1) over (partition by SAWITH0.c6, SAWITH0.c12, SAWITH0.c3) as c9,
sum(SAWITH0.c2) over (partition by SAWITH0.c6, SAWITH0.c12, SAWITH0.c3) as c10,
sum(SAWITH0.c11) over (partition by SAWITH0.c6, SAWITH0.c12, SAWITH0.c3) as c11,
SAWITH0.c12 as c12,
ROW_NUMBER() OVER (PARTITION BY SAWITH0.c3, SAWITH0.c12 ORDER BY SAWITH0.c3 ASC, SAWITH0.c12 ASC) as c13
from
SAWITH0
) D1
where ( D1.c13 = 1 ) ),
SAWITH2 AS (select sum(T30604.MATERIALS_QTT_COST) as c1,
sum(T30604.AMNT) as c2
from
THK_INVENTORY_TRANSACTIONS T30604)
select SAWITH1.c3 as c1,
SAWITH1.c6 as c2,
SAWITH1.c7 as c3,
SAWITH1.c12 as c4,
SAWITH1.c11 as c5,
SAWITH1.c10 as c6,
SAWITH1.c9 as c7,
SAWITH1.c8 as c8,
SAWITH1.c10 - SAWITH1.c9 as c9,
SAWITH1.c11 as c10,
SAWITH1.c10 as c11,
SAWITH1.c9 as c12,
SAWITH1.c8 as c13,
SAWITH1.c11 as c15,
SAWITH1.c10 as c16,
SAWITH1.c9 as c17,
SAWITH1.c8 as c18,
SAWITH1.c11 as c20,
SAWITH1.c10 as c21,
SAWITH1.c9 as c22,
SAWITH1.c8 as c23,
SAWITH1.c5 as c26,
SAWITH1.c4 as c27,
SAWITH1.c2 as c28,
SAWITH1.c1 as c29,
SAWITH2.c2 as c30,
SAWITH2.c1 as c31
from
SAWITH1,
SAWITH2
Results of this report / query are wrong: it seems as if some rows "disappear".
If I delete the filter in SAWITH1 query above ( D1.c13 = 1 ) results are correct.
Anyone experiencing the same problem? The strange thing is that I have a number of similar reports (on other subject areas) and everyting is working fine.
Please also note that I don't want to add this kind of calculated items in the RPD (they can be simple calculations that are made on-the-fly).
Any help would be greatly appreciated.
Thanks a lot and regards,
CristinaI have the same issue, everything OBIEE server generate query using ROW_NUMBER() over () function, it will hardcode Dx.cx = 1, this will cause issue if you have rows of the same distinct value, thus causing missing rows and the final results will be wrong.
I have open a SR with Oracle Support since March 2011, but till today, they have not resolve the issue yet.
Hope they solve the issue soon.
Best Regards
KT -
SQL Server 2012 Time(7) DataType values Comparison giving wrong result. Please help
We have a Table with StartTime and EndTime columns in Time(7) datatype, so we want to count the rows for each hour from 6 AM to 5 AM. If a record in table is as StartTime= 7 PM to EndTime = 5 AM (a shift of an employee) then the result is wrong beacause
being time(7) datatype the EndTime(5AM)< StartTime(7PM) in 24 hours format so following query gives wrong results.
select
* from EmpSchedule
where (StartTime>='19:00:00.0000000'
OR EndTime>='19:00:00.0000000')
Please help me out. ThanksDECLARE @clockIns TABLE (employeeID INT, startDateTime DATETIME, endDateTime DATETIME)
INSERT INTO @clockIns (employeeID, startDateTime, endDateTime)
VALUES
(1, '2014-07-01 19:01:00.000', '2014-07-02 04:27:00.000'),
(2, '2014-07-01 18:01:00.000', '2014-07-02 05:27:00.000'),
(3, '2014-07-01 19:01:00.000', '2014-07-02 05:27:00.000'),
(4, '2014-07-01 18:01:00.000', '2014-07-02 04:27:00.000')
SELECT *
FROM @clockIns
WHERE datepart(HOUR,startDateTime) BETWEEN 19 AND 23
OR datepart(HOUR,startDateTime) BETWEEN 0 AND 4
OR datepart(HOUR,endDateTime) BETWEEN 19 AND 23
OR datepart(HOUR,endDateTime) BETWEEN 0 AND 4
Try this out. -
How do i create a Multi column Dynamic list using Swing?
Hi,
I need to be able to do a file search (in a separate thread) on the hard drive and display the results in a multi column List control .
Jtable seems to be rather 'static'y. i.e load data in once. and maybe reload it again later. But i need to load one row in at a time as the search progresses.
Also any row can be deleted or moved to another position.
CListCtrl in MFC allows me to do this handily.
But Is there a way to do this using Swing?
havent seen anything that says JList can do this.
TIAHi Jacob.
I would use JTable for that. I did not exactly understand what you meant by JTable being "static"y.
Anyway, I would have the thread update the data in the tablemodel behind the table and invoke "fireTableRowsInserted" (may be after every insert or after inserting a chunk of rows). I had a sample something similar to what you are working on. Let me know if you need the sample.
HTH.
Regards,
Vijay -
How Can I get multi column values from dynamic search help?
Hi Gurus;
I'm using dynamic search help in my program.
I want to get multi column values from search help. But I dont know solution for this issue.
I'm using F4IF_INT_TABLE_VALUE_REQUEST FM.
How Can I get multi column values from dynamic search help?
Thanks.Believe it or not, the same FM worked for me in a dynpro. I will try to explain here how it works in custom screen and then you can do your work for other screens or program types. I am not going to write my actual work but will explain in general.
I have 4 fields (FLD1, FLD2, FLD3, FLD4) and i made the search based on FLD2 and when user click on a line (could be any field), then this would bring the line on to the screens.
There are like 3 steps.
You have your value_tab for my fields FLD1, FLD2, FLD3 and FLD4. This is just the data that we pass into the FM. (data: IT_VALTAB type table of ZVAL_TABLE)
Next map the screen fields into an internal table (data: It_dynpfld type table of dselc ). I also have other internal tables defined (just to keep it straight, i will be putting here) data: It_return type standard table of ddshretval.
Next step is to call the function module. Make sure you have values in IT_VALTAB.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'FLD2'
value_org = 'S'
tables
value_tab = It_VALTAB
return_tab = It_return
dynpfld_mapping = It_dynpfld
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
perform get_selected_fields tables It_return.
endif.
The code within the perform GET_SELECTED_FIELDS - We need to map the result fields after user selects it. The code goes like this. This is step is to update the dynpro fields.
I need a internal table as well as a work area here. like,
data: lt_fields type table of dynpread,
la_fields type dynpread.
field-symbols: <fs_return> type ddshretval.
so fill out LT_FIELDS from the IT_RETURN table
loop at lt_return assigning <fs_return>.
la_fields-fieldname = <fs_return>-retfield.
la_fields-fieldvalue = <fs_return>-fieldval.
append la_fields to lt_fields.
clear: la_fields.
endloop.
Call the FM to update the dynpro
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-repid
dynumb = '1002' "This is my screen number. You could use 1000 for selection screen (hope so)
tables
dynpfields = lt_fields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
good luck -
Pass a Collection of multi-column records from JAVA to Plsql
Hi,
I need to pass a Collection of multi-column records(say Employee Id, Employee Name and Employee Address) from a JAVA application to an Oracle package/stored procedure
for data processing and updates.
I initially thought of using a pl/sql table as an input parameter, but then I came to know that a pl/sql table can have ONLY one column and an index (can be a String in
the case of an Associative Array). Please let me know if my understanding is wrong here.
I then thought of using a PL/SQL table with a RECORD type as an element. But, I came across a documentation that says that, Oracle JDBC does not support RAW, DATE, and PL/SQL RECORD as element types.
Could you please let me know how I can pass multi-column records from JAVA to an Oracle Stored procedure as an input parameter? Millions of rows would be sent by the JAVA program to the Oracle Stored procedure.
Any help will be highly appreciated.
Regards,
Sunil.There are several examples in the " Working with Oracle Collections" from the "JDBC Developer's Guide and Reference". You can either use a Map to create Java objects that are created with the Oracle objects data or the generic oracle.sql.STRUCT interface.
http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraarr.htm#1047581
http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraoot.htm#1039477 -
Select for update gives wrong results. Is it a bug?
Hi,
Select for update gives wrong results. Is it a bug?
CREATE TABLE TaxIds
TaxId NUMBER(6) NOT NULL,
LocationId NUMBER(3) NOT NULL,
Status NUMBER(1)
PARTITION BY LIST (LocationId)
PARTITION P111 VALUES (111),
PARTITION P222 VALUES (222),
PARTITION P333 VALUES (333)
ALTER TABLE TaxIds ADD ( CONSTRAINT PK_TaxIds PRIMARY KEY (TaxId));
CREATE INDEX NI_TaxIdsStatus ON TaxIds ( NVL(Status,0) ) LOCAL;
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100101, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100102, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100103, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100104, 111, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200101, 222, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200102, 222, NULL);
Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200103, 222, NULL);
--Session_1 return TAXID=100101
select TAXID from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_2 waits commit
select TAXID from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_1
update TAXIDS set STATUS=1 Where TaxId=100101;
commit;
--Session_2 return 100101 opps!?
--Session_1 return TAXID=100102
select TAXID, STATUS from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_2 waits commit
select TAXID, STATUS from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
--Session_1
update TAXIDS set STATUS=1 Where TaxId=100102;
commit;
--Session_2 return 100103This is a bug. Got to be a bug.
This should be nothing to do with indeterminate results from ROWNUM, and nothing to do with read consistency at the point of statement start time in session2., surely.
Session 2 should never return 100101 once the lock from session 1 is released.
The SELECT FOR UPDATE should restart and 100101 should not be selected as it does not meet the criteria of the select.
A statement restart should ensure this.
A number of demos highlight this.
Firstly, recall the original observation in the original test case.
Setup
SQL> DROP TABLE taxids;
Table dropped.
SQL>
SQL> CREATE TABLE TaxIds
2 (TaxId NUMBER(6) NOT NULL,
3 LocationId NUMBER(3) NOT NULL,
4 Status NUMBER(1))
5 PARTITION BY LIST (LocationId)
6 (PARTITION P111 VALUES (111),
7 PARTITION P222 VALUES (222),
8 PARTITION P333 VALUES (333));
Table created.
SQL>
SQL> ALTER TABLE TaxIds ADD ( CONSTRAINT PK_TaxIds PRIMARY KEY (TaxId));
Table altered.
SQL>
SQL> CREATE INDEX NI_TaxIdsStatus ON TaxIds ( NVL(Status,0) ) LOCAL;
Index created.
SQL>
SQL>
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100101, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100102, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100103, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100104, 111, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200101, 222, NULL);
1 row created.
SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200102, 222, NULL);
1 row created.
SQL> commit;
Commit complete.
SQL> Original observation:
Session1>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100101
Session1>
--> Session 2 with same statement hangs until
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> At which point, Session 2 returns
Session2>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100101
Session2>There's no way that session 2 should have returned 100101. That is the point of FOR UPDATE. It completely reintroduces the lost UPDATE scenario.
Secondly, what happens if we drop the index.
Let's reset the data and drop the index:
Session1>UPDATE taxids SET status=0 where taxid=100101;
1 row updated.
Session1>commit;
Commit complete.
Session1>drop index NI_TaxIdsStatus;
Index dropped.
Session1>Then try again:
Session1>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100101
Session1>
--> Session 2 hangs again until
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> At which point in session 2:
Session2>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND ROWNUM = 1
6 FOR UPDATE;
TAXID
100102
Session2>Proves nothing, Non-deterministic ROWNUM you say.
Then let's reset, recreate the index and explicity ask then for row 100101.
It should give the same result as the ROWNUM query without any doubts over the ROWNUM, etc.
If the original behaviour was correct, session 2 should also be able to get 100101:
Session1>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND taxid = 100101
6 FOR UPDATE;
TAXID
100101
Session1>
--> same statement hangs in session 2 until
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> so session 2 stops being blocked and:
Session2>SELECT taxid
2 FROM taxids
3 WHERE locationid = 111
4 AND NVL(STATUS,0) = 0
5 AND taxid = 100101
6 FOR UPDATE;
no rows selected
Session2>Of course, this is how it should happen, surely?
Just to double check, let's reintroduce ROWNUM but force the order by to show it's not about read consistency at the start of the statement - restart should prevent it.
(reset, then)
Session1> select t.taxid
2 from
3 (select taxid, rowid rd
4 from taxids
5 where locationid = 111
6 and nvl(status,0) = 0
7 order by taxid) x
8 , taxids t
9 where t.rowid = x.rd
10 and rownum = 1
11 for update of t.status;
TAXID
100101
Session1>
--> Yes, session 2 hangs until...
Session1>BEGIN
2 UPDATE taxids SET status=1 WHERE taxid=100101;
3 COMMIT;
4 END;
5 /
PL/SQL procedure successfully completed.
Session1>
--> and then
Session2> select t.taxid
2 from
3 (select taxid, rowid rd
4 from taxids
5 where locationid = 111
6 and nvl(status,0) = 0
7 order by taxid) x
8 , taxids t
9 where t.rowid = x.rd
10 and rownum = 1
11 for update of t.status;
TAXID
100102
Session2>Session 2 should never be allowed to get 100101 once the lock is released.
This is a bug.
The worrying thing is that I can reproduce in 9.2.0.8 and 11.2.0.2. -
Introduction
In SQL Server Reporting Services, we can define a mapping between the fields that are returned in the query to specific delivery options and to report parameters in a data-driven subscription.
For a report with a parameter (such as YEAR) that allow multiple values, when creating a data-driven subscription, how can we pass a record like below to show correct data (data for year 2012, 2013 and 2014).
EmailAddress Parameter
Comment
[email protected] 2012,2013,2014 NULL
In this article, I will demonstrate how to configure a Data Driven Subscription which get multi-value parameters from one column of a database table
Workaround
Generally, if we pass the “Parameter” column to report directly in the step 5 when creating data-driven subscription.
The value “2012,2013,2014” will be regarded as a single value, Reporting Services will use “2012,2013,2014” to filter data. However, there are no any records that YEAR filed equal to “2012,2013,2014”, and we will get an error when the subscription executed
on the log. (C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles)
Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportParameterException: Default value or value provided for the report parameter 'Name' is not a valid value.
This means that there is no such a value on parameter’s available value list, this is an invalid parameter value. If we change the parameter records like below.
EmailAddress Parameter Comment
[email protected] 2012 NULL
[email protected] 2013 NULL
[email protected] 2014 NULL
In this case, Reporting Services will generate 3 reports for one data-driven subscription. Each report for only one year which cannot fit the requirement obviously.
Currently, there is no a solution to solve this issue. The workaround for it is that create two report, one is used for view report for end users, another one is used for create data-driven subscription.
On the report that used create data-driven subscription, uncheck “Allow multiple values” option for the parameter, do not specify and available values and default values for this parameter. Then change the Filter
From
Expression:[ParameterName]
Operator :In
Value :[@ParameterName]
To
Expression:[ParameterName]
Operator :In
Value :Split(Parameters!ParameterName.Value,",")
In this case, we can specify a value like "2012,2013,2014" from database to the data-driven subscription.
Applies to
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2012
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.For every Auftrag, there are multiple Position entries.
Rest of the blocks don't seems to have any relation.
So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
Try out this snippet.
DATA lt_data TYPE TABLE OF string.
DATA lv_data TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'C:\temp\test.txt'
CHANGING
data_tab = lt_data
EXCEPTIONS
OTHERS = 19.
CHECK sy-subrc EQ 0.
TYPES:
BEGIN OF ty_str,
a1 TYPE string,
a2 TYPE string,
a3 TYPE string,
p1 TYPE string,
p2 TYPE string,
p3 TYPE string,
END OF ty_str.
DATA: lt_str TYPE TABLE OF ty_str,
ls_str TYPE ty_str,
lv_block TYPE string,
lv_flag TYPE boolean.
LOOP AT lt_data INTO lv_data.
CASE lv_data.
WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
lv_block = lv_data.
lv_flag = abap_false.
WHEN OTHERS.
lv_flag = abap_true.
ENDCASE.
CHECK lv_flag EQ abap_true.
CASE lv_block.
WHEN '[Auftrag]'.
SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
WHEN '[Position]'.
SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
APPEND ls_str TO lt_str.
ENDCASE.
ENDLOOP. -
No search result using managed property from a column of a published infopath form
Hi,
I'm trying to use a managed property in the advanced search to retrieve only words from a column of a published InfoPath form. We are using FAST Search and verify that the column are being crawled by checking the crawled property in Central Admin but still
cannot retrieve search result for the managed property. We also do a full crawl before testing the search. Thank you..Hi Rommel,
When we create a column from a list (not site column), then we need create list item with this column value, then we need to full crawl, then the the crawled propery ows_listColumnName will be generated, then create a managed property to map this
crawled property(start a full crawl again if needed), then add the custom managed property in advance search web part property, then check again.
Here is an article about how to add the custom managed proerpty in advanced search web part, you can take a look.
http://waelmohamed.wordpress.com/2011/05/31/add-custom-search-properties-in-your-advanced-search-sharepoint-2010/
Thanks
Daniel Yang
TechNet Community Support -
Is it possible to search only one column in a multi column data store?
Assume I create a context index using a multi column datastore for the columns first_name, middle_name, and last_name.
Then I can search all of the columns in the index using contains().
Is there any way to use contains() to just search one of the columns in a multi column datastore - just last_name for instance?
In some cases a want to search all of the columns, in other cases just one of the columns.Yes, see the doc:
http://download.oracle.com/docs/cd/B14117_01/text.101/b10730/cdatadic.htm#i1006391
If you use the default behaviour, then your column data will be separated by XML-like tags.
<first_name>John</first_name><middle_name>Peter</middle_name><last_name>Doe</last_name>
You would then need to EITHER define each of these as sections, or use "auto_section_group". You can then search on them using
... contains (col, 'peter within middle_name') >0
See example:
SQL> drop table t;
Table dropped.
SQL> create table t (first varchar2(20), middle varchar2(20), last varchar2(20));
Table created.
SQL> insert into t values ('John', 'Peter', 'Doe');
1 row created.
SQL> insert into t values ('Peter', 'Frederik', 'Smith');
1 row created.
SQL> exec ctx_ddl.drop_preference('my_mcds')
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.create_preference('my_mcds', 'multi_column_datastore')
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.set_attribute('my_mcds', 'columns', 'first,middle,last')
PL/SQL procedure successfully completed.
SQL> create index ti on t (first) indextype is ctxsys.context
2 parameters ('datastore my_mcds section group ctxsys.auto_section_group');
Index created.
SQL> select * from t where contains (first, 'peter')>0;
FIRST MIDDLE LAST
John Peter Doe
Peter Frederik Smith
SQL> select * from t where contains (first, 'peter within middle')>0;
FIRST MIDDLE LAST
John Peter Doe -
Am I wrong to use multi column text frames
In every publication I encounter, all articles use one text frame per column on a page.
Why not simply use multi-column text frame per article instead of threaded text frames, one per column.
Am I the only person who thinks its better to use a single text frame with multiple columns.
I only ask be cause I would like to conform to a standard if it had any benefits... but I'm really struggling to find any.
Most of my publications are newsletters where the articles span anywhere from 2-5 columns but mostly 4-5. I like the confidence in knowing that all lines on an article are perfectly aligned.It all depends on your circumstances. When you need columns of unequal width you have to use threaded text frames: when you set a text frame to more than one column, you can't specify the width of the individual columns.
Another difference is that in a frame with columns, footnotes always span the width of the frame. If you want footnotes the width of a column, you need a frame for each column.
Yet another reason why you sometimes need frames rather than columns is when a page contain different stories which may continue on other pages, as as the case in most newspapers.
So if your documents contain one story, don't use footnotes (or if they do, can span all columns), and all columns have the same width, then use columns. For example, indexes at the end of a book are candidates for columns; columns are probably good for telephone directories; and newspapers and magazines are maybe best set in frames.
Peter -
I was using a muticolumn listbox(not table,for table i have example code,and problem is that i was not getting active cell position for Multi column listbox) with 5 columns.In third column,i want to generate a ring control,generate in the sense,whenever user clicks on any cell of third column of multicolumn listbox(not table),the ring control should pop up.The thing is that i need to use only one ring control and whenever user clicks on any cell of a third column,this ring control should pop up.How can i achieve this,anyone please help me,
Regards,
Naresh.NHi, Naresh,
For starting point you can read this: Table with Drop Down Items
Andrey. -
Wrong results for context search on empty element tags
I'm using Oracle DBMS 11.1 and 11.2 and created a context index on an XML column (section group: PATH_SECTION_GROUP).
When entering a query like
SELECT count(*) FROM my_table t WHERE contains (t.co_xml,'hasPath(/tag1/tag2)') > 0
I get wrong results if tag2 is an empty element tag (<tag2/>) that appears somewhere within the
XML instance, but NOT directly under tag1.
E.g., the following XML instance is found (but shouldn't!):
<a>
<tag1>bla<tag3>bla</tag3></tag1>
<tag4>bla<tag2/></tag4>
</a>
This seems to happen only for empty element tags. Is this a known bug and does anybody know a workaround?
Thanks in advance for your help!
RomanI am unable to reproduce the problem. Can you provide a copy and paste of an actual run, including create table, insert data, create index, and select, as I have done below?
SCOTT@orcl_11g> select * from v$version
2 /
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SCOTT@orcl_11g> create table my_table
2 (co_xml xmltype)
3 /
Table created.
SCOTT@orcl_11g> insert into my_table values (
2 xmltype ('<?xml version="1.0"?>
3 <tag5>
4 <tag1>bla<tag3>bla</tag3></tag1>
5 <tag4>bla<tag2/></tag4>
6 </tag5>'))
7 /
1 row created.
SCOTT@orcl_11g> create index my_idx
2 on my_table (co_xml)
3 indextype is ctxsys.context
4 parameters ('section group ctxsys.path_section_group')
5 /
Index created.
SCOTT@orcl_11g> SELECT count(*)
2 FROM my_table t
3 WHERE contains (t.co_xml, 'hasPath (//tag1/tag2)') > 0
4 /
COUNT(*)
0
SCOTT@orcl_11g> SELECT count(*)
2 FROM my_table t
3 WHERE contains (t.co_xml, 'hasPath (//tag1/tag3)') > 0
4 /
COUNT(*)
1
SCOTT@orcl_11g> -
Query from variable column name?
Running on LAMP
Table - CONTACTS (35 COLUMNS APPROX)
I want to be able to create a results page from a detailed
query.
My first attempt was to include 35 text fields in a form and
then build the query: like '%namesearch%' and like
'%companysearch%' and like '%companytype%' etc. etc. etc.
But this is time consuming and prone to bugs.
I though a much easier way would be to have two fields: one
criteria field and one field representing the column you want to
search in....
Hmm...
This is the query that I thought might work.
SELECT * FROM CONTACTS
WHERE 'colsearch' LIKE '%critsearch%'
ORDER BY COMPANY, FULLNAME
Obviously 'colsearch' is a variable from a menu drop down
field.
Strangely, if I set the default value for colsearch as
COMPANY and default value for critsearch as '%', it does seem to
return a result (all records) on the page load (I have the form and
results on the same page) but if I hit submit, it returns no
recordset!
Is this even possible?
CODE:
$colsearch_recordlookup = "COMPANY";
if (isset($HTTP_POST_VARS['scolumn'])) {
$colsearch_recordlookup = (get_magic_quotes_gpc()) ?
$HTTP_POST_VARS['scolumn'] :
addslashes($HTTP_POST_VARS['scolumn']);
$critsearch_recordlookup = "%";
if (isset($HTTP_POST_VARS['scriteria'])) {
$critsearch_recordlookup = (get_magic_quotes_gpc()) ?
$HTTP_POST_VARS['scriteria'] :
addslashes($HTTP_POST_VARS['scriteria']);
mysql_select_db($database_dbcrm1, $dbcrm1);
$query_recordlookup = sprintf("SELECT * FROM CONTACTS WHERE
'%s' LIKE '%%%s%%' ORDER BY COMPANY, FULLNAME",
$colsearch_recordlookup,$critsearch_recordlookup);RichardODreamweaver wrote:
> This is the query that I thought might work.
>
> SELECT * FROM CONTACTS
> WHERE 'colsearch' LIKE '%critsearch%'
> ORDER BY COMPANY, FULLNAME
>
> Obviously 'colsearch' is a variable from a menu drop
down field.
The name of the column should not be in quotes:
SELECT * FROM CONTACTS
WHERE colsearch LIKE '%critsearch%'
ORDER BY COMPANY, FULLNAME
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Maybe you are looking for
-
Hi Experts, I have a file with the following format. I have to insert the data of those files in a table. I can use SQL Loader to load those files. My question is I need to schedule the upload of those files. Can i incorporate sql loader in a procedu
-
How do I get my music from iTunes to my new Macbook Pro?
They showed me how to get all my previously purchased music when I first got my Macbook, but i can't remember how to do it. They did something on iTunes, but I don't know what to do. Anybody know what I'm talking about?
-
Should I use google chrome on my macbook pro?
Firstly what exactly is google chrome and is it better than safari? If so is it just as safe and fast as safari?
-
RSD...just stops on its own?
So about a month ago the dreaded RSD started happening to my macbook. I tried several times to make appointments to see a "Genius" at my apple store, however unless I wanted 11am or 1130am on any day I tried...I couldnt get in, and forget any times o
-
hi, i use xdb's httpserver as gateway to plsql, instead of apache's mod_plsql. i set a DAD and configured it with basic authentication. everything works fine. but basic authentication uses db users, however i need to use application users to authenti