Re: insert a well known binary object (WKB)
Anthony Tuininga <[email protected]> Fri, 3 Jul 2020 09:18:59 -0600
| Newsgroups | gmane.comp.python.db.cx-oracle |
|---|---|
| Message-ID | <CAE1XR-4rq=wkZNB08Lq4VvxYyq-Kg=3tuJUY_9GarHNYuCn5XQ@mail.gmail.com> |
--===============9171667499770286515==
Content-Type: multipart/alternative; boundary="000000000000ff94b305a98b0bdb"
--000000000000ff94b305a98b0bdb
Content-Type: text/plain; charset="UTF-8"
At a guess: you're trying to build an object which makes use of PL/SQL.
PL/SQL doesn't allow strings longer than 32,767 bytes to be used. So you
have two possibilities:
(1) convert :wkb into a temporary CLOB and bind that instead of the string
(2) make the entire statement an anonymous PL/SQL block which will cause
cx_Oracle to turn :wkb into a temporary CLOB internally
If neither of those suggestions work for you, let me suggest that you post
an issue here: https://github.com/oracle/python-cx_Oracle/issues with a
standalone test case that demonstrates the issue. I can then look into it
in more detail.
Anthony
On Tue, Jun 30, 2020 at 7:04 PM John Cartwright - NOAA Federal via
cx-oracle-users <cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> wrote:
> Hello All,
>
> I have a WKB that I'm trying to insert into a SDO_GEOMETRY column.
> Something like this:
>
> cursor.execute("""
> insert into SURVEY(OBJECTID,SURVEY,SHAPE)
> values (:objectid, :survey, SDO_UTIL.FROM_WKBGEOMETRY(:wkb))""",
> objectid=objectid, survey='H13195', wkb=wkb
> )
>
> However, I keep getting the error:
>
> cx_Oracle.DatabaseError: ORA-01461: can bind a LONG value only for insert
> into a LONG column
>
>
> Can someone please point me in the right direction?
>
> Thanks!
>
> --john
>
> _______________________________________________
> cx-oracle-users mailing list
> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
--000000000000ff94b305a98b0bdb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">At a guess: you're trying to build an object which mak=
es use of PL/SQL. PL/SQL doesn't allow strings longer than 32,767 bytes=
to be used. So you have two possibilities:<div><br></div><div>(1) convert =
:wkb into a temporary CLOB and bind that instead of the string</div><div>(2=
) make the entire statement an anonymous PL/SQL block which will cause cx_O=
racle to turn :wkb into a temporary CLOB internally</div><div><br></div><di=
v>If neither of those suggestions=C2=A0work for you, let me suggest that yo=
u post an issue here:=C2=A0<a href=3D"https://github.com/oracle/python-cx_O=
racle/issues">https://github.com/oracle/python-cx_Oracle/issues</a> with a =
standalone test case that demonstrates the issue. I can then look into it i=
n more detail.</div><div><br></div><div>Anthony</div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 30, 2020=
at 7:04 PM John Cartwright - NOAA Federal via cx-oracle-users <<a href=
=3D"mailto:cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org">[email protected]=
rceforge.net</a>> wrote:<br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin=
g-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-siz=
e:small">Hello All,</div><div class=3D"gmail_default" style=3D"font-size:sm=
all"><br></div><div class=3D"gmail_default" style=3D"font-size:small">I hav=
e a WKB that I'm trying to insert into a SDO_GEOMETRY column.=C2=A0 Som=
ething like this:</div><div class=3D"gmail_default" style=3D"font-size:smal=
l"><br></div><div class=3D"gmail_default" style=3D"font-size:small">cursor.=
execute("""<br>=C2=A0 =C2=A0 insert into SURVEY(OBJECTID,SUR=
VEY,SHAPE)<br>=C2=A0 =C2=A0 values (:objectid, :survey, SDO_UTIL.FROM_WKBGE=
OMETRY(:wkb))""",<br>=C2=A0 =C2=A0 objectid=3Dobjectid, surv=
ey=3D'H13195', wkb=3Dwkb</div><div class=3D"gmail_default" style=3D=
"font-size:small">)<br></div><div class=3D"gmail_default" style=3D"font-siz=
e:small"><br></div><div class=3D"gmail_default" style=3D"font-size:small">H=
owever, I keep getting the error:</div><div class=3D"gmail_default" style=
=3D"font-size:small"><br></div><div class=3D"gmail_default" style=3D"font-s=
ize:small">cx_Oracle.DatabaseError: ORA-01461: can bind a LONG value only f=
or insert into a LONG column<br></div><div class=3D"gmail_default" style=3D=
"font-size:small"><br></div><div class=3D"gmail_default" style=3D"font-size=
:small"><br></div><div class=3D"gmail_default" style=3D"font-size:small">Ca=
n someone please point me in the right direction?</div><div class=3D"gmail_=
default" style=3D"font-size:small"><br></div><div class=3D"gmail_default" s=
tyle=3D"font-size:small">Thanks!</div><div class=3D"gmail_default" style=3D=
"font-size:small"><br></div><div class=3D"gmail_default" style=3D"font-size=
:small">--john</div><div class=3D"gmail_default" style=3D"font-size:small">=
<br></div></div>
_______________________________________________<br>
cx-oracle-users mailing list<br>
<a href=3D"mailto:cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" target=3D"_blank">=
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/cx-oracle-users" re=
l=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/list=
info/cx-oracle-users</a><br>
</blockquote></div>
--000000000000ff94b305a98b0bdb--
--===============9171667499770286515==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============9171667499770286515==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
cx-oracle-users mailing list
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
--===============9171667499770286515==--