Skip to main content

Using Always Free Autonomous Database to help me heal our planet

So I signed up for my Always Free Autonomous Database (AFAD) and a boatload of other cloud services. OK, what shall I do with them? some of you may know, I've gotten very concerned about climate change and human-caused extinctions. I started a project with Vincent Morneau called fabe - for all a beautiful earth - to help all of us reduce consumption, rescue species and reconnect to nature. Check it out at Yes, it is an APEX application and it is already running on an Oracle Database cloud service, so....what else?

You know the saying "think globally, act locally"? Well, if fabe is global, then my work on invasive species is local, very local.

When I lived in Chicago, I went out to the nearest "wild" spaces I could find and cut back buckthorn trees that didn't belong in Chicago, out-competed native trees for sunlight, and killed off those native species. I rescued trees - and the literally millions of living creatures that call those trees home.

It was just about the most fulfilling and meaningful action I've ever taken in my life.

Now that I live in North Carolina (Chapel Hill area), I have continued that tradition, but now focusing on wisteria, kudzu, English ivy, stilt grass and more. As I drive around, I identify areas that are neglected, areas overrun with invasives and whenever possible I head on over and start cutting back those plants which are wonderful - back where they evolved to grow. Sometimes I do this with permission, sometimes, well, it is an act of of non-violent (to humans, anyway) civil disobedience.

But just think: in two hours of cutting, I can rescue trees that are 50, 75 100 ft tall and being killed by wisteria. Trees that have been on this planet for decades and now will be here for decades more. All with the smallest sacrifice on my part. Joyful moments for me, for sure.

To give you a sense of the impact of my work, here is a section I just started to work on. The areas inside red show the dense grown of wisteria covering and weighing down the trees:
Once I cut the vines at the base (and some of them are 6 inches in diameter!) and they die and dry out, the "bones" of the tree are revealed:
You can see the dead wisteria vines on the left. On the right, all that sky that you can see through the trees was completely hidden by a dense, killing growth of wisteria just a few weeks ago!

Besides my individual work, I am also started up a volunteer group: Carrboro Tree Rescuers.

As I said, I have been identifying many different locations that need my loving attention (love expressed with saw, lopping shear, and pruning shear). So I've decided to build an app on my AFAD to help keep track of those locations.

I'll document the steps I took in building this application, so you can see how easy it is to leverage amazing products like Oracle Application Express, Oracle REST Data Services, SQL, PL/SQL and Oracle Database to help heal our planet and maybe even save some species from extinction.

I plan as much as possible to rely on the default features and behavior of APEX, to maximize my productivity on this side project and also showcase all that APEX does for you these days.

[And I must say that with APEX 19.2 Early Adaptor just out, I wish I could use that!]

I got started today by creating schemas and workspaces for my use in APEX. Then I decided to take advantage of the remarkable QuickSQL (brainchild of my boss, Mike Hichwa, who seriously you should be following) to ahem quickly generate the SQL I need to create the tables that will get me started.

Here's the QuickSQL script I threw together. I want to keep track of the various invasive species that plague this area, the various worksites, the species present at those sites, and a history of my activity at the sites.
worksites /auditcols
  name vc /nn /unique
  worksite_status vc /check NEW,CLEARED,INPROGRESS /nn
  address vc
  city vc
  state vc
  country vc
  postal_code vc
  description vc
  milemarker num
  gps_longitude num
  gps_latitude num

invasive_species /auditcols
   popular_name vc /nn /unique
   species_name vc /nn /unique
   impact_description vc /nn
   location_list vc
worksite_species /auditcols
   species_id /fk invasive_species /nn
   worksite_id /fk worksites /nn
rescue_teams /auditcols
   name vc /nn /unique
   description vc
   city vc
   state vc
   country vc
   postal_code vc

worksite_teams /auditcols
   rescue_team_id /fk rescue_teams /nn
   worksite_id /fk worksites /nn
   worksite_id /fk worksites /nn
   rescue_team_id /fk rescue_teams
   activity_date d /nn
   description  vc /nn

rescue_files /auditcols
   worksite_species_id /fk worksite_species
   invasive_species_id /fk invasive_species
   worksite_hsitory_id /fk worksite_history
   file_type vc30 /check Activity,After
   mime_type vc75 /nn
   description vc255
   blob_content blob
I am sure this will change a bit before I start building the application, but it's a solid start.

Oh and did I mention? If anyone would like to help me with this  (or other similar projects), let me know!


Popular posts from this blog

Get rid of mutating table trigger errors with the compound trigger

When something mutates, it is changing. Something that is changing is hard to analyze and to quantify. A mutating table error (ORA-04091) occurs when a row-level trigger tries to examine or change a table that is already undergoing change (via an INSERT, UPDATE, or DELETE statement). In particular, this error occurs when a row-level trigger attempts to read or write the table from which the trigger was fired. Fortunately, the same restriction does not apply in statement-level triggers.

In this post, I demonstrate the kind of scenario that will result in an ORA-04091 errors. I then show the "traditional" solution, using a collection defined in a package. Then I demonstrate how to use the compound trigger, added in Oracle Database 11g Release1,  to solve the problem much more simply.

All the code shown in this example may be found in this LiveSQL script.
How to Get a Mutating Table ErrorI need to implement this rule on my employees table:
Your new salary cannot be more than 25x th…

How to Pick the Limit for BULK COLLECT

This question rolled into my In Box today:
In the case of using the LIMIT clause of BULK COLLECT, how do we decide what value to use for the limit? First I give the quick answer, then I provide support for that answer

Quick Answer
Start with 100. That's the default (and only) setting for cursor FOR loop optimizations. It offers a sweet spot of improved performance over row-by-row and not-too-much PGA memory consumption.Test to see if that's fast enough (likely will be for many cases).If not, try higher values until you reach the performance level you need - and you are not consuming too much PGA memory. Don't hard-code the limit value: make it a parameter to your subprogram or a constant in a package specification.Don't put anything in the collection you don't need. [from Giulio Dottorini]Remember: each session that runs this code will use that amount of memory.Background

When you use BULK COLLECT, you retrieve more than row with each fetch, reducing context switchi…

Quick Guide to User-Defined Types in Oracle PL/SQL

A Twitter follower recently asked for more information on user-defined types in the PL/SQL language, and I figured the best way to answer is to offer up this blog post.

PL/SQL is a strongly-typed language. Before you can work with a variable or constant, it must be declared with a type (yes, PL/SQL also supports lots of implicit conversions from one type to another, but still, everything must be declared with a type).

PL/SQL offers a wide array of pre-defined data types, both in the language natively (such as VARCHAR2, PLS_INTEGER, BOOLEAN, etc.) and in a variety of supplied packages (e.g., the NUMBER_TABLE collection type in the DBMS_SQL package).

Data types in PL/SQL can be scalars, such as strings and numbers, or composite (consisting of one or more scalars), such as record types, collection types and object types.

You can't really declare your own "user-defined" scalars, though you can define subtypes from those scalars, which can be very helpful from the perspective…