How to – Use Left and CharIndex in Oracle


Well i was given the task to get the email id’s of the user which was stored in one of our oracle db table.

But the problem was that we wanted that part of emailid which  appears before ‘@’ .

Well coming from SQL Server background i thought it could be acheived using CharIndex and Left Function.

Let’s see what they do

Select Left(‘abcdef’,3)

-> abc

and

select charindex(‘c’,’abcde’)

-> 3

But than as expected there were no functions like charindex and left in Oracle.

After searching i finally managed to found the solution

Inplace of CharIndex we have instr function

select instr(‘ab’,’b’) from dual;

->2

and for left and also right we have

SUBSTR (`ABCDEF’,-5); //Right(..)

SUBSTR (`ABCDEF’,1,5); // Left(…

So finally the query was

substr(emailid,1,Instr(Emailid,’@’)-1)

-1 is used otherwise @ will also come along

And one more thing, to extract username portion from login name i.e  nishantr1 from

abccompany\nishantr1 we could write something as following

SUBSTRING(loginname ,charindex(‘\’,loginname)+1, len(loginname)) for sql server.


Bye

Advertisements

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

21 thoughts on “How to – Use Left and CharIndex in Oracle”

  1. Your articles – confused in my life the way that you lit one of our brightest lights; your article – in my thorny way of life that you shown us the way forward. You are like a red candle, though small and weak, but you have a sub-thermal, send a splitting, we finally lit up, burning his own. You can go to my site exchange with:youth nfl jerseys

    Like

  2. You are coals of severe winter, the summer heat is in the shade, is sprinkled turbulence in the sea fog stepping-stones wonder of the world.If I can fly in the sky, it is you give me a pair of wings; If I can sail in the sea, is that you gave me frolic in force; If I am not quenched torch, is that you gave me the youth light!,plz visit my websites:youth nfl jerseys

    Like

  3. to get employee name start with ‘a’ without using “Like” operator.
    IN ORACLE SQL ONLY NOT SQL SERVER….
    CHARINDEX IS NOT ALLOWED IN SQL IT SEEMS IN 10G VERSION…

    PLEASE DO U HAVE ANOTHER OPTION…

    Like

  4. Hey this is kinda of off topic but I was wondering if
    blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding expertise so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

    Like

  5. you’re in point of fact a excellent webmaster. The site
    loading pace is incredible. It kind of feels that you’re doing any
    unique trick. Also, The contents are masterwork. you
    have performed a excellent activity in this matter!

    Like

  6. Lets begin with stating among the information about this excellent revolutionary weight-reduction plan capsule and
    metabolism price booster. Perhaps the main reason behind this though is that you have developed a dependence on food.
    The science behind Adiphene consists of 12 of probably
    the most power fat preventing ingredients known.

    Like

  7. And the Google Content Network can pull up many advertising targeting techniques notwithstanding the fact that you have a massive inventory of
    text and image ads spread across the many websites on the internet.

    Roll forward a few years and the advent of online
    collaboration technologies has led to a different style of collaboration, one which
    opens up to a wiki approach where contributions are welcomed and encouraged from
    all parties. Perhaps it’s better not be using these social networks, they say
    they keep people connected, but only in a virtual world,
    it probably prevents a lot of people from going outside and really connecting.

    Like

  8. I hope that you’ve discovered this short Adiphene evaluation helpful and I wish you well in your weight reduction efforts.
    The issues that come with using Adiphene make it one of
    the most essential supplements that anyone can use for weight loss purposes.
    In order to energize yourself and improve your
    outlook you will have to change your diet and get moving.

    Like

  9. Greetings, I do think your website might be having browser compatibility problems.

    Whenever I look at your website in Safari, it looks fine however, if opening in Internet Explorer, it’s got some overlapping issues.
    I simply wanted to provide you with a quick heads up!
    Aside from that, wonderful blog!

    Like

  10. Having read this I believed it was extremely informative.
    I appreciate you spending some time and energy to put this informative article together.
    I once again find myself spending a lot of time both reading and
    leaving comments. But so what, it was still worthwhile!

    Like

Please share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Welcome to the Blog & Website of Paul Andrew

Technical Leadership Centred Around the Microsoft Data Platform

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Dynamics 365 Ninja!

CRM for You and Me

Customer Relationship Mgt App for the Professional

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog

Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform

Knowhere365

Specific topics by Django Lohn on the whole Microsoft365 Stack

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions

MG

Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue MVP

A Microsoft Business Applications MVP

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM

CRM TIPS BY PRM

Mail to crmtipsbyprm@gmail.com for queries and suggestions

nijos.dev

Giving back to the community what I have learned

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.

CRM Keeper

Dynamics 365 Customer Engagement, CRM, Microsoft CRM, Dynamics CRM

EVOLVED365

Step into the world of a Dynamics 365 Consultant

Dianamics PCF Lady

Diana & Dynamics 365 & Power Platform

Sara Lagerquist

No Code Customization Concepts

innovativeaj

developer, designer, writer, fun loving, patriotic, humble and a sweet person inside out :) love and respect people who have a great sense of humor.

Temmy Wahyu Raharjo

dreaming to be a clean coder and TDD minded programmer.

%d bloggers like this: