8i Query not returning expected records
Using Oracle 8i (8.1.7), a basic spatial query is not returning all the expected results. Table1 contains a variety of polygons; table2 is simply a set of rectangles. I want to return all objects from table1 that intersect a particular rectangle. The query below mostly works, but misses out some objects. On my system, 38 objects are returned where about 41 are expected; on the client system (which does not have identical data) the problem appears to be much worse, with hardly any objects being returned. The missing objects are clearly visible on the map, surrounded on all sides by objects which have been selected correctly. Help?
Select t1.id from table1 t1, table2 t2
where t1.IsCurrent = -1
and (sdo_relate(t1.geoloc, t2.geoloc, 'mask=ANYINTERACT querytype=WINDOW') = 'TRUE')
AND (t2.ID in ('001'));
Hi,
When the non-spatial predicate is dropped, you mentioned the
objects are not missing. This means the spatial index (which will
surely be used in this case) should be returning correct results.
But it is possible the index is not used when other predicates are
specified. Please look at the "execution plan" in both cases (when the
objects are missing/not missing).
Rewrite the query as:
select /*+ ORDERED INDEX(t1 <spatial_index_name>) */ t1.id from t2, t1
This should ensure a spatial-index-based evaluation.
Let us know the execution plans and the behavior in either case.
Btw, one thing to check is your tolerance values in
user_sdo_geom_metadata.
- Ravi.
Similar Messages
-
Query Not Returning Enough Records
have two tables that I am trying to join together.
The first table shows the income for each department of the store broken down by period like this:
Store_Data:
Store_Type Dept Year Period Sales
Grocer Produce 11 01 31865.00
Grocer Produce 11 02 32525.00
Grocer Produce 11 03 37490.00
Grocer Meat 11 01 224.00
Grocer Dairy 11 02 5850.00
Grocer Dairy 11 03 33209.92
Grocer Dry 11 03 1000.00
The second table contains a record for each store showing it's goal, like this:
Goal_Data:
Store_Type Dept Year Amount
Grocer Produce 11 157192.00
Grocer Canned 11 0.00
Grocer Paper 11 146820.00
Grocer Meat 11 2168.00
Grocer Dairy 11 50000.00
Grocer Frozen 11 29464.00
Grocer Pet 11 330096.00
Grocer Dry 11 1716.00
Grocer Pharmacy 11 0.00
Grocer Misc 11 6668.00
Now, I have a query to join the two tables. What I want is for all the records in the second table, whether or not there is a corresponding record in the first (such as 'Meat' and 'Dairy').
I have to filter on Store_Data.Store_Type, Store_Data.Year, Store_Data.Period
Crystal is outputting the following SQL:
SELECT DISTINCT
Store_Data.Store_Type,
Store_Data.Dept,
Store_Data.Year,
Store_Data.Period,
Store_Data.Sales,
Goal_Data.Amount
FROM
Store_Data
RIGHT OUTER JOIN Goal_Data
ON ((Goal_Data.Dept=Store_Data.Dept) AND
(Goal_Data.Store_Type=Store_Data.Store_Type))
AND (Goal_Data.Year=Store_Data.Year)
WHERE
Store_Data.Store_Type='Grocer'
AND Store_Data.Year='11'
AND (Store_Data.Period='01'
OR Store_Data.Period='02'
OR Store_Data.Period='03')
But I'm only getting the records from the Store_Data table (and records in Goal_Data where the "ON" fields match). Testing in SQL Server verifies that the query is producing incorrect output.
What do I need to change to do what I'm wanting to do?It looks like the thread is going to take a left turn just about now.
The problem appears to be that, for the query to work properly, the filter for the period has to be in the joins "ON" clause.
This I accept.
And, apparently, trhe only way to get a parameter value to go into that area is by using a stored procedure.
To that end, I have created a Stored Procedure which takes three parameters, "Store_Type", "Year", and "Quarter"
I have verified that the results are what I need. I plugged the stored procedure into my report (which is technically a sub-report) and it asked me for the values of the parameters. Entering them in, I do get a result that I would expect.
Everything good so far.
Now, about those parameters (both for the Storeed Procedure as well as the report). As I said, the report that I have been working is actually a sub-report, one of five which will be on the main report. Each report will require the same three parameters, two of which (year and quarter) need to be selected by the user and will feed the same values to all five sub-reports. The third parameter should be "hard-coded" to each particular sub-report.
Now for the issue (the main point being that I am unfamiliar with CR and Stored Procedures)...
The way things are going now, when all is said and done, it looks like the user will be required to enter in the year and quarter for each sub-report (the Store_Type will be there too, but it will have a default value). That's the user typing in '2012' for the year five times and '1' for the quarter five times. This is unacceptable.
So, how do I create a single Year parameter and a single Quarter parameter that will feed all five reports?
Apparently trying to code it in the Report Selection Formula is not the right path.
So, can someone either walk me through the process, or point me to a tutorial where the process is explained?
TIA -
Query is returning multiple records for a bank account id and party id
Hi All,
I am not getting why this query is returning multiple records for a particular bank account id and party id:
SELECT instrument_payment_use_id
,instrument_type
,instrument_id
,start_date
,ext_pmt_party_id
FROM iby_pmt_instr_uses_all
WHERE instrument_id =:lv_num_ext_bank_account_id
and exists (select 1 from iby_external_payees_all b where PAYEE_PARTY_ID= :lv_num_party_id and b.ext_payee_id = ext_pmt_party_id)
I want above values to be used in api iby_disbursement_setup_pub.set_payee_instr_assignment in R12.
Please help asap.
ThanksO/P of query run for
SELECT rowid, instrument_payment_use_id
FROM iby_pmt_instr_uses_all
WHERE instrument_id =6642
AND EXISTS (
SELECT 1
FROM iby_external_payees_all b
WHERE payee_party_id= 85470
AND b.ext_payee_id = ext_pmt_party_id);
is below:
Rowid INSTRUMENT_PAYMENT_USE_ID
AABiDXAGIAABhiKAAS 236586
AABiDXAGRAABSjtAAz 148437
The version is R12 -
Procedure Does not return expected new rows unless I ALTER the procedure it self
Procedure Does not return expected new rows !!! unless I ALTER the procedure it self
And what exactly do you alter, the code / where clause / or ...?
Olaf Helper
[ Blog] [ Xing] [ MVP] -
'Query not returning string values as expected
Hi
Why would this be happening?
I have an insert statement that looks like this;
UNION ALL
SELECT '59','','last','first','','','','WILLIAMTA','BEB92C5B52566E6594707C69729624BE','','','Senior Officer','Town Name','2','','SUSTAINABLE FOREST MANAGEMENT DIVISION','NAME BRANCH','CURRENT' FROM DUAL
...I then want to create an conditional display statement in an apex application that looks like this;
PLEASE NOT I HAVE REPLACED (the symbols that will not render for not equal to) WITH THE TEXT "NOT EQUAL TO"
SELECT USERNAME
FROM sfm_common.sct_parties
WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
AND username = :app_userBut it doesnt return anything and I know it should so I do some tests, below;
1. You will see the first statement returns no records.
2. In the second statement there is a space between N and the quote, and it returns a record
3. In the third test if I make the gap really big it still returns a value.
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 8 14:27:55 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> SELECT DISTINCT null
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
4 /
no rows selected
SQL> SELECT DISTINCT null
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
4 /
N
SQL> SELECT DISTINCT NULL
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
4 /
N
SQL>Would anyone know why this has happened, I have checked my insert scripts and there is no space at the end of the text in the column named 'division'.
Ben
Edited by: Benton on Sep 8, 2009 2:59 PMThe table contains attributes like this;
Col_1
TOMATO
ORANGE
APPLE
NULLSo what I was attempting to do was something like this;
SELECT col_1 FROM table WHERE col_1 != 'TOMATO'
I would then expect to see;
Col_1
ORANGE
APPLE
NULLBut instead I had the following returned;
no rows selected
Which is not correct.
Apparently the fact that the column is 255 characters long is causing a problem, but I really dont understand why because I have other tables where I execute columns that are not the exact length of the content and yet the sort of query that I have used as an example work perfectly fine. For example;
SQL> SELECT name
2 FROM table_name
3 WHERE name != 'HYGIENE MANAGEMENT'
4 /
NAME
ACTION
APPROVALS
AUDITING
BURNING
COLLECTION
COMMUNICATION
COMPLIANCE
DEVELOPMENT
DISTURBANCE
DOCUMENT CONTROL
ERADICATION
11 rows selected.
SQL>And the ddl for the table looks like this;
CREATE TABLE "TABLE_NAME"
( "ACT_ID" NUMBER,
"NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"CREATED_BY" VARCHAR2(50 BYTE) DEFAULT 'USER',
"CREATED_ON" DATE DEFAULT SYSDATE,
"EFF_FROM" DATE DEFAULT SYSDATE,
"EFF_TO" DATE,
"DEFINITION" VARCHAR2(4000 BYTE),
"STATUS" VARCHAR2(15 BYTE) DEFAULT 'CURRENT' NOT NULL ENABLE,
CONSTRAINT "TABLE_NAME_CHK1" CHECK ( status IN ('CURRENT','NOT CURRENT')) ENABLE,
CONSTRAINT "TABLE_NAME_PK" PRIMARY KEY ("ACT_ID");The name field in this instance is 50 characters long and the words 'HYGIENE MANAGEMENT' make up 18 characters.
Ben -
Query for file version less than 10.0 does not return expected data
I'm trying to build a query for all PCs that have a version of Iexplore.exe in c:\windows\program files\ that is less than 10.0 . When I run the query it returns no data. When I change 10.0 in the query to 9.9 it returns files with version 10.xxx in
the results. Its as if it is seeing 10.0 as 1.0. Is this expected ?
select SMS_R_System.Name, SMS_R_System.ADSiteName, SMS_G_System_SoftwareFile.FileName, SMS_G_System_SoftwareFile.FileVersion from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where
SMS_G_System_SoftwareFile.FileName = "iexplore.exe" and SMS_G_System_SoftwareFile.FilePath = "C:\\program files\\internet explorer\\" and SMS_G_System_SoftwareFile.FileVersion < "9.9"It is because the values are not integer, they are a string. And therefore 1 is smaller then 9.
http://www.enhansoft.com/ -
Hello,
Could someone help me please ?
I have a listing of my sales orders and I want to make changes in my order by opening the form and fetched with that record. When I click on that particular orderno in my listing of order and call the form to display the details, it calls the form but says "Query could not fetch the record". I do not know why ? Please help me with the solution.
ThanxHello,
I think you are passing orderno to called form as a parameter. If you are using parameter list check..
1. If parameter data is getting in form correctly ?
2. Next, have you changed where clause of other block,so that is will display record with passed orderno ?
I am expecting more details from you.
Thanx
Adi -
SDO_RELATE does not return expected points
Hi,
I have a problem with a query which does not return the results I am expecting. I think it may be to do with geodetic data v projected data but fail to see how.
the table points2 contains point data stored in Lat Long (SRID 8307)
Here is my query:
SELECT mdsys.sdo_cs.transform(points2.assetextent,26943) FROM points2
WHERE SDO_RELATE (points2.ASSETEXTENT, MDSYS.SDO_GEOMETRY(2003,26943 ,NULL, mdsys.SDO_ELEM_INFO_ARRAY(1,1003,3), mdsys.SDO_ORDINATE_ARRAY(1831679.1743184,644380.053168771,1831699.1743184,645000.053168677)),'mask=anyinteract') = 'TRUE';
This query returns 0 results. if perform the same query with SDO_FILTER rather than SDO_RELATE then I get 1 result (which is what I expect). the result is this:
MDSYS.SDO_CS.TRANSFORM(POINTS2.ASSETEXTENT,26943)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
SDO_GEOMETRY(3001, 26943, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(1831689.17, 644440.053, 0))
1 row selected.
As can clearly be seen from this result the point is 10m from the both vertical edges of the optimised rectangle and at least 60m from the horizontal edges.
The sdo_geom_metadata_table entry for this table is:
SDO_OWNER SDO_TABLE_NAME
SDO_COLUMN_NAME
SDO_DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
SDO_SRID
VST POINTS2
ASSETEXTENT
SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .005), SDO_DIM_ELEMENT('Y', -90, 90, .005), SDO_DIM_ELEMENT('Z', -999, 5000, .005))
8307
Anyone got any pointers? If you need more info just let me know
Samhi,
can you try this query and let us know what you get ?
Transform the geometry to 8307 and pass it into the sdo_relate
operator.
SELECT mdsys.sdo_cs.transform(points2.assetextent,26943) FROM points2
WHERE SDO_RELATE (points2.ASSETEXTENT,
sdo_cs.transform(MDSYS.SDO_GEOMETRY(2003,26943 ,NULL, mdsys.SDO_ELEM_INFO_ARRAY(1,1003,3), mdsys.SDO_ORDINATE_ARRAY(1831679.1743184,644380.053168771,
1831699.1743184,645000.053168677)), 8307), 'mask=anyinteract') = 'TRUE'; -
Query not returning any rows?
hi experts,
My query running long but not returning any result. i have data , no locks on the tables.
i have bigger ( hardware ) database on different server , where I can get results with same query.
Can you tell me what are the DB settings i have to look at to resolve this issue?
( any sql query that can monitor these parameters ?)
(the tabels involved in this query has 33milliions, 2millions, 7 milllions )
Thanks ..
Edited by: 642877 on Sep 21, 2011 6:46 PMOracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
==========================================================
Plan hash value: 3185710999
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 3 | 423 | 24592 (2)| 00:05:45 | | |
| 1 | HASH GROUP BY | | 3 | 423 | 24592 (2)| 00:05:45 | | |
| 2 | NESTED LOOPS | | | | | | | |
| 3 | NESTED LOOPS | | 3 | 423 | 24591 (2)| 00:05:45 | | |
| 4 | NESTED LOOPS | | 3 | 345 | 24585 (2)| 00:05:45 | | |
| 5 | NESTED LOOPS | | 1 | 84 | 21916 (2)| 00:05:07 | | |
| 6 | NESTED LOOPS | | 1 | 67 | 21915 (2)| 00:05:07 | | |
| 7 | PARTITION LIST ALL | | 2 | 60 | 21913 (2)| 00:05:07 | 1 | 11 |
|* 8 | TABLE ACCESS FULL | ART_CRDT_ACCT_FACT | 2 | 60 | 21913 (2)| 00:05:07 | 1 | 11 |
|* 9 | TABLE ACCESS BY INDEX ROWID| ART_PRTFOL_GRP_DIM | 1 | 37 | 1 (0)| 00:00:01 | | |
|* 10 | INDEX UNIQUE SCAN | ART_PRTFOL_GRP_DIM_INDEX1 | 1 | | 0 (0)| 00:00:01 | | |
| 11 | TABLE ACCESS BY INDEX ROWID | W_MONTH_D | 1 | 17 | 1 (0)| 00:00:01 | | |
|* 12 | INDEX UNIQUE SCAN | UQ_W_MONTH_D | 1 | | 0 (0)| 00:00:01 | | |
| 13 | PARTITION LIST ITERATOR | | 3 | 93 | 2669 (2)| 00:00:38 | KEY | KEY |
|* 14 | TABLE ACCESS FULL | ACCT_CLTRL_RLTNP | 3 | 93 | 2669 (2)| 00:00:38 | KEY | KEY |
|* 15 | INDEX UNIQUE SCAN | UQ_ART_CLTRL_DIM | 1 | | 1 (0)| 00:00:01 | | |
| 16 | TABLE ACCESS BY INDEX ROWID | CLTRL_DIM | 1 | 26 | 2 (0)| 00:00:01 | | |
------------------------------------------------------------------------------------------------------------------------------- -
Basic NOT EXISTS query not returning any results
DB Version: 10gR2
One of our tables in the test schema is having less number of columns than the PROD shema.
To determine which are missing columns in this table in Test schema i did the following.
-----In Test Schema
CREATE TABLE XYZ2
(COL1 NUMBER); ----------only one column
SQL > CREATE TABLE tables_test_list AS SELECT TABLE_NAME,COLUMN_NAME FROM USER_TAB_COLS;
Table created.--- In the prod schema
SQL> CREATE TABLE XYZ2
2 (COL1 NUMBER,
3 COL2 NUMBER ----------- same table name with an extra column
4 );
Table createdAnd from the PROD schema i execute the following SQL to determine what are the columns that are missing in the TEST schema
select column_name from User_Tab_Cols outer
where table_name='XYZ2'
and not exists (select 1 from TEST_SCHEMA.tables_test_list inner where outer.TABLE_NAME=inner.TABLE_NAME )But the above query is not returning any results. Any idea why?Actually, the example from the link I posted earlier:
[email protected]> (
2 select 'IN T1, NOT T2', column_name,data_type,data_length
3 from user_tab_columns
4 where table_name = 'T1'
5 MINUS
6 select 'IN T1, NOT T2', column_name,data_type,data_length
7 from user_tab_columns
8 where table_name = 'T2'
9 )
10 UNION ALL
11 (
12 select 'IN T2, NOT T1', column_name,data_type,data_length
13 from user_tab_columns
14 where table_name = 'T2'
15 MINUS
16 select 'IN T2, NOT T1', column_name,data_type,data_length
17 from user_tab_columns
18 where table_name = 'T1'
19 )
20 / -
All,
I have 2 dimension tables and 1 logical fact table
a01_bi_agency_interest_dim
a01_bi_dsk_central_file_dim
tier2_facts
1 Complex Join in Physical Layer
A01_BI_AGENCY_INTEREST_DIM.MASTER_AI_ID = A01_BI_DSK_CENTRAL_FILE_DIM.MASTER_AI_ID AND A01_BI_AGENCY_INTEREST_DIM.INT_DOC_ID = A01_BI_DSK_CENTRAL_FILE_DIM.INT_DOC_ID
2 Logical Joins in BMM
A01_BI_AGENCY_INTEREST_DIM to tier2_facts (inner, 0 or 1 to many)
A01_BI_DSK_CENTRAL_FILE_DIM to tier2_facts (inner, 0 or 1 to many)
Query only returns 1 row. Should return many rows, I have checked the data through sql queries in SqlPlus.
Query from advanced tab.
SELECT A01_BI_AGENCY_INTEREST_DIM.MASTER_AI_NAME saw_0,
A01_BI_DSK_CENTRAL_FILE_DIM.INT_DOC_ID saw_1
FROM TIER2 ORDER BY saw_0, saw_1
Any help would be appreciated. I am missing something, but doesn't make sense.
Thanks,
KathyIt doesn't do the join and I get 1 record returned with zero's for both values. Why doesn't it pick up my join?
-------------------- SQL Request:
SET VARIABLE QUERY_SRC_CD='Report';SELECT A01_BI_AGENCY_INTEREST_DIM.MASTER_AI_ID saw_0, A01_BI_DSK_CENTRAL_FILE_DIM.INT_DOC_ID saw_1 FROM TIER2 ORDER BY saw_0, saw_1
+++300000:300004:----2012/06/01 12:44:51
-------------------- General Query Info:
Repository: Star, Subject Area: TIER2, Presentation: TIER2
+++300000:300004:----2012/06/01 12:44:51
-------------------- Cache Hit on query:
Matching Query: SET VARIABLE QUERY_SRC_CD='Report';SELECT A01_BI_AGENCY_INTEREST_DIM.MASTER_AI_ID saw_0,
A01_BI_DSK_CENTRAL_FILE_DIM.INT_DOC_ID saw_1
FROM TIER2 ORDER BY saw_0, saw_1
Created by: Administrator
+++300000:300004:----2012/06/01 12:44:51
-------------------- Query Status: Successful Completion
+++300000:300004:----2012/06/01 12:44:51
-------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 0, DB-connect time 0 (seconds)
+++300000:300004:----2012/06/01 12:44:51
-------------------- Rows returned to Client 1
+++300000:300004:----2012/06/01 12:44:51
-------------------- Logical Query Summary Stats: Elapsed time 0, Response time 0, Compilation time 0 (seconds) -
IPTObjectManager.Query not returning correct result (Java)
Hi,
I am having a problem with the IPTObjectManager.Query method. The code is given below. The issue I am having is, that when I search for a community in a specific folder not results are returned. However if I search in all folders (using -1 as the second parameter to the method) it returns multiple communities including the one I need. Anyone else had the same issue with this??
// THIS CODE WORKS AND RETURN MULTIPLE COMMUNITIES
// THE hotelCode VARIABLE IS A STRING VARIABLE CONTAINING A VALUE
// WHICH IS THE COMMUNITY NAME.
// Create a ObjectManager object
IPTObjectManager objectManager = session.GetObjectManagers(ObjectClass.Community.toInteger());
// define the query based on the passed string
Object[][] vQueryFilter = {
new Object[]{new Integer(PT_PROPIDS.PT_PROPID_NAME)},
new Object[]{new Integer(PT_FILTEROPS.PT_FILTEROP_CONTAINS)},
new Object[]{hotelCode}};
// Run the query and return results
IPTQueryResult ptQueryResult = objectManager.Query(
PT_PROPIDS.PT_PROPID_ALL, -1, PT_PROPIDS.PT_PROPID_NAME, 0, -1, vQueryFilter);
// THIS CODE DOES NOT WORK. I AM PASSING IS THE FOLDER ID OF THE
// FOLDER WHICH CONTAINS THE COMMUNITY
// Create a ObjectManager object
IPTObjectManager objectManager = session.GetObjectManagers(ObjectClass.Community.toInteger());
// define the query based on the passed string
Object[][] vQueryFilter = {
new Object[]{new Integer(PT_PROPIDS.PT_PROPID_NAME)},
new Object[]{new Integer(PT_FILTEROPS.PT_FILTEROP_CONTAINS)},
new Object[]{hotelCode}};
// Run the query and return results
IPTQueryResult ptQueryResult = objectManager.Query(
PT_PROPIDS.PT_PROPID_ALL, 303, PT_PROPIDS.PT_PROPID_NAME, 0, -1, vQueryFilter);I don't know about G6, however in version 5 there does not appear an easy way of doing it. I guess the "easiest" way would be to query sub-folders first, build and array of their ids, and then query for communities in those folders. This is using server API. Something like this (.NET):
publicvoidGetFolderCommunities(intfolderId){ IPTAdminFolder folder =this.session.GetAdminCatalog().OpenAdminFolder(folderId, false); IPTQueryResult qr =folder.QuerySubfolders(PT_PROPIDS.PT_PROPID_ALL, [b]1, null, 0, -1, newobject[][] { newobject[] { PT_PROPIDS.PT_PROPID_FOLDER_FOLDERTYPE }, newobject[] { PT_FILTEROPS.PT_FILTEROP_EQ } , newobject[] { PT_ADMIN_FOLDER_TYPES.PT_ADMIN_FOLDER_TYPE_COMMUNITYFOLDER } } ); int[] folderIds =newint[qr.RowCount()]; Console.WriteLine("------ sub-folders for communities -------"); for(inti =0; i <qr.RowCount(); i++) { intobjectId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_OBJECTID); stringobjectName =qr.ItemAsString(i, PT_PROPIDS.PT_PROPID_NAME); intparentFolderId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_FOLDER_PARENTFOLDERID); folderIds[i] =objectId; Console.WriteLine("{0}: {1}; parent: {2}", objectId, objectName, parentFolderId); } qr =this.session.GetCommunities().Query( PT_PROPIDS.PT_PROPID_ALL, -1, (object) null, 0, -1, newobject[][] { newobject[] { PT_PROPIDS.PT_PROPID_FOLDERID }, newobject[] { PT_FILTEROPS.PT_FILTEROP_IN } , newobject[] { folderIds } } ); Console.WriteLine("------ communities from sub-folders -------"); for(inti =0; i <qr.RowCount(); i++) { intobjectId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_OBJECTID); stringobjectName =qr.ItemAsString(i, PT_PROPIDS.PT_PROPID_NAME); int parentFolderId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_FOLDERID); Console.WriteLine("{0}: {1}; folder: {2}", objectId, objectName, parentFolderId); }}
Or you could use EDK RPC search. Again, in .NET:
publicvoidSearchForCommunities(intfolderId){ IPortalSearchRequest searchRequest =this.ptSession.GetSearchFactory().CreatePortalSearchRequest(); searchRequest.SetObjectTypesToSearch(newObjectClass[] { ObjectClass.Community }); searchRequest.SetDocFoldersToSearch(newint[] {}, true); searchRequest.SetAdminFoldersToSearch(newint[] { folderId}, true); searchRequest.SetResultsCount(0, 100); searchRequest.SetResultsOrderBy(PortalField.OBJECT_ID); searchRequest.SetFieldsToReturn(newPlumtreeField[] {}); searchRequest.SetQuery("*"); ISearchResponse searchResponse =searchRequest.Execute(); intreturnedMatches =searchResponse.GetReturnedCount(); ISearchResultSet resultSet =searchResponse.GetResultSet(); IEnumerator enumerator =resultSet.GetResults(); while(enumerator.MoveNext()) { ISearchResult result =(ISearchResult) enumerator.Current; Console.WriteLine( result.GetFieldAsInt(PortalField.OBJECT_ID) +": "+ result.GetFieldAsString(PlumtreeField.NAME) ); }}
Ruslan. -
Personnel Admin AdHoc Query not retrieving all records
Hi, I recently added a custom info type to a copy of the SAP ad hoc query for Personnel Admin by using the menu path in SQ02>Edit>Change Infotype selection . The query is picking up the new info type and runs fine but does not retrieve all records from the table for a given personnel id. It only retrieves 1 record per id.
Has anyone dealt with this before and have an easy/quick fix for this?Have other users try the query, preferably a user with end user authorization.
I've had this issue before, I'm an IT person and I customized a Standard infoset.
During testing, I'm only getting 1 (in my case) Insurance record per employee.
The end user can see multiple record per employee.
Btw, did you customize a Global or a Standard Infoset?
Regards,
Olekan -
Ctxrule - match does not return expected result
v.11.1.07 - I have created a ctxrule index as detailed below. However, although a query should match on the given document, it does not return. Any ideas?
begin
ctx_ddl.create_preference('ot_lexer', 'basic_lexer');
ctx_ddl.set_attribute('ot_lexer', 'index_stems', 'ENGLOSH');
end;
begin
ctx_ddl.create_section_group('ot_sec_group', 'auto_section_group');
end;
create table ot_profile_test
(profile_id number,
query clob);
create index ot_profile_rule_ndx on ot_profile_test(query)
indextype is ctxsys.ctxrule parameters
('stoplist ctxsys.empty_stoplist
section group ot_sec_group
lexer ot_lexer');
insert into ot_profile_test values(1, '($apple and $pear) and (1 within food)');
commit;
exec ctxsys.ctx_adm.set_parameter('log_directory', '/yourdir');
exec ctx_output.start_log('ot');
exec ctx_output.add_event(ctx_output.event_index_print_rowid);
exec ctx_output.add_event(ctx_output.event_index_print_token);
exec ctx_ddl.sync_index('ot_profile_rule_ndx', '2040M', null, 1, null, ctx_ddl.lock_nowait_error);
exec ctx_output.end_log;Then, run a query:
declare
a clob := 'apple orange pears banana
<metadata>
<indicators>
<food>1</food>
</indicators>
</metadata>
vn_profile_id number;
begin
select profile_id into vn_profile_id
from ot_profile_test
where matches(query, a) > 0;
dbms_output.put_line(vn_profile_id);
end;
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 8Shouldn't profile_id = 1 be returned?
Also, shouldn't the logfile have 2 rows written to $I?
WRITING TOKEN APPLE:((PEAR) = (PEARS)) * ((1) WITHIN FOOD),0
WRITING TOKEN APPLES:((PEAR) = (PEARS)) * ((1) WITHIN FOOD),0You need to use a basic_wordlist instead of a basic_lexer and ENGLISH instead of ENGLOSH in order to use stemming and your clob (variable a) must be valid html or xml in order to search within sections. Please see the simplified demonstration below.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference ('ot_wordlist', 'basic_wordlist');
3 ctx_ddl.set_attribute ('ot_wordlist', 'stemmer', 'ENGLISH');
4 ctx_ddl.create_section_group ('ot_sec_group', 'auto_section_group');
5 end;
6 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> create table ot_profile_test
2 (profile_id number,
3 query clob)
4 /
Table created.
SCOTT@orcl_11gR2> create index ot_profile_rule_ndx
2 on ot_profile_test (query)
3 indextype is ctxsys.ctxrule
4 parameters
5 ('stoplist ctxsys.empty_stoplist
6 wordlist ot_wordlist
7 section group ot_sec_group')
8 /
Index created.
SCOTT@orcl_11gR2> insert into ot_profile_test values
2 (1, '($apple and $pear) and (1 within food)')
3 /
1 row created.
SCOTT@orcl_11gR2> commit
2 /
Commit complete.
SCOTT@orcl_11gR2> exec ctx_ddl.sync_index ('ot_profile_rule_ndx')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> declare
2 a clob :=
3 '<table>
4 <fruits>apple orange pears banana</fruits>
5 <metadata>
6 <indicators>
7 <food>1</food>
8 </indicators>
9 </metadata>
10 </table>';
11 begin
12 for r in
13 (select profile_id
14 from ot_profile_test
15 where matches (query, a) > 0
16 order by profile_id)
17 loop
18 dbms_output.put_line (r.profile_id);
19 end loop;
20 end;
21 /
1
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> -
A Simple Linq Query to return a Record from SQL Server
I have a table named Customers which contain columns like
Id Col1 Col2 Col3 Col4 Col5
How do I write a Linq query to return the value of Col2 where Id=999Hello,
It depends on what method you use to read data i.e. Data Context class, Entity Framework for SQL-Server we can get data directly from the database easily.
The following has two very simply examples using data context classes and the same came be done with Entity Framework which has an even more powerful version of data context implementation under 6 and above
Dim db As New DataClasses1DataContext
Dim theCustomer As Customer = db.Customers.Where(Function(c) c.CustomerID = 999).FirstOrDefault
If theCustomer IsNot Nothing Then
' use theCustomer which contains all columns
Else
' do not use, customer not located
End If
Dim theCustomer1 As Customer =
From c In db.Customers
Where c.CustomerID = 999
Select New Customer With
.CompanyName = c.CompanyName,
.ContactName = c.ContactName,
.Orders = c.Orders
).FirstOrDefault
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.
Maybe you are looking for
-
RH7 WebHelp Pro I have some PDF files in ../../../Images/PDFs/. The hyperlinks I have created work in View Selected Item but not when I View Primary Layout in Internet Explorer. I moved these files (within the project) from the top level folder to a
-
HELP! What can I do?
this crack came out of nowhere today: http://i34.tinypic.com/34gx3i9.jpg http://i35.tinypic.com/n1w0m8.jpg **these pictures arent mine** i did a quick google search to see if any macbook users experienced this same problem, and these pictures came up
-
Hi There, Is there anyone who can help me with a java issue? I'm working on an assignment that deals with a simple java web server. The aim of the assignment is to create features that will allow the generation of dynamic web pages, the minimum requr
-
Bootcamp with Win' 8 won't start after Yosemite
After installing bootcamp I had to upgrade my windows partition, it worked until I upgraded to Yosemite. After upgrading and rebooting and clicking alt the windows option didn't even appear. I tried a couple of tips in the communitie threads and mana
-
My external hard drive ejects when copying data. It works on windows and ubuntu. Are there any fixes?