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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:37:22+00:00 2026-06-06T09:37:22+00:00

I have an integer column in my table. It is product id and has

  • 0

I have an integer column in my table. It is product id and has values like

112233001  
112233002  
113311001  
225577001  

This numbering (AABBCCDDD) is formed of 4 parts:

AA : first level category  
BB : second level category  
CC : third level category  
DDD : counter  

I want to check condition in my SELECT statement to select rows that for example have BB = 33 and AA = 11

Please help

  • 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-06T09:37:24+00:00Added an answer on June 6, 2026 at 9:37 am
    SELECT * FROM YOURTABLE
    
    WHERE 
    
    substr(PRODUCT_ID, 3, 2)='33'
    AND
    substr(PRODUCT_ID, 1, 2)='11'
    

    OR

    SELECT * FROM YOURTABLE
    
    WHERE 
    
    PRODUCT_ID LIKE '11%33%'
    

    and yes in short you have to convert to string

    reference of substr

    Purpose

    The SUBSTR functions return a portion of char, beginning at character position, substring_length characters long. SUBSTR calculates lengths using characters as defined by the input character set. SUBSTRB uses bytes instead of characters. SUBSTRC uses Unicode complete characters. SUBSTR2 uses UCS2 code points. SUBSTR4 uses UCS4 code points.

    If position is 0, then it is treated as 1.
    
    If position is positive, then Oracle Database counts from the beginning of char to find the first character.
    
    If position is negative, then Oracle counts backward from the end of char.
    
    If substring_length is omitted, then Oracle returns all characters to the end of char. If substring_length is less than 1, then Oracle returns null.
    

    char can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. Both position and substring_length must be of datatype NUMBER, or any datatype that can be implicitly converted to NUMBER, and must resolve to an integer. The return value is the same datatype as char. Floating-point numbers passed as arguments to SUBSTR are automatically converted to integers.

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

Sidebar

Related Questions

In database table I have column called options . It has type of integer
I have integer column in my table which contains some values. I want to
I have two tables. Lets say they look like this Table Sports: Column 1:
I have a database table that has a SortOrder integer column. In the UI
I have a view like this: CREATE VIEW MyView AS SELECT Column FROM Table
OK, I have a table with no natural key, only an integer identity column
I have two columns in a table that are populated with integer values. For
I have a table with an integer column with some fairly large numbers in
I have a SQLITE database with two tables. Table A has an integer timestamp
I have an integer column which I would like to add a foreign key

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.