Selecting records include a second element
Hi,
I have polygon data set. Most of the polygons consist of one element. However, some of the polygons in the data set includes a second element represented in the SDO_ELEM_INFO attribute like: SDO_ELEM_INFO_ARRAY(1, 1003, 1, 23, 2003, 1). How can select objects which consist of two elements?
Regrads,
Thank you for your reply. But I could not solve the problem exactly. I used the SDO_UTIL.GETNUMELEM to learn number of element in a geometry. It returned 1:
SQL> select a.objectid, SDO_UTIL.GETNUMELEM(a.geom) from polygon1 a where a.objectid=2943;
OBJECTID SDO_UTIL.GETNUMELEM(A.GEOM)
2943 1
Actually, it is a polygon with a hole and includes two elements in the SDO_ELEM_INFO attribute:
SQL> select geom from polygon1 where objectid=2943;
GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 23, 2003, 1), SDO ORDINATEARRAY(………
I can not still select these kinds of geometries from table.
Similar Messages
-
Adobe form displaying data of previous selected records
Dear All,
I have created a wd component consisting of 2 views.
In the first view i am displaying an ALV. When i select a record and click on the alv button, the second view
gets called which contains an Adobe Form showing the data.
The problem i am facing is that the record which gets displayed in the adobe form is the one previous selected record and not the current record which i select.
Kindly give your valuable suggestions .
Regards,
NitiHi ,
Adobe form is just an external media in your case , it has nothing to do with your data.
Check what data is getting passed to adobe form via debuging .
check if your getting the selected element .
You can also post your code here if possible.
Regards
Kuldeep -
Selecting Records from 125 million record table to insert into smaller table
Oracle 11g
I have a large table of 125 million records - t3_universe. This table never gets updated or altered once loaded, but holds data that we receive from a lead company.
I need to select records from this large table that fit certain demographic criteria and insert those into a smaller table - T3_Leads - that will be updated with regard to when the lead is mailed and for other relevant information.
My question is what is the best (fastest) approach to select records from this 125 million record table to insert into the smaller table. I have tried a variety of things - views, materialized views, direct insert into smaller table...I think I am probably missing other approaches.
My current attempt has been to create a View using the query that selects the records as shown below. Then use a second query that inserts into T3_Leads from this View V_Market. This is very slow. Can I just use an Insert Into T3_Leads with this query - it did not seem to work with the WITH clause? My Index on the large table is t3_universe_composite and includes zip_code, address_key, household_key.
CREATE VIEW V_Market as
WITH got_pairs AS
SELECT /*+ INDEX_FFS(t3_universe t3_universe_composite) */ l.zip_code, l.zip_plus_4, l.p1_givenname, l.surname, l.address, l.city, l.state, l.household_key, l.hh_type as l_hh_type, l.address_key, l.narrowband_income, l.p1_ms, l.p1_gender, l.p1_exact_age, l.p1_personkey, e.hh_type as filler_data, 1.p1_seq_no, l.p2_seq_no
, ROW_NUMBER () OVER ( PARTITION BY l.address_key
ORDER BY l.hh_verification_date DESC
) AS r_num
FROM t3_universe e
JOIN t3_universe l ON
l.address_key = e.address_key
AND l.zip_code = e.zip_code
AND l.p1_gender != e.p1_gender
AND l.household_key != e.household_key
AND l.hh_verification_date >= e.hh_verification_date
SELECT *
FROM got_pairs
where l_hh_type !=1 and l_hh_type !=2 and filler_data != 1 and filler_data != 2 and zip_code in (select * from M_mansfield_02048) and p1_exact_age BETWEEN 25 and 70 and narrowband_income >= '8' and r_num = 1
Then
INSERT INTO T3_leads(zip, zip4, firstname, lastname, address, city, state, household_key, hh_type, address_key, income, relationship_status, gender, age, person_key, filler_data, p1_seq_no, p2_seq_no)
select zip_code, zip_plus_4, p1_givenname, surname, address, city, state, household_key, l_hh_type, address_key, narrowband_income, p1_ms, p1_gender, p1_exact_age, p1_personkey, filler_data, p1_seq_no, p2_seq_no
from V_Market;I had no trouble creating the view exactly as you posted it. However, be careful here:
and zip_code in (select * from M_mansfield_02048)
You should name the column explicitly rather than select *. (do you really have separate tables for different zip codes?)
About the performance, it's hard to tell because you haven't posted anything we can use, like explain plans or traces but simply encapsulating your query into a view is not likely to make it any faster.
Depending on the size of the subset of rows you're selecting, the /*+ INDEX hint may be doing your more harm than good. -
Hello folks,
Many times we need to retrieve records for given lists of PKs (or FKs), as:
p_pk_list := '11,22,33';
We work in 10g
A co-worker of mine had a good idea (I thought) to "help" the optimizer and build a recordset in the FROM clause and use it later in WHERE
SELECT ...
FROM tableName a,
(SELECT REGEXP_SUBSTR(p_pk_list, '[^,]+',1,ROWNUM) p_pk_id
FROM dual
CONNECT BY ROWNUM <= LENGTH(p_pk_list ) - LENGTH(REPLACE(p_pk_list ,','))) d_pk
WHERE
a.ID=d_pk.p_pk_id; -- (1)
The tragedy is that it takes 4 seconds to retrieve 5 records from the table (no other joins). The table has about 40 columns though and there are about 51000 records. With the SELECT REGEXP_SUBSTR in the WHERE clause, it's a bit worse.
If (1) is replaced by:
a.ID IN (11,22,33,44,55);
the execution takes 0.04 seconds.
My questions are:
1. Is this a bad idea to select records for a given list of PKs or FKs? Should one just go for one PK/FK instead?
2. Why the stiff performance penalty?
3. Ideally, it would be nice if this would work:
a.ID IN (p_array);
where p_array would be an array of integers
Any elegant sollutions?
Thanks a lot.
DanCheck the explain plan for both statements.
I would wager that the overhead you experience is due to the fact that you are comparing apples to oranges here.
(SELECT REGEXP_SUBSTR(p_pk_list, '[^,]+',1,ROWNUM) p_pk_id
FROM dual
CONNECT BY ROWNUM <= LENGTH(p_pk_list ) - LENGTH(REPLACE(p_pk_list ,','))) d_pkreturns a string.
a.ID IN (11,22,33,44,55);Is a list of numbers.
If you check the explain plan for the regexp version, you should see an implicit conversion being done for you (converting the number column into a string for comparison) which means you can't use any indexes defined on a.id.
If you want to use an array of numbers here's an approach using a built in array of numbers.
declare
v_number_list sys.odcinumberlist default sys.odcinumberlist();
begin
v_number_list.extend;
v_number_list(v_number_list.count) := 100;
v_number_list.extend;
v_number_list(v_number_list.count) := 200;
for vals in
select *
from all_objects
where object_id in
select column_value
from table(cast(v_number_list as sys.odcinumberlist))
loop
dbms_output.put_line(vals.object_name);
end loop;
end;
25 /
I_TYPED_VIEW1
I_NTAB2
PL/SQL procedure successfully completed.
ME_XE?Otherwise do an explicit TO_NUMBER on the regexp query so that you can use any indexes defined on the table in question. -
Select records based on monthly anniversary date
Hi,
I have a table with a date_added field and I want to select records based on the monthly anniversary date of this field.
eg. ID, Date_added
1, 10-DEC-2012
2, 11-NOV-2012
3, 10-MAR-2012
4, 28-FEB-2012
5, 30-DEC-2012
So For the 10th of Jan 2013, I would want to return records 1 and 3 only
I started looking at the extract function, but this soon falls down for records at the end of the month. For example, on the 28th Feb, I would also want to include records where the date_added day is the 29th, 30th or 31st. So, in the table above I would want to return records 4 and 5, but extract would only return 4.
Is there a simple function to do this month anniversary query - am I missing something very obvious? Or, do I need to write a query to explicitly cope with dates at the end of the month? So far I haven't found a sensible simple solution!
I'm using 11g
thanksI didn't look into leap year, but this should give you a starting point:
select *
from t
where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
when to_date(:target_date,'mmddyyyy')
then case
when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
then 1
end
else case
when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
then 1
end
end
/For example, target date is 1/10/2013:
SQL> variable target_date varchar2(8)
SQL> exec :target_date := '01102013';
PL/SQL procedure successfully completed.
SQL> with t as (
2 select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
3 select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
4 select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
5 select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
6 select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
7 )
8 select *
9 from t
10 where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
11 when to_date(:target_date,'mmddyyyy')
12 then case
13 when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
14 then 1
15 end
16 else case
17 when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
18 then 1
19 end
20 end
21 /
ID DATE_ADDE
1 10-DEC-12
3 10-MAR-12
SQL> And target date is 2/28/2013:
SQL> exec :target_date := '02282013';
PL/SQL procedure successfully completed.
SQL> with t as (
2 select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
3 select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
4 select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
5 select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
6 select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
7 )
8 select *
9 from t
10 where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
11 when to_date(:target_date,'mmddyyyy')
12 then case
13 when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
14 then 1
15 end
16 else case
17 when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
18 then 1
19 end
20 end
21 /
ID DATE_ADDE
4 28-FEB-12
5 30-DEC-12
SQL> SY. -
How to create and process Iinteractive report with selected records in 4.1
Hi,
I want to have an Interactive report that will have in front of each row a checkbox that can be selected for batch processing. Is there a way to do so?
If there is please include some method to process those records i.e. for each selected record create a new record on a different table and update the record itself as processed.
thanks
Edited by: yannisr on Jul 13, 2012 5:58 AMFor this you need to consult APEX documentation for two things
Create a checkboxes using APEX_ITEM API
How to reference those checkboxes within an On Submit Process -
Hi, everyone.
I have a problem in selecting records. In this case, I want to select records from database
LFA1,and the components of this table are LIFNR,ERDAT,LOEVM ,and so on.The type of LIFNR is char(10).There is a internal table:tab_cdhdr , the elements of tab_cdhdr are: objectid,udate and change_ind.The type of objectid is char(50).
And the select-rule is that: LIFNR = objectid. So I write like this:
select lifnr
erdat
loevm
form lfa1
into tab_lfa1
for all entries in tab_cdhdr
where lfa1 = tab_cdhdr-objectid+0(10).
But there is a warning: When using FOR ALL ENTRIES IN the specifyed length for "OBJECTID" is ignored in this condition.
Can you help me to solve this problem?
Thanks.Hi Feng..
If you dont want to change the Internal table TAB_CDHDR, Then declare another internal table (TEMPTAB_CDHDR.) with the same structure but Objectid with only 10 chars.
IF TAB_CDHDR[] IS NOT INITIAL.
LOOP AT TAB_CDHDR.
MOVE-CORRESPONDING TAB_CDHDR TO TEMPTAB_CDHDR.
APPEND TEMPTAB_CDHDR.
ENDLOOP.
select lifnr
erdat
loevm
form lfa1
into tab_lfa1
for all entries in tab_cdhdr
where lfa1 = TEMPtab_cdhdr-objectid.
ENDIF.
Sure ... this will work for u.....
REWARD IF HELPFUL. -
Error "SELECT statement includes a reserved word"
Dear Sir,
I am developing Ms Access 2010 and XP is the operating system.
I have placed a combobox on a form, but when I tired to update new string value in the same combobox, it generates an error "The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is
incorrect." .
I have debuged "Not In List" event and find this error generates soon after completing the "Not In List" event. I tried to find out any help on the internet but failed.
I shall be ever grateful if some one could help this regards.
KazimI think you need to do some homework on how relational databases work.
The following is my short description of the database relational model, but I emphasise the word 'short'.
The subject is a complex one with a huge body of academic and technical literature, so I can only hope to touch upon the basic principles of the model:
"The database relational model was originally proposed by E F Codd in a paper in 1970 in the journal 'Communications
of the Association for Computing Machinery'. Since then there has been a vast amount of further theoretical work, and the relational model has shown itself to be a robust one.
Without going too deeply into the theoretical basis, which can be quite abstract, a relational database in essence models a part of the real world in terms of its entity types and the relationship types between them.
Note the inclusion of the word 'type' in both cases here.
While its almost always used in the former case, its often omitted in the latter case.
This is a little bit sloppy but not too important. When one talks about a 'relationship' it really refers to a relationship value.
As an example 'marriage' is a relationship type, but my being married to my wife Fiona is a relationship value, represented by our names on the marriage certificate, which is the physical equivalent of a row in a Marriages table with columns Husband
and Wife, each referencing the primary key of a table People.
This is a many-to-many relationship type (I've been married twice so would be in two rows, my first wife would also be in two rows as she remarried too).
It is resolved into two one-to-many relationship types, People to Marriages in each case, in one case via the Husband column in the other via the Wife column.
In a relational database tables model Entity Types.
In the above example People is an entity type, modelled by the People table.
Marriage is also an entity type, modelled by the Marriages table.
As we've seen it's also a relationship type. In fact a relationship type is just a special kind of entity type.
Each column in a table represents an attribute type of each entity type, so attribute types of People might be FirstName,
LastName, DateOfBirth etc. This table would also have a PersonID numeric column (usually an autonumber) as its primary key as names are not distinct.
Each row in a table represents one instance of the entity type, and the attributes of each instance are represented by values at column positions in the row.
This is the only way that data can be legitimately stored in a relational database.
It's important that there is no redundancy in the information content of the database.
This is achieved by the process of 'normalization'. Normalization is based on a set of 'normal form's ranging from First Normal Form (1NF) to Fifth Normal Form (5NF) and beyond, though the higher normal forms are of a rather
different nature and we need not concern ourselves unduly with them.
There is also a Boyce/Codd Normal Form (BCNF) which was inserted when it was found that the original Third Normal Form was deficient; it didn't cater satisfactorily for tables with two or more candidate keys where the keys were composite and overlapped,
i.e. Had a column in common. I won't go into the details of normalization here; you'll find it written up in plenty of places.
To see an example of redundancy and therefore a table which is not properly normalized take a look at the Customers table
in the sample Northwind database which comes with Access. You'll see that it includes City, State/Region and Country columns.
If you look at its data you'll see for instance that we are redundantly told twice that Boston is in Massachusetts, and that this is in the USA
twice. This is not just inefficient, it is dangerous as it leaves the table open to inconsistent data being entered.
There is nothing to stop somebody putting Boston in the Massachusetts in one row and Milwaukee
in another, or putting Milwaukee in the UK in one row and the USA in another.
To normalize the table it should be decomposed into Customers, Cities, Regions and Countries tables, each of the first three with a foreign key referencing the primary key of the next table up in the hierarchy."
In your case you say a book can have more than one publisher.
This is true if you regard the entity as the book as a single 'work', not as a title.
I have two copies of Jane Austen's Mansfield Park for instance, each by a different publisher.
It is a single 'work' however. I've no idea if anyone else has written a book called Mansfield Park, but there is no reason why not, so let's assume that one exists.
This is not the same 'work' as Jane Austen's book, so conceptually is a different entity of type Books, and would be represented by a separate row in a table Books.
In the above context there is a many-to-many relationship type between Books and Publishers.
There is only one way to model such a relationship type, which is by a table which resolves the relationship type into two one-to-many relationship types.
So the model would, diagrammatically be:
Books----<BookPublishers>----Publishers
Title is a non-key column of Books.
The same title may appear in different rows, as with our hypothetical Mansfield Park by another author.
The primary key of books is a numeric BookID, usually an autonumber.
The BookPublishers table would have foreign keys BookID and PublisherID referencing the primary keys of the two referenced tables.
It would also have columns representing any attributes of the relationship type between the book and the publisher.
The primary key of this table is a composite one of BookID and Publisher.
To record multiple editions of a book published by a publisher requires another table along the following lines:
BookEditions
....PublisherID
(FK)
....BookID
(FK)
....EditionNumber
....EditionDate
.....ISBN
In this table PublisherID and BookID are a composite foreign key referencing the primary key of BookPublishers.
Note that ISBN is a column in this table as it applies to each edition of a book.
In the language of the relational model it is said to be functionally determined by the key of BookEditions.
Hopefully my short stock description of the relational model above, and my brief description of how it applies to the reality
which you are attempting to model will give you an insight into how to build a database, but I would strongly recommend that you first do some background work on how the database relational model works and how to apply its principles in Access.
I'll leave you with my own four, not altogether serious but nevertheless valid, ground rules for designing a relational database:
1.
KISS (Keep it simple, stupid!).
2.
When in a hole the first thing to do is stop digging.
3.
Always take account of Murphy's Law: 'If something can go wrong, it will go wrong'
4.
Always follow the advice given by Richard Feynman to his students: 'Don't write it down until you understand it'.
Ken Sheridan, Stafford, England -
Fetch records under 20 seconds in my view with sysdate
hi all
I want a query in my view that it returns records under 20 seconds and
after 20 seconds my query do not show any records
my query is :
select * from cnfenterexit
where cnf06date > sysdate - (1/86400000)
but it didn't work.
when I used following query whit this numbers ,
it is OK and show records under 56 seconds
select * from cnfenterexit
where cnf06date > sysdate - (3/1440)
please explain how to get under 20 seconds in me query?or
select *
from cnfenterexit
where cnf06date > sysdate -TO_DSINTERVAL('0 00:0:20')TO_DSINTERVAL('0 00:0:20') = 0 days, 0 hours, 0 minutes, 20 seconds
Timo -
I upgraded to yosemite and iOS 8 in order to record with quicktime. But when I select Record a new movies I immediately get an Operation Could not be completed error. When I choose record audio or screenshots, I get a little further, but as soon as I select my ipad as the source I get the same error message.
You don't need to be a developer for this to work. I get the same error. Just one more thing on the list that make me upset more and more with Apple. Things just don't work out of the box like they used to.
This new feature was to be included with iOS 8 and Yosemite. -
How check if selected record already locked?
Hi everybody,
Please, how can I check if selected record(s) already locked by another user
to prevent Oracle error.
Thank you.
DmitryGreat question. You can use a product called CleanEnter to prevent duplicates being created for Contacts (or Accounts or Leads) by checking against ANY field you wish including the Custom field you are mentioning.
To learn more about CleanEnter, go to http://www.activeprime.com/cleanenter/
Happy to discuss if you would like.
Cheers,
Greg
[email protected]
617-247-9908 x21 -
Is there any provision to view the selected record using SYS_REFCURSOR?
hi friends ,
I was using SQL Server . now i am shifting to Oracle . so we are changing the Stored Procedures in SQLServer to Oracle SP's. I have given the structure of procedure given below . If possible , i want to see the output of select statement in the TOAD editor . If any body knows please help me
CREATE OR REPLACE PROCEDURE PS_AON
P_STATUS OUT VARCHAR2,
P_CUR OUT SYS_REFCURSOR
AS
BEGIN
OPEN P_CUR FOR
select colum1,column2,column3 from Table 1;
EXCEPTION
WHEN OTHERS THEN
P_STATUS:=SQLERRM;
END;
This is one of the model of stored procedures i am using . And the editor i am using is TOAD 7.3.0 and oracle 9i. Is there any provision to view the selected records by running this procedure in TOAD editor
thanks & regards(assuming you have relatively recent version of TOAD).
Write a small block to call the procedure (or use Toad's 'execute procedure' option) as in the example below. Note the ':' in front of 'v_cur_out'. When you run the block, TOAD will prompt you for a value / datatype for 'v_cur_out'. Ignore the value, set the datatype to 'Cursor' and click OK. The resultset (if any) will be displayed in the Data Grid window below.
DECLARE
v_status VARCHAR2 (32767);
BEGIN
ps_aon (v_status, :v_cur_out);
DBMS_OUTPUT.PUT_LINE ('v_status => ' || v_status);
END;
/ -
How to get selected record details when single selection is used in a table
Hi All,
Inside a query region I have created a table using region wizard,for this table I have added a singleSelection Item. What I want is , on selection of a particular record i want to update or view that record in a new page , for this I have added update and view icons in each row.
But I am unable to get the particular selected record
OATableBean tableBean = (OATableBean)webBean.findChildRecursive("ResultTableRN");
OASingleSelectionBean singleSelection = (OASingleSelectionBean)tableBean.getTableSelection();
For this singleSelection object I was unable to find any method which will give the value of the view attribute associated with it.
Anybody any suggestions regarding it ?
Thanks in advance,
Anant NImbalkar.Hi Anant,
here is how you have to do it
1) you need to enable PPR on that Singl selection , by changining the Action type =fireAction.
2) define the envent , EVENT
3) define paramters for that event. This is place that gives you handle to the Attribute of VO.
So you can define paremters such
Name = PARAM1
value =${oa.EqxContactPrivEOVO1.ContactPrivilegeId}
You can define as many paramters as you can for the vo field that u wanted to have.
Now in the procesformRequest() , all you do it handle the event EVENT and get the parameters
if ("EVENT".equals(pageContext.getParameter(EVENT_PARAM)))
String accountid= pageContext.getParameter("PARAM1");
You can refer developer guide for further details. -
I have just purchased and downloaded Elements 10. Can't install it due to insufficient disk space on my C drive. I have enough space on my D drive, but it will not install there, probably because my sustem files are on C drive. The Install wisard does not provide for a selection of the size of Elements 10. Is there a way to select the minimum size? If so, how can I do this?
There is not an option to customize the installation. The system requirements for Photoshop Elements 10 request that you at least have 4 gigabytes free, plus more for installation, how much free space do you have on your C drive?
-
How to select records in ALV using FM
Hi guys,
How to select records in ALV using FM. Not the OO method. Thx in advance!
KunhI
by using REUSE_ALV_FIELDCATALOUG_MERGE. Iys fill field catalouge table as per internal table description. Then use REUSE_ALV_GRID_DISPLAY for display ALV REPORT.
**Please reward suitable points***
With Regards
Navin Khedikar
Maybe you are looking for
-
Why am I seeing a "Download Error" message in Creative Cloud Desktop app?
am connecting with the internet and my login info. is correct but always i have a massage say download error please contact customer support . do i have to download it again ?
-
Retruning parameter/value from report to form - (Urgent)
Hi , I am calling a report (2.5) from a form using RUN_PRODUCT. I would like to know if there is any way to do the following. (a) Return a value from reports to calling form. For ex. I would like to know the last Item name (assuming the reports print
-
During the setting up of my new iphone 4s music doesn' t show as a selection with icloud
i tried to set up my iphone 4s and itunes 10.5.2 to share music via i cloud in settings>store>automatics downloads menu i had to activate apps and books as a choise ( there wasn 't a choise for music such i see in user manual) Same in itunes edit>pre
-
How do i download a movie from my sony handy cam to my macbook pro
how do i download a movie from my sony handycam to my macbook pro
-
Note on interactive SVG and Edge Commons
I encountered something I want to mention so people do not pull their hair trying to find out which things are not working. 1- issue publishing If you add a js folder for your js files, Animate v2 will not import it in your web folder - So add it aft