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 7977467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:12:28+00:00 2026-06-04T09:12:28+00:00

How do I do this in Oracle Query? this is saying that we want

  • 0

How do I do this in Oracle Query? this is saying that we want the records which has ‘1’ inleft most position in that column.


AND substring(convert(varchar,TR.MENU_ID_VALUE), 1, 1) = '1'
  • 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-06-04T09:12:30+00:00Added an answer on June 4, 2026 at 9:12 am

    The convert function function transforms a string from one character set into another. The syntax is convert(<string>, <to character set>, <from character set>)

    Also, substring isn’t an Oracle function, it’s substr.

    If you don’t need to convert the string then and substr(tr.menu_id_value,1,1) will get you the leftmost character.

    If you do want to convert the character set then the full list is available in the documentation, alternatively you can query v$nls_valid_values. For instance if you’re converting from WE8MSWIN1252 (Windows code-page 1252) to AL32UTF8 (UTF-8) then your condition would become:

    and substr(convert(tr.menu_id_value,'AL32UTF8','WE8MSWIN1252'),1,1) = '1'
    

    From your comment I’m guessing that convert() is the SQL-Server function to convert between data-types. The Oracle equivalent, in this case, would be to_char. Though Oracle will implicitly do the conversion it is always best to use to_char and convert explicitly; giving you:

    and substr(to_char(tr.menu_id_value),1,1) = '1'
    

    Incidentally the exact Oracle equivalent is cast(). Strictly speaking, to_char() should be used if you want to use a format model, thus substr(cast tr.menu_id_value as varchar2(10)),1,1) would also give you what you’re after assuming the length of tr.menu_id_value was less than or equal to 10.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an Oracle query that needs to get the most recent event based
I've got an oracle query like this: SELECT floatColum0,floatColum1,ROUND(floatColum2,2) from table; which is returning
I'm trying to get better performance out of this Oracle query (which is terribly
Tried running a java method that runs this oracle SQL query String query =
Asking for your help on this Oracle query. It's giving me the error 2
How can i make multiple, composite query in oracle? for example this several queries
I want to create this table in Oracle. This is only the table SQL
In Oracle, this returns 03/01/2010. That does not make sense to me. Anybody know
Hello I am trying to run this oracle query in toad and I am
I am running an Oracle query. It seems to work except that it returns

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.