This blog is part of a series about aspects and features of Oracle 26 and Autonomous Transaction Processing Database.
TL;DR
This is an opinion piece about the impact of AI on developers and administrators. I'll tell you my opinion here at the start:
AI won't be replacing us, at least not yet, but we may be replaced by someone who is more productive because they are using AI! I certainly advocate using it, but do so thoughtfully. Consider whether the answers are sensible, and then test them carefully.
Introduction
To learn more about Oracle 26ai Autonomous Database, I returned to a project I created in 2021 to explore spatial data. I had exported my activity data from Strava as flat files and then imported them into an Oracle database.
Now, I have migrated that project to an Autonomous database on OCI and integrated it directly with Strava through their API. Notifications of new activities are received via a REST service, some processing is done in the Oracle database, and results are written back to the Strava activity description. All quite simple, but it made me use techniques and technologies that I have never used before.
ChatGPT
When I created the original project in 2021, I had the Oracle documentation and Google. I had to design and write every bit of code myself. It all took time.
Now, I have been able to use ChatGPT (other AI Chatbots are available, but this is where I started), and the effect has been remarkable. I have been pointed at features and techniques that are new to me, and often I have been given a concrete example to start work on, and therefore I have learned about them.
I asked ChatGPT questions in plain language about the details of both Oracle 26 and the Strava API, and it gave me sensible answers in plain language that were generally sensible. In some cases, it designed complete processing flows; sometimes it just illustrated the answer with code examples. I could ask follow-up questions, and it would answer them in the context of the earlier question, refining its response. It became a genuine conversation. Though it is not going to pass the Turing Test!
ChatGPT's answers were mostly accurate, though some of its generated code was not always completely correct. On some subjects, such as character set, we went round in circles. Sometimes, I would point out mistakes, and it would say 'Yes, you are right!' or 'Well spotted!'. I am not convinced it learnt anything from that. Over time, I learnt that I needed to ask quite precise questions, otherwise it would go off in other directions. Nevertheless, I found I got very quickly from a first draft of code to debugging almost working code. I have no doubt that using ChatGPT increased my productivity. If I had to quantify the effect, I would estimate that it improved my productivity by a factor of about 3.
These are some of my early questions to ChatGPT:
- "How can Strava notify my Oracle database, using only PL/SQL, that an activity has been added, deleted or updated?"
- The result included a complete design for creating a Strava webhook to send an HTTP message to a REST service, including a database data model design and how to process it by calling the Strava API to extract the activity data
- "How would I load GeoJSON … into an Oracle spatial data object geometry in an Oracle autonomous database using just PL/SQL"
- I got a complete PL/SQL procedure to extract the GeoJSON from the data.gov.ie website, and then how to read the GeoJSON into an Oracle spatial geometry.
- I was able to ask follow-up questions. When one particular public data set produced errors from sdo_util.from_geojson, after a few other suggestions, ChatGPT provided a complete alternative PL/SQL procedure to create a spatial geometry from just the array of coordinates. It is slower, but it works reliably. I use it as an alternative when I get an error from the Oracle function.
There were some notable examples of code that ChatGPT produced correctly the first time, and much faster than I could have. In particular, extracting all the data in a Strava activity (see strava_http.get_activity_stream) as both an Oracle spatial geometry and a GPX file, including heart monitor, cadence and power meter data if also present (that must conform to the Topographix and Garmin XML schemas). My code is on GitHub, so you can judge the result for yourself!
Nullius in Verba
This motto (it can be translated as "Take Nobody's Word for It!") is at the heart of the scientific principle. It can usefully be applied to many things, and certainly to ChatGPT.
ChatGPT is a hugely powerful tool that seems to be capable of answering any reasonable query. I would encourage anyone to use it to help develop code faster. However, every response should be treated with healthy scepticism and be tested carefully. Whether code compiles and executes is a straightforward question with an essentially binary answer. Whether that code then does what it is supposed to do requires thorough testing, but then so does human-written code!
Nonetheless, I am hugely impressed by ChatGPT. I have no doubt that I got further and got there much faster than I ever would otherwise!