Answering myself AGAIN.
Converting a table created with an old version (with "strange" GTYPEs)
is just a matter of using the
SDO_MIGRATE.TO_CURRENT('table_name')
function.
>From the PL/SQL prompt should be like this:
execute SDO_MIGRATE.TO_CURRENT('table_name')
from within SQL:
call SDO_MIGRATE.TO_CURRENT('table_name')
To use it from java you have to use something like this:
java.sql.Statement stmt = ...
stmt.executeUpdate("call SDO_MIGRATE.TO_CURRENT('table_name')");
To check a table for it's GTYPE format you can do this
(having a table_name with a Geometry column 'GEOM'):
select t.GEOM.Get_Dims() from table_name t where rownum<=1
if Get_Dims() returns 0, it's an old GTYPE (like 3), if it returns 2
or another value it a new GTYPE (like 2003).
This is not always the case, please read the Oracle docs or this article:
http://www.oreillynet.com/pub/a/network/2003/11/10/oracle_spatial.html?page=
1
Bye
Paolo Rizzi
> Answering myself.
>
> From Oracle documentation:
> --------------------------------------------------------------
> -------------
> Note:
> The 1-digit SDO_GTYPE values from before release 8.1.6 value are still
> supported. If a 1-digit value is used, however, Oracle
> Spatial determines
> the number of dimensions from the DIMINFO column of the
> metadata views,
> described in Section 2.6.3.
> Also, if 1-digit SDO_GTYPE values are converted to 4-digit values, any
> SDO_ETYPE values that end in 3 or 5 in the SDO_ELEM_INFO
> array (described in
> Section 2.2.4) must also be converted.
> --------------------------------------------------------------
> -------------
>
> and:
>
> --------------------------------------------------------------
> -------------
> Note:
> The use of 3 as an SDO_ETYPE value for polygon ring elements
> in a single
> geometry is discouraged. You should specify 3 only if you do
> not know if the
> simple polygon is exterior or interior, and you should then
> upgrade the
> table or layer to the current format using the SDO_MIGRATE.TO_CURRENT
> <sdo_objmigr.htm> procedure, described in Chapter 17
> <sdo_objmigr.htm>.
> You cannot mix 1-digit and 4-digit SDO_ETYPE values in a
> single geometry. If
> you use 4-digit SDO_ETYPE values, you must use 4-digit
> SDO_GTYPE values.
> --------------------------------------------------------------
> -------------
>
> So it seems I was trying to read a table created in an old format.
> However it would be good if the OracleDataStore reported it as such
> instead of failing with a division by zero error.
> But it would be really cosmetic, probably nobody will ever encounter
> this same problem.
>
> Bye
> Paolo Rizzi
>
>
> > -----Messaggio originale-----
> > Da: P.Rizzi Ag.Mobilità Ambiente [mailto:[EMAIL PROTECTED]
> > Inviato: martedì 4 ottobre 2005 19.55
> > A: '[email protected]'
> > Oggetto: [Geotools-devel] Errors using OracleDataStore
> >
> >
> > Hi all,
> > I'm trying to connect to an SDO Oracle DB using the OracleDataStore.
> > Debugging I can see that the GTYPE of a SDO geometry is equal to 3.
> > If I got it well it should instead be a number > 1000 because
> > it should contain the number of dimension and the geometry type.
> > So, when execution reaches line 2079 of
> > org.geotools.data.oracle.sdo.SDO.java
> > both D and L are equal to 0 so LEN is equal to 0,
> > so ordinates.length % LEN gives a division by zero error.
> > Is this a bug in the OracleDataStore or is a misconfiguration
> > of the Oracle database???
> > I'm not an Oracle expert I don't have direct access to the Oracle
> > instance (is owned and managed by a third party).
> > If it's a misconfiguration, what should I tell them to fix it???
> > Thanks a lot to anybody who may help me!!!
> >
> > Bye
> > Paolo Rizzi
> >
> >
> >
> >
> >
> > AVVERTENZE AI SENSI DEL D. LGS. 196/2003
> > Le informazioni contenute in questo messaggio di posta
> > elettronica e/o nel/i
> > file/s allegato/i, sono da considerarsi strettamente
> > riservate. Il loro
> > utilizzo è consentito esclusivamente al destinatario del
> > messaggio, per le
> > finalità indicate nel messaggio stesso. Qualora riceveste
> > questo messaggio
> > senza esserne il destinatario, Vi preghiamo cortesemente di
> > darcene notizia
> > via e-mail e di procedere alla distruzione del messaggio stesso,
> > cancellandolo dal Vostro sistema; costituisce comportamento
> > contrario ai
> > principi dettati dal D. Lgs. 196/2003 il trattenere il
> > messaggio stesso,
> > divulgarlo anche in parte, distribuirlo ad altri soggetti,
> > copiarlo, od
> > utilizzarlo per finalità diverse.
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by:
> > Power Architecture Resource Center: Free content, downloads,
> > discussions,
> > and more. http://solutions.newsforge.com/ibmarch.tmpl
> > _______________________________________________
> > Geotools-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/geotools-devel
> >
>
>
>
>
> AVVERTENZE AI SENSI DEL D. LGS. 196/2003
> Le informazioni contenute in questo messaggio di posta
> elettronica e/o nel/i
> file/s allegato/i, sono da considerarsi strettamente
> riservate. Il loro
> utilizzo è consentito esclusivamente al destinatario del
> messaggio, per le
> finalità indicate nel messaggio stesso. Qualora riceveste
> questo messaggio
> senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia
> via e-mail e di procedere alla distruzione del messaggio stesso,
> cancellandolo dal Vostro sistema; costituisce comportamento
> contrario ai
> principi dettati dal D. Lgs. 196/2003 il trattenere il
> messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti,
> copiarlo, od
> utilizzarlo per finalità diverse.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
AVVERTENZE AI SENSI DEL D. LGS. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i
file/s allegato/i, sono da considerarsi strettamente riservate. Il loro
utilizzo è consentito esclusivamente al destinatario del messaggio, per le
finalità indicate nel messaggio stesso. Qualora riceveste questo messaggio
senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia
via e-mail e di procedere alla distruzione del messaggio stesso,
cancellandolo dal Vostro sistema; costituisce comportamento contrario ai
principi dettati dal D. Lgs. 196/2003 il trattenere il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse.
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel