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


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!
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…
[...] (see article) [...]
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
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
[...] Comments 2010 in review … on Using Left and CharIndex in…2010 in review … on (Service Unavailable) Could no…2010 in review … on Unable [...]
[...] Using Left and CharIndex in Oracle October 2007 4 comments [...]
Дизайнер. Покупка кровельные материалы
Требуется электрик
http://build.su/index.php?s=60fcda64a4dddd6d3f1ebbd9a9e5500d&act=SF&f=332
http://putevka.cz.cc/index.html
Very good tip
Thanks Solved my problem. Aparna S