SDOAPI and SPATIAL operators
Hi, does anyone know if there is a java package that permits me to do some operations such as distance between 2 geometry SDO objects? I know there's sdoapi package that permits to create jgeometry objects, but it hasn't methods equivalent,for example, to within_distance operator of the spatial ...
Another thing... are sdoapi and oracle spatial free or do i need a licence for them?
Please make me know...
Tnx
Hi,
SDOAPI and Locator (a large subset of spatial including all datatypes, indexes, and operators) are included with the database.
SDOAPI allows you to call the server side spatial operators - they aren't implemented in the API.
Similar Messages
-
ODCI error with spatial operators
Hi group,
I get ODCI errors with spatial operators SDO_RELATE, SDO_FILTER and SDO_WITHIN_DISTANCE (not SDO_NN) called from JDBC (Java 1.2.2).
For example:
SELECT A.gid FROM FeatureTable1 A, FeatureTable1 B WHERE B.gid = 3 AND SDO_RELATE(A.Geometry, B.Geometry, 'mask=ANYINTERACT querytype = WINDOW') = 'TRUE';
Displays the error
ORA-29902: error in executing ODCIIndexStart() routine
Other functions such as SDO_AREA, SDO_NN work fine, though.
Both feature tables where populated with the SDOAPI toolkit and indexed using a fixed index.
I use a default full install of Oracle 8.1.6 on Linux RedHat 6.2.
What's wrong? Do I need to install anything else on the server?
Thanks for any advice.Hi Dan,
There are several errors in the SampleNewToSDO.java sample. The outer polygons should be anti-clockwise, the inner polygons should be clockwise. Now that this is fixed, polygons (with or without inner polygons) do pass the validation test, but multipolygons do not.
What's wrong with this multipolygon:
double outerOrdArray1[] = {310, 310, 320, 310, 320, 320, 310, 320, 310, 310};
LineString outerLineString1 = gF.createLineString(outerOrdArray1);
double innerOrdArray1[] = {311, 311, 311, 319, 319, 319, 319, 311, 311, 311};
LineString innerLineStrings1[] = new LineString[1];
innerLineStrings1[0] = gF.createLineString(innerOrdArray1);
collection[0] = gF.createPolygon((LineString)outerLineString1,
(LineString[])innerLineStrings1);
double outerOrdArray2[] = {410, 410, 420, 410, 420, 420, 410, 420, 410, 410};
LineString outerLineString2 = gF.createLineString(outerOrdArray2);
double innerOrdArray2[] = {411, 411, 411, 419, 419, 419, 419, 411, 411, 411};
LineString innerLineStrings2[] = new LineString[1];
innerLineStrings2[0] = gF.createLineString(innerOrdArray2);
collection[1] = gF.createPolygon((LineString)outerLineString2,
(LineString[])innerLineStrings2);
geom = gF.createGeometryCollection(collection);
Note that the sdoapi java library does not detect anything wrong with the geometry (isValid() returns true even when the order of vertices is wrong).
Heterogenous collections are OK. Only multipolgons are wrong. To check whether the multipolygon was correctly stored in the table, I exported the table to XML using the SampleSDOtoXML.java sample. It looks good:
<MultiPolygon>
<Polygon name="0" srsName="0">
<LineString name="0" srsName="0"> <CList>310.0,310.0 320.0,310.0 320.0,320.0 310.0,320.0 310.0,310.0</CList> </LineString>
<LineString name="0" srsName="0"> <CList>311.0,311.0 311.0,319.0 319.0,319.0 319.0,311.0 311.0,311.0</CList> </LineString>
</Polygon>
<Polygon name="0" srsName="0">
<LineString name="0" srsName="0"> <CList>410.0,410.0 420.0,410.0 420.0,420.0 410.0,420.0 410.0,410.0</CList> </LineString>
<LineString name="0" srsName="0"> <CList>411.0,411.0 411.0,419.0 419.0,419.0 419.0,411.0 411.0,411.0</CList> </LineString>
</Polygon>
</MultiPolygon>
So why does SDO_GEOM.VALIDATE_GEOMETRY return 13050? Is there a special vertex ordering rule for multipolygons?
Thanks,
Jean-Pierre
null -
Hi,
I need to access Oracle Spatial 3D elements from Java application. I looked at AdapterSDO class, but it does not support 3D. Could you give me some advice?
Thanks
OndrejHi,
SDOAPI and Locator (a large subset of spatial including all datatypes, indexes, and operators) are included with the database.
SDOAPI allows you to call the server side spatial operators - they aren't implemented in the API. -
Best practice for use of spatial operators
Hi All,
I'm trying to build a .NET toolkit to interact with Oracles spatial operators. The most common use of this toolkit will be to find results which are within a given geometry - for example select parish boundaries within a county.
Our boundary data is high detail, commonly containing upwards of 50'000 vertices for a county sized polygon.
I've currently been experimenting with queries such as:
select
from
uk_ward a,
uk_county b
where
UPPER(b.name) = 'DORSET COUNTY' and
sdo_relate(a.geoloc, b.geoloc, 'mask=coveredby+inside') = 'TRUE';
However the speed is unacceptable, especially as most of the implementations of the toolkit will be web based. The query above takes around a minute to return.
Any comments or thoughts on the best practice for use of Oracle spatial in this way will be warmly welcomed. I'm looking for a solution which is as quick and efficient as possible.Thanks again for the reply... the query currently takes just under 90 seconds to return. Here are the results from the execution plan ran in sql*:
Elapsed: 00:01:24.81
Execution Plan
Plan hash value: 598052089
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 156 | 46956 | 76 (0)| 00:00:01 |
| 1 | NESTED LOOPS | | 156 | 46956 | 76 (0)| 00:00:01 |
|* 2 | TABLE ACCESS FULL | UK_COUNTY | 2 | 262 | 5 (0)| 00:00:01 |
| 3 | TABLE ACCESS BY INDEX ROWID| UK_WARD | 75 | 12750 | 76 (0)| 00:00:01 |
|* 4 | DOMAIN INDEX | UK_WARD_SX | | | | |
Predicate Information (identified by operation id):
2 - filter(UPPER("B"."NAME")='DORSET COUNTY')
4 - access("MDSYS"."SDO_INT2_RELATE"("A"."GEOLOC","B"."GEOLOC",'mask=coveredby+i
nside')='TRUE')
Statistics
20431 recursive calls
60 db block gets
22432 consistent gets
1156 physical reads
0 redo size
2998369 bytes sent via SQL*Net to client
1158 bytes received via SQL*Net from client
17 SQL*Net roundtrips to/from client
452 sorts (memory)
0 sorts (disk)
125 rows processed
The wards table has 7545 rows, the county table has 207.
We are currently on release 10.2.0.3.
All i want to do with this is generate results which fall in a particular geometry. Most of my testing has been successful i just seem to run into issues when querying against a county sized polygon - i guess due to the amount of vertices.
Also looking through the forums now for tuning topics... -
Dear all,
I wanted to use SDO_GEOM.SDO_BUFFER function to generate a
buffer polygon around a geometry object while it is pretty slow
to perform for a large spatial database. I think it better
to use Spatial Operators for it takes advantage of spatial index.
But within operators, there are no availble function. Can anyone
tell me how to do it with Spatial Operators?
Thanks a lot,
FanFabio,
Error 13349 indicates that the polygons intersect with themselves.
You need to fix these errors. There are tools in MapInfo Professional 7.5 to check and automatically fix them. There are other tools commercially available which also fix geometry errors.
If you know MapInfo I would fix these errors there.
Ivan -
Parrallel tables with spatial operators
I have a point in polygon script that works, but in order to speed up the creation of the point table (~175M rows) I tried adding PARALLEL 4 and /*+ PARALLEL (t,4) */ Only the parallel part is new to the create point table sql.
I used CTAS to create a point table like this:
CREATE TABLE &OUT_POINT_SCHEMA..&OUT_POINT_TABLE NOLOGGING PARALLEL 4 TABLESPACE ORDERS_02
AS
SELECT /*+ PARALLEL (t,4) */
cast(lpad(to_char(LON/1000000, '999.000000'),11) || lpad(to_char(LAT/1000000, '99.000000'),10) as varchar2(21)) ULL,
MDSYS.SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(LON/1000000, LAT/1000000, NULL), NULL, NULL) GEOM
FROM
&IN_POINT_SCHEMA..&IN_POINT_TABLE
WHERE
LON is not null
GROUP BY
LON, LAT;The spatial index was created like this:
CREATE INDEX &OUT_POINT_TABLE._SIDX ON &OUT_POINT_TABLE (GEOM) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS('TABLESPACE=ORDERS_IDX WORK_TABLESPACE=ORDERS_03 LAYER_GTYPE=POINT');In theory, should the sql still work when I use, for example SDO_INSIDE? Or are there other things that I need to take into consideration? In other words, would the fact that the spatial point table was created with a parallel option impact spatial queries. When I try to monitor the process of the point in polygon sql with a check_session script (I am not a DBA) I see 4 rows with the same sql text which I assume is due to the parallel 4 parameter and I am also seeing wait_events like async descriptor resize and wait_time -1. Sorry to be so vague but I am trying to figure out if this query has a chance of finishing or if i broke it by adding the parallel option. Any guidance or suggestions would be appreciated.
Thanks,
DavidYes, spatial operators (say SDO_INSIDE) can work in parallel queries.
If you can show us your query explain plan, it will be easier to see
how SDO_INSIDE is executed. -
ROLLUP AND CUBE OPERATORS IN ORACLE 8I
제품 : PL/SQL
작성날짜 : 2000-06-29
========================================
ROLLUP AND CUBE OPERATORS IN ORACLE 8I
========================================
PURPOSE
ROLLUP 과 CUBE Operator에 대해 설명하고자 한다.
Explanation
ROLLUP operator는 SELECT문의 GROUP BY절에 사용된다.
SELECT절에 ROLLUP 을 사용함으로써 'regular rows'(보통의 select된 data)와
'super-aggregate rows'(총계)을 구할 수 있다. 기존에는 select ... union select
를 이용해 구사해야 했었던 것이다. 'super-aggregate rows'는 'sub-total'
(중간 Total, 즉 소계)을 포함한다.
CUBE operator는 Cross-tab에 대한 Summary를 추출하는데 사용된다. 모든 가능한
dimension에 대한 total을 나타낸다. 즉 ROLLUP에 의해 나타내어지는 item total값과
column total값을 나타낸다.
NULL값은 모든 값에 대한 super-aggregate 을 나타낸다. GROUPING() function은
모든 값에 대한 set을 나타내는 null값과 column의 null값과 구별하는데 쓰여진다.
GROUPING() function은 GROUP BY절에서 반드시 표현되어야 한다. GROUPING()은 모든
값의 set을 표현합에 있어서 null이면 1을 아니면 0을 return한다.
ROLLUP과 CUBE는 CREATE MATERIALIZED VIEW에서 사용되어 질수 있다.
Example
아래와 같이 테스트에 쓰여질 table과 data을 만든다.
create table test_roll
(YEAR NUMBER(4),
REGION CHAR(7),
DEPT CHAR(2),
PROFIT NUMBER );
insert into test_roll values (1995 ,'West' , 'A1' , 100);
insert into test_roll values (1995 ,'West' , 'A2' , 100);
insert into test_roll values (1996 ,'West' , 'A1' , 100);
insert into test_roll values (1996 ,'West' , 'A2' , 100);
insert into test_roll values (1995 ,'Central' ,'A1' , 100);
insert into test_roll values (1995 ,'East' , 'A1' , 100);
insert into test_roll values (1995 ,'East' , 'A2' , 100);
SQL> select * from test_roll;
YEAR REGION DE PROFIT
1995 West A1 100
1995 West A2 100
1996 West A1 100
1996 West A2 100
1995 Central A1 100
1995 East A1 100
1995 East A2 100
7 rows selected.
예제 1: ROLLUP
SQL> select year, region, sum(profit), count(*)
from test_roll
group by rollup(year, region);
YEAR REGION SUM(PROFIT) COUNT(*)
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
700 7
7 rows selected.
위의 내용을 tabular로 나타내어 보면 쉽게 알 수 있다.
Year Central(A1+A2) East(A1+A2) West(A1+A2)
1995 (100+NULL) (100+100) (100+100) 500
1996 (NULL+NULL) (NULL+NULL) (100+100) 200
700
예제 2: ROLLUP and GROUPING()
SQL> select year, region, sum(profit),
grouping(year) "Y", grouping(region) "R"
from test_roll
group by rollup (year, region);
YEAR REGION SUM(PROFIT) Y R
1995 Central 100 0 0
1995 East 200 0 0
1995 West 200 0 0
1995 500 0 1
1996 West 200 0 0
1996 200 0 1
700 1 1
7 rows selected.
참고) null값이 모든 값의 set에 대한 표현으로 나타내어지면 GROUPING function은
super-aggregate row에 대해 1을 return한다.
예제 3: CUBE
SQL> select year, region, sum(profit), count(*)
from test_roll
group by cube(year, region);
YEAR REGION SUM(PROFIT) COUNT(*)
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
Central 100 1
East 200 2
West 400 4
700 7
위의 내용을 tabular로 나타내어 보면 쉽게 알 수 있다.
Year Central(A1+A2) East(A1+A2) West(A1+A2)
1995 (100+NULL) (100+100) (100+100) 500
1996 (NULL+NULL) (NULL+NULL) (100+100) 200
100 200 400 700
예제 4: CUBE and GROUPING()
SQL> select year, region, sum(profit),
grouping(year) "Y", grouping(region) "R"
from test_roll
group by cube (year, region);
YEAR REGION SUM(PROFIT) Y R
1995 Central 100 0 0
1995 East 200 0 0
1995 West 200 0 0
1995 500 0 1
1996 West 200 0 0
1996 200 0 1
Central 100 1 0
East 200 1 0
West 400 1 0
700 1 1
10 rows selected.
===============================================
HOW TO USE ROLLUP AND CUBE OPERATORS IN PL/SQL
===============================================
Release 8.1.5 PL/SQL에서는 CUBE, ROLLUP 이 지원되지 않는다. 8i에서는 DBMS_SQL
package을 이용하여 dynamic SQL로 구현하는 방법이 workaround로 제시된다.
Ordacle8i에서는 PL/SQL block에 SQL절을 직접적으로 위치시키는 Native Dynamic SQL
(참고 bul#11721)을 지원한다.
Native Dynamic SQL을 사용하기 위해서는 COMPATIBLE 이 8.1.0 또는 그 보다 높아야
한다.
SVRMGR> show parameter compatible
NAME TYPE VALUE
compatible string 8.1.0
예제 1-1: ROLLUP -> 위의 예제 1과 비교한다.
SQL> create or replace procedure test_rollup as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
select year, region, sum(profit), count(*)
into my_year, my_region, my_sum, my_count
from test_roll
group by rollup(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TEST_ROLLUP:
LINE/COL ERROR
10/8 PL/SQL: SQL Statement ignored
13/18 PLS-00201: identifier 'ROLLUP' must be declared
SQL> create or replace procedure test_rollup as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
sql_stmt := 'select year, region, sum(profit), count(*) ' ||
'from test_roll ' ||
'group by rollup(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||
nvl(my_region,' ') ||
' ' || my_sum || ' ' || my_count);
end loop;
close tab_cv;
end;
SQL> set serveroutput on
SQL> exec test_rollup
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
700 7
PL/SQL procedure successfully completed.
예제 2-1: ROLLUP and GROUPING() -> 위의 예제 2와 비교한다.
SQL> create or replace procedure test_rollupg as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
select year, region, sum(profit),
grouping(year), grouping(region)
into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region
from test_roll
group by rollup(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TEST_ROLLUPG:
LINE/COL ERROR
12/4 PL/SQL: SQL Statement ignored
17/13 PLS-00201: identifier 'ROLLUP' must be declared
SQL> create or replace procedure test_rollupg as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
sql_stmt := 'select year, region, sum(profit), count(*), ' ||
'grouping(year), grouping(region) ' ||
'from test_roll ' ||
'group by rollup(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||my_region ||
' ' || my_sum || ' ' || my_count ||
' ' || my_g_year || ' ' || my_g_region);
end loop;
close tab_cv;
end;
Procedure created.
SQL> set serveroutput on
SQL> exec test_rollupg
1995 Central 100 1 0 0
1995 East 200 2 0 0
1995 West 200 2 0 0
1995 500 5 0 1
1996 West 200 2 0 0
1996 200 2 0 1
700 7 1 1
PL/SQL procedure successfully completed.
예제 3-1: CUBE -> 위의 예제 3과 비교한다.
SQL> create or replace procedure test_cube as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
select year, region, sum(profit), count(*)
into my_year, my_region, my_sum, my_count
from test_roll
group by cube(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TEST_CUBE:
LINE/COL ERROR
10/4 PL/SQL: SQL Statement ignored
13/13 PLS-00201: identifier 'CUBE' must be declared
SQL> create or replace procedure test_cube as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
sql_stmt := 'select year, region, sum(profit), count(*) ' ||
'from test_roll ' ||
'group by cube(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||
nvl(my_region,' ') ||
' ' || my_sum || ' ' || my_count);
end loop;
close tab_cv;
end;
Procedure created.
SQL> set serveroutput on
SQL> exec test_cube
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
Central 100 1
East 200 2
West 400 4
700 7
PL/SQL procedure successfully completed.
예제 4-1: CUBE and GROUPING() -> 위의 예제 4와 비교한다.
SQL> create or replace procedure test_cubeg as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
select year, region, sum(profit),
grouping(year), grouping(region)
into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region
from test_roll
group by cube(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TEST_CUBEG:
LINE/COL ERROR
12/4 PL/SQL: SQL Statement ignored
17/13 PLS-00201: identifier 'CUBE' must be declared
SQL> create or replace procedure test_cubeg as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
sql_stmt := 'select year, region, sum(profit), count(*), ' ||
'grouping(year), grouping(region) ' ||
'from test_roll ' ||
'group by cube(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||my_region ||
' ' || my_sum || ' ' || my_count ||
' ' || my_g_year || ' ' || my_g_region);
end loop;
close tab_cv;
end;
Procedure created.
SQL> set serveroutput on
SQL> exec test_cubeg
1995 Central 100 1 0 0
1995 East 200 2 0 0
1995 West 200 2 0 0
1995 500 5 0 1
1996 West 200 2 0 0
1996 200 2 0 1
Central 100 1 1 0
East 200 2 1 0
West 400 4 1 0
700 7 1 1
PL/SQL procedure successfully completed.
Reference Ducumment
Note:67988.1Hello,
As previously posted you should use export and import utilities.
To execute exp or imp statements you have just to open a command line interface, for instance,
a DOS box on Windows.
So you don't have to use SQL*Plus or TOAD.
About export/import you may care on the mode, to export a single or a list of Tables the Table mode
is enough.
Please, find here an example to begin:
http://wiki.oracle.com/page/Oracle+export+and+import+
Hope this help.
Best regards,
Jean-Valentin -
Difference between exists and in operators in oracle?
what is difference between exists and in operators in oracle?
what is faster and why?Malli wrote:
what is difference between exists and in operators in oracle?
what is faster and why?Is this a homework question?
Have you done any tests yourself to see which is faster? -
Difference between ANY and ALL operators
I am learning the basics of ANY and ALL operators.
Retrieving all employees in Dept 30 whose sal is greater than ANY employees in Dept 20
SQL> SELECT * FROM EMP;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> SELECT * FROM EMP WHERE DEPTNO=20;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL> SELECT * FROM EMP WHERE DEPTNO=30;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
6 rows selected.
SQL> SELECT * FROM EMP
2 WHERE SAL>ALL
3 (SELECT SAL FROM
4 EMP WHERE DEPTNO=20)
5 AND DEPTNO=30;
no rows selected
SQL> SELECT * FROM EMP
2 WHERE SAL>ANY
3 (SELECT SAL FROM
4 EMP WHERE DEPTNO=20)
5 AND DEPTNO=30;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
6 rows selected.From a book by Damir Bersinic:
An easy shorthand enables you to remember the distinction between ANY and
ALL. If a query condition is >ANY, each row in the result set is greater than the lowest value returned. When a query is >ALL, each row in the result set is greater than the highest value returned.
He meant ; If a query condition is >ANY, each row in the result set is greater than the lowest value returned by the subquery. Didn't he?
I couldn't find ANY and ALL operators in 10g SQL Reference? Are these operators being replaced by anything?
Message was edited by:
for_good_reasonLook this
>ANY------- means more than minimum
Ex: sql> select empno,ename,job from emp
where sal>ANY(select sal from emp job='CLERK');
w/o using >ANY the query will be
sql>select empno,ename,job from emp
where sal>(select min(sal) from emp job='CLERK');
>ALL-------- means more than the maximum
Ex: sql> select empno,ename, job sal from emp
where sal> ALL(select Avg(sal) from emp Group by deptno);
w/o using >ALL the query will be
sql> select empno,ename, job sal from emp
where sal> (select max(Avg(sal)) from emp Group by deptno);
sandeep -
Integer division and remainder operators help
I am trying to write a program to that inputs angle measurements for two angles (each measurement requires you to input 3 values) and then adds the two angles together and prints out the resulting angle. I am having problems with the math I can't use the "If" statement just integer division and remainder operators here is what I have.
import java.util.Scanner;
public class Angles
public static void main (String[] args)
Scanner scan = new Scanner(System.in);
// takes the first angles from the user
System.out.print("Enter the Degrees of the first angle < 360: ");
int Angle1 = scan.nextInt();
// takes the first minutes from the user
System.out.print("Enter the Minutes of the first angle < 60: ");
int Minutes1 = scan.nextInt();
// takes the first seconds from the user
System.out.print("Enter the Seconds of the first angle < 60: ");
int Seconds1 = scan.nextInt();
// takes the second angles from the user
System.out.print("Enter the Degrees of the second angle < 360: ");
int Angle2 = scan.nextInt();
// takes the second minutes from the user
System.out.print("Enter the Minutes of the second angle < 60: ");
int Minutes2 = scan.nextInt();
// takes the second seconds from the user
System.out.print("Enter the Seconds of the second angle < 60: ");
int Seconds2 = scan.nextInt();
// adds the seconds
int SecondsTotal = (Seconds1 + Seconds2);
SecondsTotal = SecondsTotal % 60;
// adds the minutes
int MinutesTotal = (Minutes1 + Minutes2 + (SecondsTotal % 60));
MinutesTotal = MinutesTotal % 60;
// adds the angles
int AngleTotal = (Angle1 + Angle2 + (MinutesTotal % 60));
AngleTotal = AngleTotal % 360;
// prints the angles, minutes, seconds to the user
System.out.print(Angle1 + "deg" + Minutes1 + "'" + Seconds1 + "'' + " + Angle2 + "deg" + Minutes2 + "'" + Seconds2 + "'' + " + " = " + AngleTotal + " " + MinutesTotal + " " + SecondsTotal);
}Ok I changed my code everything is working except for the roll over when angle reaches 360 it should go to 0.
import java.util.Scanner;
public class Angles
public static void main (String[] args)
Scanner scan = new Scanner(System.in);
// takes the first angles from the user
System.out.print("Enter the Degrees of the first angle < 360: ");
int Angle1 = scan.nextInt();
// takes the first minutes from the user
System.out.print("Enter the Minutes of the first angle < 60: ");
int Minutes1 = scan.nextInt();
// takes the first seconds from the user
System.out.print("Enter the Seconds of the first angle < 60: ");
int Seconds1 = scan.nextInt();
// takes the second angles from the user
System.out.print("Enter the Degrees of the second angle < 360: ");
int Angle2 = scan.nextInt();
// takes the second minutes from the user
System.out.print("Enter the Minutes of the second angle < 60: ");
int Minutes2 = scan.nextInt();
// takes the second seconds from the user
System.out.print("Enter the Seconds of the second angle < 60: ");
int Seconds2 = scan.nextInt();
// adds the seconds
int SecondsTotal = (Seconds1 + Seconds2);
// adds the minutes
int MinutesTotal = (Minutes1 + Minutes2);
// adds the angles
int AngleTotal = (Angle1 + Angle2);
// calculates the minutes
MinutesTotal = MinutesTotal + SecondsTotal / 60;
// calculates the angle
AngleTotal = AngleTotal + MinutesTotal / 60;
// caculates the final angle, minutes, seconds
MinutesTotal = MinutesTotal % 60;
SecondsTotal = SecondsTotal % 60;
AngleTotal = AngleTotal % 360;
// prints the angles, minutes, seconds to the user
System.out.print(Angle1 + "deg" + Minutes1 + "'" + Seconds1 + "'' + " + Angle2 + "deg" + Minutes2 +
"'" + Seconds2 + "'' + " + " = " + AngleTotal + " " + MinutesTotal + " " + SecondsTotal);
}[Edit]I got it all I had to do was add:
AngleTotal = AngleTotal % 360;Thanks for the help.
Edited by: KillerZ123 on Oct 7, 2009 7:04 PM -
Moving constructors and assignment operators
Do moving constructors and assignment operators have been implemented in the latest (july) beta or SolarisStudio 12.4?
Thanks in advance.Please help because it's still not working for me:
#include <cstdlib>
using namespace std;
class Thing {
public:
Thing();
Thing(Thing&&);
private:
Thing(const Thing&);
Thing f() {
Thing t;
return t; // OK: Thing(Thing&&) used (or elided) to return t
int main(int argc, char** argv) {
Thing t2 = f();
return 0;
Here's the build window output:
dmake: defaulting to parallel mode.
See the man page dmake(1) for more information on setting up the .dmakerc file.
"/opt/SolarisStudio12.4-beta_jul14-solaris-x86/bin/dmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/opt/SolarisStudio12.4-beta_jul14-solaris-x86/bin/dmake" -f nbproject/Makefile-Debug.mk dist/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/thing
mkdir -p build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86
CC -c -g -std=c++11 -o build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/main.o main.cpp
mkdir -p build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86
CC -c -g -std=c++11 -o build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/main.o main.cpp
"main.cpp", line 30: Error: Thing::Thing(const Thing&) is not accessible from f().
1 Error(s) detected.
*** Error code 2
dmake: Fatal error: Command failed for target `build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/main.o'
Current working directory /home/prime/NetBeansProjects/thing
*** Error code 1
dmake: Fatal error: Command failed for target `.build-conf'
Current working directory /home/prime/NetBeansProjects/thing
*** Error code 1
dmake: Fatal error: Command failed for target `.build-impl'
BUILD FAILED (exit value 1, total time: 4s)
Thanks in advance. -
OWB 11.2.0.1 dimension and cube operators + ODBC target database
Hi,
We are considering using OWB to populate a netezza data mart making use of the dimension and cube operators.
Could we use OWB for this/is it supported in this manner or do we need to use another ETL tool/workaround.
Understand OWB supports ODBC as target.
Any advice much appreciated.
ThanksHi
You can have ODBC targets but the cube/dim operators use MERGE loading type so its not a tested/supported case using the operators with Netezza. It has been optimized for Oracle.
Cheers
David -
Difference between and != operators
Hi All,
My question may be very basic to you all
Please let me know the difference between <> and != operators
Thanks in advanceuser609996 wrote:
Sorry to all,
the operator "<>" is not printed
I want the difference between "<>" and "!=" operators.And as you've already been told there is no difference between the <> and != operators. They mean the same thing, but are just different representations of it.
The only difference is that the Oracle forum can't display <> if it is just typed in normally. To show it we have to type < and > with a ";" after each. -
Revision: 12986
Revision: 12986
Author: [email protected]
Date: 2009-12-15 23:31:57 -0800 (Tue, 15 Dec 2009)
Log Message:
Integrate refactored composite view trait (merger of view and spatial traits). Implementation is untested, unit tests still to be refactored.
Modified Paths:
osmf/trunk/framework/MediaFramework/org/osmf/composition/CompositeMediaTraitFactory.as
Added Paths:
osmf/trunk/framework/MediaFramework/org/osmf/composition/CompositeViewTrait.as
osmf/trunk/framework/MediaFramework/org/osmf/composition/ParallelViewTrait.as
osmf/trunk/framework/MediaFramework/org/osmf/composition/SerialViewTrait.as -
I have generated Entities from tables using Jdeveloper 11 and Spatial columns of
type MDSYS.SDO_GEOMETRY were translated to Java String type.
I am looking for a strategy (custom mappings/annotations, etc) which will apply
an Oracle spatial function on the field and make the type conversion required
to insert into the Spatial column type.Yes, your field would be like,
@Convert(value="JGeometry")
@StructConverter(name="JGeometry", converter="JGEOMETRY")
protected JGeometry myJGeometry;
There is an in the EclipseLink SVN repository that you may wish to look at,
<SVN>foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/structconverter
James : http://www.eclipselink.org
Maybe you are looking for
-
Hi, I get the following error when processing a webdynpro application. Kindly guide on hoe to overcome this error. Error when processing your request What has happened? The URL xxxxxxxxxxxxxxxxx:8002/sap/bc/webdynpro/sap/dswp_ci_issue_management/ was
-
Does anyone know how to create uneven columns/rows in a table? I'm trying to design the attached table When i do they all come out even. here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/
-
Sent e-mails are not delivered
A couple of months ago the e-mails sent from my Nokia E63 stopped being delivered. I get no error or warning, but they do not reach their recipients. Before, I had no problems in receiving and sending mails. I updated the software of my Nokia to the
-
hi tehre was a short dump in qas sysatem and i forun that reason wa that the function group zfi creted as in tdv did not moved to QAS not i dont hvae any idea reagrding what changes done to that function group and i can see that function group in td
-
Encrypted disk image sometimes mounts without password
I have an encrypted sparsebundle disk image containing sensitive information. On occasion (maybe one time out of ten), I'm able to mount it without being prompted for the password. The password for the image is not stored in my keychain. Can anyone