Skip to Main Content
  • Questions
  • How to fetch part of a string for LONG datatype



Question and Answer

Connor McDonald

Thanks for the question, Jaswanth.

Asked: February 14, 2020 - 4:27 pm UTC

Answered by: Connor McDonald - Last updated: February 17, 2020 - 2:42 am UTC

Category: SQL - Version: 12c

Viewed 100+ times

You Asked


I am writing a query to find missing table partitions for next year using all_tab_partitions table, I am able to fetch the records with the help of column partition positions, but I have to extract the last partition date (YYYY-MM-DD) from HIGH_VALUE which is a Long data type

Here is the value of HIGH_VALUE = TO_DATE(' 2023-12-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')

I want the value as


If I try to cast or use REGEXP its throwing error inconsistent datatypes: expected CHAR got long

and we said...

Here's a video walk through of one way to do it

We're not taking reviews currently, so please try again later if you want to add a review.

More to Explore


Check out more PL/SQL tutorials on our LiveSQL tool.