<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I INSERT INTO using results of a query? in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852678#M5315</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone.&amp;nbsp; I modified the query to this and good news - I dont receive a syntax error, just ORA-01031: insufficient privileges!&amp;nbsp; I suspect I dont have those for the geometry_st functions?&amp;nbsp; I am asking my IT about that.&amp;nbsp; BTW, I also tried it without the where clause as suggested, and I get the same error.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;INSERT INTO planningcadastre.demolition_notifications_gis&lt;BR /&gt;(OBJECTID, NOTIFICATION_ID, SHAPE)&lt;BR /&gt;select 1,2,sde.st_buffer(l.shape, 500) from location.address_point l where l.place_id = 802689;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Dec 2019 18:25:10 GMT</pubDate>
    <dc:creator>PaulFrank</dc:creator>
    <dc:date>2019-12-02T18:25:10Z</dc:date>
    <item>
      <title>How can I INSERT INTO using results of a query?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852675#M5312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to use an st_geometry function that is part of a SELECT statement to INSERT records into an Oracle SDE geodatabase (12g)?&amp;nbsp; I have constructed the following statement from which I receive Error ORA-00917; missing comma.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;INSERT INTO gis_table&lt;BR /&gt;(objectid, gis_table_id, shape)&lt;BR /&gt;VALUES (1, 2, (sde.st_geometry ('polygon((SELECT sde.st_astext(sde.st_buffer(l.shape, 500)) as shapebuffer FROM location.address_point l where l.place_id = 802689))', 2277))&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;The part of the query&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;SELECT sde.st_astext(sde.st_buffer(l.shape, 500)) as shapebuffer FROM location.address_point l where l.place_id = 802689&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;returns and Oracle type CLOB, which turns out to actually be POLYGON (( 3112886.18568189 10066866.95637797, 3112885.11514598 10066899.65808421, etc etc)), So I see I may be duplicating the keyword POLYGON, but I have changed that and I get other errors.&amp;nbsp; Or I freely admit I may be using the wrong functions or process to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance of the great answers I am sure to get...&lt;/P&gt;&lt;P&gt;Paul Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 19:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852675#M5312</guid>
      <dc:creator>PaulFrank</dc:creator>
      <dc:date>2019-11-26T19:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I INSERT INTO using results of a query?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852676#M5313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried to simplify this down to just the ST functions, but this might help get us in the right direction. Here is how I did an INSERT INTO SELECT with an ST_BUFFER:&lt;/P&gt;&lt;PRE class="line-numbers language-sql"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;insert&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;into&lt;/SPAN&gt; gis_table &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;shape&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;select&lt;/SPAN&gt; sde&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;st_buffer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;l&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shape&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0.05&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; location l&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I add in attribute records it changes slightly:&lt;/P&gt;&lt;PRE class="line-numbers language-sql"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;insert&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;into&lt;/SPAN&gt; gis_table &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;objectid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; gis_table_id&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;shape&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;select&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;sde&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;st_buffer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;l&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shape&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0.005&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; location l&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the original script, there are some duplication of the ST calls with the ST_GEOMETRY + ST_ASTEXT function. There are 2 reasons I would avoid the additional call for WKT.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;ST_BUFFER returns an ST_GEOMETRY object and can be reused in your insert statement without rework&lt;/LI&gt;&lt;LI&gt;The WKT is returned as a Character Large Object (CLOB), which can be unwieldy and quite large to store in memory - this becomes more important as you scale your SQL requests.&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 21:21:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852676#M5313</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2019-11-26T21:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can I INSERT INTO using results of a query?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852677#M5314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried a select into statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;INTO newtable &lt;/P&gt;&lt;P&gt;FROM oldtable&lt;/P&gt;&lt;P&gt;WHERE condition;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Craig Swadner (GIS Coordinator)&lt;/P&gt;&lt;P&gt;City of Cape Coral&lt;/P&gt;&lt;P&gt;1015 Cultural Park Blvd.&lt;/P&gt;&lt;P&gt;Cape Coral, Fl 33990&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you know the best way to report issues to ITS is to use the Service Desk system?  This will ensure someone in ITS gets your request and allows us to track the progress.  Please enter all your issues and/or questions by clicking https://breeze.cape.capecoral.net&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:40:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852677#M5314</guid>
      <dc:creator>CraigSwadner</dc:creator>
      <dc:date>2019-11-26T22:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I INSERT INTO using results of a query?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852678#M5315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone.&amp;nbsp; I modified the query to this and good news - I dont receive a syntax error, just ORA-01031: insufficient privileges!&amp;nbsp; I suspect I dont have those for the geometry_st functions?&amp;nbsp; I am asking my IT about that.&amp;nbsp; BTW, I also tried it without the where clause as suggested, and I get the same error.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;INSERT INTO planningcadastre.demolition_notifications_gis&lt;BR /&gt;(OBJECTID, NOTIFICATION_ID, SHAPE)&lt;BR /&gt;select 1,2,sde.st_buffer(l.shape, 500) from location.address_point l where l.place_id = 802689;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2019 18:25:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852678#M5315</guid>
      <dc:creator>PaulFrank</dc:creator>
      <dc:date>2019-12-02T18:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I INSERT INTO using results of a query?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852679#M5316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to hear we made some progress! On the insufficient permissions it might be the tables from the LOCATION or PLANNINGCADASTRE schema. Can you verify that you can do a SELECT one each table without the ST call? Can you verify you can do an INSERT on DEMOLITION_NOTIFICATIONS_GIS without the ST call?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2019 20:23:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852679#M5316</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2019-12-02T20:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I INSERT INTO using results of a query?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852680#M5317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I am still seeing the error when I try to insert a buffer manually, so that would seem to be the issue, although I tried to add a fairly large polygon that I shortened for viewing purposes:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;INSERT INTO planningcadastre.demolition_notifications_gis&lt;BR /&gt;(OBJECTID, NOTIFICATION_ID, SHAPE)&lt;BR /&gt;VALUES (4, 5, sde.st_geometry('polygon ((3122386.18571073 10066866.95637797, 3122364.77499239 10067520.98755021, 3122300.63437265 10068172.21820313, 3122194.03845723 10068817.85962838, 3122045.44393815 10069455.14673963, 3121855.48696898 10070081.35119589, 3121624.98119640 10070693.79058780, ...3122300.63437265 10065561.69455279, 3122364.77499239 10066212.92520571, 3122386.18571073 10066866.95637797)',2277))&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2019 22:17:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-can-i-insert-into-using-results-of-a-query/m-p/852680#M5317</guid>
      <dc:creator>PaulFrank</dc:creator>
      <dc:date>2019-12-02T22:17:16Z</dc:date>
    </item>
  </channel>
</rss>

