Hello learned ones-

I'm having a problem using DBI with the ORACLE spatial data type SDO_GEOMETRY.

Specifically, I am attempting to use bind_param with this data type. When I try this the error returned states that Oracle is expecting SDO_GEOMETRY, but is getting CHAR...

here is what I've tried:
1)Binding naively
-----
my $insq = "insert into SHAPES (some_rectangles) values (?)";
$sth = $DBH->prepare($insq);

my $rectangle = "SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY($targetstart,$chrm_map->{$target_chrm_syn}->{'depth'}, $targetend,$chrm_map->{$target_chrm_syn}->{'depth'}))";

$sth->bind_param(1, $rectangle);

##This will give the "expecting GEOMETRY, got CHAR" type error from oracle.

I've also tried adding:
----
use DBD::Oracle qw(:ora_types);

#and then
----
$sth->bind_param(1,$rectangle,{ora_type => ORA_CLOB}) #i also tried ORA_BLOB...

no luck, same error.
If I try to specify SDO_GEOMETRY as the ora_type, DBI throws an error that this type is not supported.

I can prepare each insert and select from an insert string, and skip the binding, but that is not going to work long term as i have too many queries to make...

Thanks in Advance for your help & insight!

john major

In reply to Oracle SDO_GEOMETRY and DBI binding problem by iamh2o

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.