Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6204877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:10:25+00:00 2026-05-24T05:10:25+00:00

my query is something like this Select date_value from Tab1; The output looks like

  • 0

my query is something like this

Select date_value from Tab1;

The output looks like this (date_value is a Varchar2 column)

 2008-2009
 2009-2010
 2007-2009

I am trying to some formatting on the column date_value,so that the output looks like this

 2008-09
 2009-10
 2007-09

Is there a way to do this as part of the above query using some Split/Join inbuilt oracle functions. I was exploring about Instr and Substr, but i am not sure how to do this jsut in that query.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:10:26+00:00Added an answer on May 24, 2026 at 5:10 am

    If you’re doing this on a 10g database you can use Regular Expressions.

    SQL> select dcol
      2         , regexp_replace(dcol
      3                          , '([[:digit:]]+)\-([[:digit:]]{2})([[:digit:]]{2})'
      4                          , '\1-\3') as regexp_replace
      5  from t79
      6  /
    
    DCOL                           REGEXP_REPLACE
    ------------------------------ ------------------------------
    2008-2009                      2008-09
    2009-2010                      2009-10
    2007-2009                      2007-09
    
    SQL>
    

    Of course, the usual caveat about regex applies here, although it does have one distinct advantage: Y10K compliance 🙂

    SQL> select dcol
      2         , regexp_replace(dcol
      3                          , '([[:digit:]]+)\-([[:digit:]]+)([[:digit:]]{2})'
      4                          , '\1-\3') as regexp_replace
      5  from t79
      6  /
    
    DCOL                           REGEXP_REPLACE
    ------------------------------ ------------------------------
    2008-2009                      2008-09
    2009-2010                      2009-10
    2007-2009                      2007-09
    10199-10200                    10199-00
    887-888                        887-88
    
    SQL>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have something like this: $db=new PDO($dsn); $statement=$db->query('Select * from foo'); while
I have a Linq query that looks something like this: var myPosse = from
I have a Linq query that looks something like this: var query = from
So, I've got a query that looks something like this: SELECT id, DATE_FORMAT(CONVERT_TZ(callTime,'+0:00','-7:00'),'%b %d
I am trying to optimize a query that does something like this: SELECT ...
In postgresql a query in the querylog gets something like this: 2009-02-05 00:12:27 CET
i want something like this: SELECT DISTINCT ID from copies WHERE timestamp < 1229444506
I've done a query like this : SELECT Code, kind, SUM(valP) AS value FROM
I want to my array, somthing like this: array(userid=>username,1=>ganeshfriends,2=>tester) mysql query something like this:
I'm playing with GAE, and need to make a query with something like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.