Oracle SQL SUBSTR() Character function – Medium cross post

I have been writing several articles about Oracle SQL over on my Medium account. With the Always Free Autonomous Database, having access to the Oracle Database is now easier than ever. In this Medium cross-post I share an article covering the SUBSTR() character function…


Any programmer, SQL professional, or data practitioner knows how much of a part text data is in any workflow. Oftentimes, text and string data only have specific portions that are of interest. Obtaining those key segments can typically be done using character functions.

Like other SQL implementations, Oracle SQL has a range of character functions. In the post, SUBSTR() Character Function – Oracle SQL Example, I cover simple queries for extracting key character values using SUBSTR(). The extracted text data is then used in additional processing queries.

If you aren’t familiar with the SUBSTR() function, learn more about it in this post. For the most part, each SQL dialect has an SUBSTR() function or something comparable so the concepts should easily apply to whatever function is available in the SQL implementation you are working with.

In what crafty ways have you had to use SUBSTR() (or a similar function) in your queries or analysis to extract the character values you needed? I’d love to know of them so please drop a line in the comments. πŸ™‚

Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.



To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the β€˜Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.


Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

MySQL Searched CASE Expression – with examples

During many decision-making phases in programming code (conditional logic), there are times execution depends on several different factors. Multiple conditional tests are powerful and constraining, oftentimes requiring more than one test to be passed in order for program flow to proceed. For MySQL (and standard SQL in general) the CASE expression is used for IF/THEN/ELSE conditional logic. The post, MySQL Simple CASE Expression – with examples, covered Simple CASE queries which are essentially equality tests. MySQL Simple CASE is but one variant of 2, with the other being a MySQL Searched CASE Expression.  A MySQL Searched CASE Expression can have multiple conditional tests in each WHEN clause. These conditional tests can be AND/OR comparisons, BETWEEN value range tests, subqueries, IN() operators, and more. Continue reading to see examples of the MySQL Searched CASE Expression…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

How to find the first and last day of a month with Oracle SQL Date Functions – Medium cross post

I recently wrote a blog post on porting over Oracle SQL to comparable MySQL queries with the purpose of counting specific weekdays occurrences in a given month. That post was inspired by this YouTube video (which I highly recommend). I published a post over on Medium about some of the Oracle Date functions available for these types of queries as I learn more Oracle SQL and wanted to share it with readers here who may be interested…

Digital calendar on a tablet on a table.

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!


In order to count pretty much anything in a month, you need to know how many days there are in the month. With the first and last day of the month values, you can subtract one from the other and find out the number of days.

Oracle SQL has many powerful DATE functions available for a wide range of calculations. In the post, How to find the first and last day of a month using Oracle SQL Date Functions , I use varying combinations of 4 different DATE functions to determine the first and last day of a given month. As an added bonus, I also explore both the previous and following months first and last day values relative to the current month.


Consider make a small donation on my behalf as I continue to provide valuable content here on my blog. Thank you!


I’m learning more and more about the Oracle Database and plan on sharing my journey here as I progress. Subscribe to my blog in order to be notified of upcoming SQL related blog posts.

Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.



To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the β€˜Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.


Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, is performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

MySQL Simple CASE Expression – with examples

Programming logic is foundational in any application or piece of software. Without it, software wouldn’t really do much of anything. Everything happens off of choice. In the end, some truthy or falsy value is what makes stuff work. For IF/THEN/ELSE logic in standard SQL, there is the CASE expression. There are 2 variations of the CASE Expression: Simple and Searched. In this post, I cover the Simple MySQL CASE expression with example queries…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

MySQL Column Aliases using the AS keyword

Be it running reports or displaying data in some other visualization, SQL SELECT column expressions should be meaningful and understandable. To provide those valuable query results, SQL Developers, use a multitude of available functions, adjacent columns, or other means not readily apparent to end-users. All that being said, the column names often suffer the most as far as readability is concerned, taking on long function call names or other combined expressions. But, as luck would be on our side, there is an easy fix and that is aliasing columns using the AS keyword. Although AS is optional – in this particular context – I err on the side of readability and use it when aliasing SELECT column expressions.

[Keep reading for more SQL database and PHP/Python-centric content >>>]