SQL Server spatial to Oracle spatial

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
JonMorgan
Premium Member
Premium Member
Posts: 28
Joined: Tue Mar 24, 2009 7:34 pm
Location: Brisbane, Australia

SQL Server spatial to Oracle spatial

Post by JonMorgan »

Hi Folks,

I'm attempting to convert Microsoft SQL Server spatial data types Geometry and Geography to Oracle's SDO_GEOMETRY data type.

I want to use the well known binary (WKB) / well known text (WKT) methods to convert from SQL Server and to Oracle spatial types.

Has anyone written well known binary data to an Oracle SDO_GEOMETRY type using SDO_UTIL.FROM_WKBGEOMETRY or SDO_UTIL.FROM_WKTGEOMETRY ?
What Datastage data types must I use to contain the WKB or WKT data?

I'm interested to know if anyone has successfully performed this?
JonMorgan
Premium Member
Premium Member
Posts: 28
Joined: Tue Mar 24, 2009 7:34 pm
Location: Brisbane, Australia

Re: SQL Server spatial to Oracle spatial

Post by JonMorgan »

I'm using an Oracle Connector stage to input Well Known Text (spatial) into an Oracle column of data type SDO_GEOMETRY.

I'm using the following insert statement:-

INSERT INTO SPATIALTABLE (ROAD_CLOSURE_POLYLINE_ID,
ROAD_CLOSURE_EVENT_ID,
POLYLINE,
POLYLINETEXT,
LAST_UPDATE_DATE)
VALUES (:ROAD_CLOSURE_POLYLINE_ID,
:ROAD_CLOSURE_EVENT_ID,
SDO_UTIL.FROM_WKTGEOMETRY(:POLYLINE),
:POLYLINETEXT,
:LAST_UPDATE_DATE).

The :POLYLINE is of DataStage type LongVarChar and contains WKT (well known text - linestrings).
The POLYLINE column in the SPATIALTABLE table is of type SDO_GEOMETRY.
The SDO_UTIL.FROM_WKTGEOMETRY function will read the POLYLINE data and convert it to a SDO_GEOMETRY.

The error i'm receiving is :-
Oracle_Connector_4,1: The OCI function OCIStmtExecute returned status -1. Error code: 1,461, Error message: ORA-01461: can bind a LONG value only for insert into a LONG column. (CC_OraStatement::executeInsert, file CC_OraStatement.cpp, line 1,684)

The Oracle client on the DS engine is 11gR2.
JonMorgan
Premium Member
Premium Member
Posts: 28
Joined: Tue Mar 24, 2009 7:34 pm
Location: Brisbane, Australia

Re: SQL Server spatial to Oracle spatial

Post by JonMorgan »

Just an update to my progress with this.

The Oracle spatial function SDO_UTIL.FROM_WKTGEOMETRY() can accept either varchar2 or CLOB data types.
I'm trying to use this function within an INSERT statement to populate the underlying SDO_GEOMETRY data type.

The function accepts <= 4000 characters from a CLOB.
It fails when > 4000 characters from a CLOB with the error :-


Oracle_Connector_4,1: The OCI function OCIStmtExecute returned status -1. Error code: 1,461, Error message: ORA-01461: can bind a LONG value only for insert into a LONG column. (CC_OraStatement::executeInsert, file CC_OraStatement.cpp, line 1,684)
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That looks suspiciously like the limit on VARCHAR2. Have you tried LONG VARCHAR2 as the data type?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JonMorgan
Premium Member
Premium Member
Posts: 28
Joined: Tue Mar 24, 2009 7:34 pm
Location: Brisbane, Australia

Post by JonMorgan »

I haven't tried long VARCHAR2 in the oracle table.

LONGVARCHAR-> CLOB (column) works with 4000+ chars.
JonMorgan
Premium Member
Premium Member
Posts: 28
Joined: Tue Mar 24, 2009 7:34 pm
Location: Brisbane, Australia

Post by JonMorgan »

Folks,

If anyone is interested, It has been found out that this is a limitation on DataStage.
IBM has advised me they will be looking at fixing this problem as an enhancement.

I'll keep you posted.

Jon
Post Reply