Preamble
The Oracle/PLSQL SUBSTR function allows extracting a substring from a string.
Syntax of the Oracle/PLSQL SUBSTR function
SUBSTR( string_id, start_position_id, [ length_id ] )
Parameters and function arguments
- string_id – source line.
- start_position_id – position to start extraction of substring. The first position in the string is always equal to 1.
- length_id – is not mandatory. Defines the number of characters to be extracted. If this parameter is not specified, the SUBSTR function will return the entire string.
Note:
- If start_position is 0, the SUBSTR function will accept start_position as 1 (i.e.: first position in a string).
- If start_position is a positive number, the SUBSTR function starts reading from the beginning of the line.
- If start_position is a negative number, the SUBSTR function starts from the end of the line and counts in the opposite direction.
- If length is a negative number, the SUBSTR function returns NULL.
The SUBSTR function can be used in the following Oracle/PLSQL versions
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
|
Let’s consider some examples of SUBSTR function and learn how to use SUBSTR function in Oracle/PLSQL.
SELECT SUBSTR('This is a test', 6, 2) FROM DUAL;
--Result: is
SELECT SUBSTR('This is a test', 6) FROM DUAL;
--Result: is a test
SELECT SUBSTR ("HowZertIzTabakerky", 1, 3) FROM DUAL;
--Result: How
SELECT SUBSTR ("HowZertIzTabakerky", -15, 4) FROM DUAL;
--Result: Zert
SELECT SUBSTR ("HowZertIzTabakerky", -11, 2) FROM DUAL;
--Result: Iz
SELECT SUBSTR ("HowZertIzTabakerky", -9, 9) FROM DUAL;
--Result: Tabakerky
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Revolutionizing SaaS Database Performance with AI SQL and AIOps Observability—Powered by Enteros
- 16 September 2025
- Database Performance Management
Introduction The Software-as-a-Service (SaaS) industry is the backbone of modern digital transformation. From enterprise collaboration platforms to CRM solutions, SaaS products are deeply embedded in daily business operations. At the heart of every SaaS application lies its database, where speed, scalability, and resilience directly shape customer experience and business success. Yet, as SaaS platforms scale, … Continue reading “Revolutionizing SaaS Database Performance with AI SQL and AIOps Observability—Powered by Enteros”
Balancing the Insurance Sector’s Digital Balance Sheet: How Enteros Uses AIOps and Cloud FinOps to Drive RevOps Efficiency
Introduction The insurance sector stands at a crossroads of tradition and digital transformation. Once reliant on paper records, manual claims processing, and legacy IT systems, insurers today operate in a hyper-connected ecosystem of digital policies, AI-driven underwriting, fraud detection, and customer self-service portals. At the heart of this transformation lies data—massive, complex, and constantly growing. … Continue reading “Balancing the Insurance Sector’s Digital Balance Sheet: How Enteros Uses AIOps and Cloud FinOps to Drive RevOps Efficiency”
Microfinance platforms scaling to millions
- 15 September 2025
- Software Engineering
Introduction Microfinance has transformed financial inclusion, giving underserved communities access to credit and opportunity. But as platforms scale from thousands to millions of borrowers, the very systems enabling this mission can become bottlenecks. The Challenge Peak-hour overload: thousands apply at once, slowing approvals. Read moreMongoDB profiler and database performance problem diagnosis and identificationDelays in scoring: … Continue reading “Microfinance platforms scaling to millions”
Breaking news under load
When traffic spikes become breaking points Election nights. Natural disasters. Global events. In those moments, audiences turn to news sites in record numbers. But just when the newsroom needs to move fastest, the CMS and databases often slow to a crawl. The result: missed updates, frustrated readers, and credibility at risk. When breaking news slows, … Continue reading “Breaking news under load”