{"id":18687,"date":"2025-04-16T18:46:23","date_gmt":"2025-04-16T13:16:23","guid":{"rendered":"https:\/\/vinish.dev\/?p=18687"},"modified":"2025-05-28T09:43:42","modified_gmt":"2025-05-28T04:13:42","slug":"oracle-sql-substring","status":"publish","type":"post","link":"https:\/\/vinish.dev\/oracle-sql-substring","title":{"rendered":"How to Get Substring from a String in Oracle SQL?"},"content":{"rendered":"\n<p><strong>In Oracle SQL, you get a substring from a string using the <code>SUBSTR<\/code> function<\/strong>. The <code>SUBSTR<\/code> function is one of the most versatile and commonly used string manipulation functions in Oracle Database. In this tutorial, we'll explore how to use the <code>SUBSTR<\/code> function effectively, understand its variants, and see practical examples of its application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to SUBSTR<\/h2>\n\n\n\n<p>The <code>SUBSTR<\/code> function extracts a portion of a string starting at a specified position and continuing for a specified number of characters. It's an essential tool for string manipulation in SQL queries, <a href=\"https:\/\/vinish.dev\/how-to-create-function-in-pl-sql\">PL\/SQL code<\/a>, and data transformations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">SUBSTR(string, position [, substring_length])<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>string<\/strong>: The source string from which to extract a substring<\/li>\n\n\n\n<li><strong>position<\/strong>: The starting position for extraction (can be positive or negative)<\/li>\n\n\n\n<li><strong>substring_length<\/strong>: Optional. The number of characters to extract<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How the SUBSTR Function Position Works<\/h2>\n\n\n\n<p>The position parameter in <code>SUBSTR<\/code> has some nuances worth understanding:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If <strong>position &gt; 0<\/strong>: Counts from the beginning of the string (1 is the first character)<\/li>\n\n\n\n<li>If <strong>position = 0<\/strong>: Treated as position 1 (first character)<\/li>\n\n\n\n<li>If <strong>position &lt; 0<\/strong>: Counts backward from the end of the string (-1 is the last character)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Examples of Extracting Substrings in Oracle SQL<\/h2>\n\n\n\n<p>Let's start with some simple examples to demonstrate how <code>SUBSTR<\/code> works:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Extract 4 characters starting from position 3\nSELECT SUBSTR('ORACLE DATABASE', 3, 4) AS result FROM DUAL;\n-- Result: ACLE\n\n-- Extract from position 8 to the end (substring_length omitted)\nSELECT SUBSTR('ORACLE DATABASE', 8) AS result FROM DUAL;\n-- Result: DATABASE\n\n-- Position 0 is treated as position 1\nSELECT SUBSTR('ORACLE DATABASE', 0, 6) AS result FROM DUAL;\n-- Result: ORACLE\n\n-- Negative position counts from the end\nSELECT SUBSTR('ORACLE DATABASE', -8, 4) AS result FROM DUAL;\n-- Result: DATA\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Oracle SQL SUBSTR Variants<\/h2>\n\n\n\n<p>Oracle provides several variants of the <code>SUBSTR<\/code> function to handle different character encodings:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SUBSTR<\/strong>: Uses characters as defined by the input character set<\/li>\n\n\n\n<li><strong>SUBSTRB<\/strong>: Uses bytes instead of characters<\/li>\n\n\n\n<li><strong>SUBSTRC<\/strong>: Uses Unicode complete characters<\/li>\n\n\n\n<li><strong>SUBSTR2<\/strong>: Uses UCS2 code points<\/li>\n\n\n\n<li><strong>SUBSTR4<\/strong>: Uses UCS4 code points<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">When to Use Different Variants<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <strong>SUBSTR<\/strong> for most general string operations<\/li>\n\n\n\n<li>Use <strong>SUBSTRB<\/strong> when working with byte-level operations or when dealing with multi-byte character sets where byte positions are important<\/li>\n\n\n\n<li>Use <strong>SUBSTRC<\/strong>, <strong>SUBSTR2<\/strong>, or <strong>SUBSTR4<\/strong> for specific Unicode handling requirements<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Working with Different Data Types<\/h2>\n\n\n\n<p>The <code>SUBSTR<\/code> function works with various character data types:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">-- With VARCHAR2\nSELECT SUBSTR('Oracle Database 23', 8, 8) FROM DUAL;\n-- Result: Database\n\n-- With CHAR (returns VARCHAR2)\nDECLARE\n  v_char CHAR(20) := 'Oracle Database 23';\nBEGIN\n  DBMS_OUTPUT.PUT_LINE(SUBSTR(v_char, 8, 8));\nEND;\n-- Result: Database\n\n-- With CLOB\nDECLARE\n  v_clob CLOB := 'Oracle Database 23 is the latest version';\n  v_result VARCHAR2(100);\nBEGIN\n  v_result := SUBSTR(v_clob, 1, 15);\n  DBMS_OUTPUT.PUT_LINE(v_result);\nEND;\n-- Result: Oracle Database\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Applications<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Extracting Parts of Names<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Extracting first name and last name from a full name\nSELECT \n  SUBSTR(full_name, 1, INSTR(full_name, ' ')-1) AS first_name,\n  SUBSTR(full_name, INSTR(full_name, ' ')+1) AS last_name\nFROM \n  (SELECT 'John Smith' AS full_name FROM DUAL);\n\n-- Result:\n-- FIRST_NAME  LAST_NAME\n-- ----------  ---------\n-- John        Smith\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Masking Sensitive Data<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Mask credit card numbers, showing only last 4 digits\nSELECT \n  'XXXX-XXXX-XXXX-' || SUBSTR(credit_card_number, -4) AS masked_cc_number\nFROM \n  (SELECT '1234-5678-9012-3456' AS credit_card_number FROM DUAL);\n\n-- Result: XXXX-XXXX-XXXX-3456\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Extracting Domain from Email<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Extract domain from email addresses\nSELECT \n  email,\n  SUBSTR(email, INSTR(email, '@')+1) AS domain\nFROM \n  (SELECT 'user@example.com' AS email FROM DUAL);\n\n-- Result:\n-- EMAIL             DOMAIN\n-- ----------------- ---------\n-- user@example.com  example.com\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Working with Date Strings<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Extract year, month, and day from a date string in format 'YYYY-MM-DD'\nSELECT \n  date_string,\n  SUBSTR(date_string, 1, 4) AS year,\n  SUBSTR(date_string, 6, 2) AS month,\n  SUBSTR(date_string, 9, 2) AS day\nFROM \n  (SELECT '2023-11-15' AS date_string FROM DUAL);\n\n-- Result:\n-- DATE_STRING  YEAR  MONTH  DAY\n-- -----------  ----  -----  ---\n-- 2023-11-15   2023  11     15\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Multi-byte Character Handling<\/h2>\n\n\n\n<p>When working with multi-byte character sets, <code>SUBSTR<\/code> and <code>SUBSTRB<\/code> can behave differently:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Assuming a database with a multi-byte character set like AL32UTF8\n-- Chinese characters (each typically 3 bytes in UTF-8)\nSELECT \n  '\u4f60\u597d\u4e16\u754c' AS original,\n  SUBSTR('\u4f60\u597d\u4e16\u754c', 2, 2) AS substr_result,\n  SUBSTRB('\u4f60\u597d\u4e16\u754c', 4, 6) AS substrb_result\nFROM DUAL;\n\n-- Result:\n-- ORIGINAL  SUBSTR_RESULT  SUBSTRB_RESULT\n-- --------  -------------  --------------\n-- \u4f60\u597d\u4e16\u754c    \u597d\u4e16            \u597d\u4e16\n<\/pre>\n\n\n\n<p>In this example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>SUBSTR<\/code> treats each Chinese character as one character<\/li>\n\n\n\n<li><code>SUBSTRB<\/code> works with bytes, so position 4 starts at the second character (since each character is 3 bytes)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Performance Considerations<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>SUBSTR<\/code> is highly optimized in Oracle and generally performs well<\/li>\n\n\n\n<li>For very large strings (especially CLOBs), consider the performance impact<\/li>\n\n\n\n<li>When working with <a href=\"https:\/\/vinish.dev\/displaying-clob-contents-in-oracle-apex\">CLOBs<\/a>, use <code>DBMS_LOB.SUBSTR<\/code> for better performance with large objects<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Using DBMS_LOB.SUBSTR for CLOB data\nDECLARE\n  v_clob CLOB;\n  v_result VARCHAR2(100);\nBEGIN\n  -- Assume v_clob contains a large amount of text\n  v_clob := 'This is a very long text...'; -- Simplified for example\n  \n  -- Using DBMS_LOB.SUBSTR for better performance with large CLOBs\n  v_result := DBMS_LOB.SUBSTR(v_clob, 20, 1);\n  DBMS_OUTPUT.PUT_LINE(v_result);\nEND;\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes and Solutions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Incorrect Position Parameter<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Trying to extract the last 4 characters using a positive position<br>-- Incorrect approach:<br>SELECT SUBSTR('ORACLE', 4, 4) FROM DUAL; -- Returns 'CLE'<br><br>-- Correct approach:<br>SELECT SUBSTR('ORACLE', -4) FROM DUAL; -- Returns 'ACLE'<br><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Not Handling NULL Values<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- SUBSTR returns NULL if the input string is NULL\nSELECT SUBSTR(NULL, 1, 5) FROM DUAL; -- Returns NULL\n\n-- Using NVL to handle NULL values\nSELECT SUBSTR(NVL(column_name, 'N\/A'), 1, 5) FROM your_table;\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Forgetting That Position 0 Equals Position 1<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Position 0 is treated as position 1\nSELECT SUBSTR('ORACLE', 0, 3) FROM DUAL; -- Returns 'ORA', not 'RAC'\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Advanced Examples of Oracle SQL SUBSTR Function<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Combining SUBSTR with Other String Functions<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Extract the second word from a string\nSELECT \n  SUBSTR(\n    'Oracle Database 23',\n    INSTR('Oracle Database 23', ' ') + 1,\n    INSTR('Oracle Database 23', ' ', 1, 2) - INSTR('Oracle Database 23', ' ') - 1\n  ) AS second_word\nFROM DUAL;\n\n-- Result: Database\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Using SUBSTR in UPDATE Statements<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Update email domains from .com to .org\nUPDATE employees\nSET email = SUBSTR(email, 1, INSTR(email, '@')) || 'example.org'\nWHERE SUBSTR(email, INSTR(email, '@') + 1) = 'example.com';\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Using SUBSTR in WHERE Clauses<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Find all products with codes starting with 'AB'\nSELECT product_name, product_code\nFROM products\nWHERE SUBSTR(product_code, 1, 2) = 'AB';\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Dynamic Substring Extraction<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">-- Extract a substring based on dynamic start and end markers\nDECLARE\n  v_text VARCHAR2(100) := 'The [important] information is here';\n  v_start_marker VARCHAR2(10) := '[';\n  v_end_marker VARCHAR2(10) := ']';\n  v_result VARCHAR2(100);\nBEGIN\n  v_result := SUBSTR(\n                v_text,\n                INSTR(v_text, v_start_marker) + 1,\n                INSTR(v_text, v_end_marker) - INSTR(v_text, v_start_marker) - 1\n              );\n  DBMS_OUTPUT.PUT_LINE(v_result);\nEND;\n-- Result: important\n<\/pre>\n\n\n\n<p>See also: <a href=\"https:\/\/vinish.dev\/oracle-sql-calculate-business-days\">Oracle SQL query to calculate business days<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The <code>SUBSTR<\/code> function is a powerful tool for string manipulation in Oracle Database. By understanding its behavior with different position values, character sets, and data types, you can effectively extract and manipulate string data in your applications.<\/p>\n\n\n\n<p>Remember these key points:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Position can be positive (counting from start), zero (treated as 1), or negative (counting from end)<\/li>\n\n\n\n<li>If substring_length is omitted, all characters to the end are returned<\/li>\n\n\n\n<li>Different variants (SUBSTRB, SUBSTRC, etc.) handle different character encoding scenarios<\/li>\n\n\n\n<li>The function works with various character data types including VARCHAR2, CHAR, NVARCHAR2, and CLOB<\/li>\n<\/ul>\n\n\n\n<p>With these techniques, you can handle a wide range of string manipulation tasks in your Oracle Database applications.<\/p>\n\n\n\n<p>Reference: <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/23\/sqlrf\/SUBSTR.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Oracle SQL SUBSTR<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Oracle SQL, you get a substring from a string using the SUBSTR function. The SUBSTR function is one of the most versatile and commonly used string manipulation functions in Oracle Database. In this tutorial, we'll explore how to use the SUBSTR function effectively, understand its variants, and see practical examples of its application. Introduction [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":18688,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1807],"tags":[],"class_list":["post-18687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle-sql"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Get Substring in Oracle SQL? &#8226; Vinish.Dev<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use SUBSTR function in Oracle SQL to get a substring from a string.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vinish.dev\/oracle-sql-substring\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get Substring in Oracle SQL? &#8226; Vinish.Dev\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use SUBSTR function in Oracle SQL to get a substring from a string.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vinish.dev\/oracle-sql-substring\" \/>\n<meta property=\"og:site_name\" content=\"Vinish.Dev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/foxinfotech2014\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-16T13:16:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-28T04:13:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vinish.dev\/wp-content\/uploads\/2025\/04\/get-substring-oracle-sql-e1744799865114.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"755\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vinish Kapoor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/x.com\/vinish_kapoor\" \/>\n<meta name=\"twitter:site\" content=\"@foxinfotech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vinish Kapoor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring\"},\"author\":{\"name\":\"Vinish Kapoor\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/a7790479716d2a54131ca873f8483d3f\"},\"headline\":\"How to Get Substring from a String in Oracle SQL?\",\"datePublished\":\"2025-04-16T13:16:23+00:00\",\"dateModified\":\"2025-05-28T04:13:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring\"},\"wordCount\":560,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/df5e5ca816f6f4302efc03cf58dc97b4\"},\"image\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/get-substring-oracle-sql-e1744799865114.png\",\"articleSection\":[\"Oracle SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring\",\"url\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring\",\"name\":\"How to Get Substring in Oracle SQL? &#8226; Vinish.Dev\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/get-substring-oracle-sql-e1744799865114.png\",\"datePublished\":\"2025-04-16T13:16:23+00:00\",\"dateModified\":\"2025-05-28T04:13:42+00:00\",\"description\":\"In this tutorial, you will learn how to use SUBSTR function in Oracle SQL to get a substring from a string.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#primaryimage\",\"url\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/get-substring-oracle-sql-e1744799865114.png\",\"contentUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/get-substring-oracle-sql-e1744799865114.png\",\"width\":1366,\"height\":755,\"caption\":\"Oracle SQL Substring example.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/oracle-sql-substring#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vinish.dev\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle SQL\",\"item\":\"https:\\\/\\\/vinish.dev\\\/category\\\/oracle-sql\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Get Substring from a String in Oracle SQL?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/#website\",\"url\":\"https:\\\/\\\/vinish.dev\\\/\",\"name\":\"Vinish.Dev\",\"description\":\"Vinish Kapoor&#039;s Blog: Best Oracle Blog for Developers\",\"publisher\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/df5e5ca816f6f4302efc03cf58dc97b4\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vinish.dev\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/df5e5ca816f6f4302efc03cf58dc97b4\",\"name\":\"Vinish Kapoor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\",\"url\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\",\"contentUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\",\"width\":192,\"height\":192,\"caption\":\"Vinish Kapoor\"},\"logo\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\"},\"description\":\"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.\",\"sameAs\":[\"https:\\\/\\\/vinish.dev\\\/\",\"https:\\\/\\\/www.facebook.com\\\/foxinfotech2014\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/vinish-kapoor\\\/\",\"https:\\\/\\\/x.com\\\/foxinfotech\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/a7790479716d2a54131ca873f8483d3f\",\"name\":\"Vinish Kapoor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g\",\"caption\":\"Vinish Kapoor\"},\"description\":\"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.\",\"sameAs\":[\"https:\\\/\\\/vinish.dev\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/vinish-kapoor\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/x.com\\\/vinish_kapoor\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Get Substring in Oracle SQL? &#8226; Vinish.Dev","description":"In this tutorial, you will learn how to use SUBSTR function in Oracle SQL to get a substring from a string.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vinish.dev\/oracle-sql-substring","og_locale":"en_US","og_type":"article","og_title":"How to Get Substring in Oracle SQL? &#8226; Vinish.Dev","og_description":"In this tutorial, you will learn how to use SUBSTR function in Oracle SQL to get a substring from a string.","og_url":"https:\/\/vinish.dev\/oracle-sql-substring","og_site_name":"Vinish.Dev","article_publisher":"https:\/\/www.facebook.com\/foxinfotech2014","article_published_time":"2025-04-16T13:16:23+00:00","article_modified_time":"2025-05-28T04:13:42+00:00","og_image":[{"width":1366,"height":755,"url":"https:\/\/vinish.dev\/wp-content\/uploads\/2025\/04\/get-substring-oracle-sql-e1744799865114.png","type":"image\/png"}],"author":"Vinish Kapoor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/x.com\/vinish_kapoor","twitter_site":"@foxinfotech","twitter_misc":{"Written by":"Vinish Kapoor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vinish.dev\/oracle-sql-substring#article","isPartOf":{"@id":"https:\/\/vinish.dev\/oracle-sql-substring"},"author":{"name":"Vinish Kapoor","@id":"https:\/\/vinish.dev\/#\/schema\/person\/a7790479716d2a54131ca873f8483d3f"},"headline":"How to Get Substring from a String in Oracle SQL?","datePublished":"2025-04-16T13:16:23+00:00","dateModified":"2025-05-28T04:13:42+00:00","mainEntityOfPage":{"@id":"https:\/\/vinish.dev\/oracle-sql-substring"},"wordCount":560,"commentCount":0,"publisher":{"@id":"https:\/\/vinish.dev\/#\/schema\/person\/df5e5ca816f6f4302efc03cf58dc97b4"},"image":{"@id":"https:\/\/vinish.dev\/oracle-sql-substring#primaryimage"},"thumbnailUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2025\/04\/get-substring-oracle-sql-e1744799865114.png","articleSection":["Oracle SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vinish.dev\/oracle-sql-substring#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vinish.dev\/oracle-sql-substring","url":"https:\/\/vinish.dev\/oracle-sql-substring","name":"How to Get Substring in Oracle SQL? &#8226; Vinish.Dev","isPartOf":{"@id":"https:\/\/vinish.dev\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vinish.dev\/oracle-sql-substring#primaryimage"},"image":{"@id":"https:\/\/vinish.dev\/oracle-sql-substring#primaryimage"},"thumbnailUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2025\/04\/get-substring-oracle-sql-e1744799865114.png","datePublished":"2025-04-16T13:16:23+00:00","dateModified":"2025-05-28T04:13:42+00:00","description":"In this tutorial, you will learn how to use SUBSTR function in Oracle SQL to get a substring from a string.","breadcrumb":{"@id":"https:\/\/vinish.dev\/oracle-sql-substring#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vinish.dev\/oracle-sql-substring"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vinish.dev\/oracle-sql-substring#primaryimage","url":"https:\/\/vinish.dev\/wp-content\/uploads\/2025\/04\/get-substring-oracle-sql-e1744799865114.png","contentUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2025\/04\/get-substring-oracle-sql-e1744799865114.png","width":1366,"height":755,"caption":"Oracle SQL Substring example."},{"@type":"BreadcrumbList","@id":"https:\/\/vinish.dev\/oracle-sql-substring#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vinish.dev\/"},{"@type":"ListItem","position":2,"name":"Oracle SQL","item":"https:\/\/vinish.dev\/category\/oracle-sql"},{"@type":"ListItem","position":3,"name":"How to Get Substring from a String in Oracle SQL?"}]},{"@type":"WebSite","@id":"https:\/\/vinish.dev\/#website","url":"https:\/\/vinish.dev\/","name":"Vinish.Dev","description":"Vinish Kapoor&#039;s Blog: Best Oracle Blog for Developers","publisher":{"@id":"https:\/\/vinish.dev\/#\/schema\/person\/df5e5ca816f6f4302efc03cf58dc97b4"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vinish.dev\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vinish.dev\/#\/schema\/person\/df5e5ca816f6f4302efc03cf58dc97b4","name":"Vinish Kapoor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png","url":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png","contentUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png","width":192,"height":192,"caption":"Vinish Kapoor"},"logo":{"@id":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png"},"description":"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.","sameAs":["https:\/\/vinish.dev\/","https:\/\/www.facebook.com\/foxinfotech2014","https:\/\/www.linkedin.com\/in\/vinish-kapoor\/","https:\/\/x.com\/foxinfotech"]},{"@type":"Person","@id":"https:\/\/vinish.dev\/#\/schema\/person\/a7790479716d2a54131ca873f8483d3f","name":"Vinish Kapoor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g","caption":"Vinish Kapoor"},"description":"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.","sameAs":["https:\/\/vinish.dev\/","https:\/\/www.linkedin.com\/in\/vinish-kapoor\/","https:\/\/x.com\/https:\/\/x.com\/vinish_kapoor"]}]}},"_links":{"self":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts\/18687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/comments?post=18687"}],"version-history":[{"count":5,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts\/18687\/revisions"}],"predecessor-version":[{"id":19277,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts\/18687\/revisions\/19277"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/media\/18688"}],"wp:attachment":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/media?parent=18687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/categories?post=18687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/tags?post=18687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}