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
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;
and for left and also right we have
SUBSTR (`ABCDEF’,-5); //Right(..)
SUBSTR (`ABCDEF’,1,5); // Left(…
So finally the query was
-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.
21 thoughts on “How to – Use Left and CharIndex in Oracle”
Thanks Solved my problem. Aparna S
Very good tip
Дизайнер. Покупка кровельные материалы
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
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
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…
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!
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!
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.
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.
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.
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!
For newest news you have to go to see world wide web and on internet I found this web site as a most excellent website for most up-to-date updates.
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!
Thanks!, it was really helpful!!!