Difference between SUBSTR and INSTR?
Answers were Sorted based on User's Feedback
Answer / tulsi
SUBSTR is used to extract a set of characters from a string
by specificing the character starting position and end
position and length of characters to be fetched.
example substr('hello',2,3) will return 'ell'
INSTR is used to find the position of any particular
character in a word which returns numeric value.
instr('hello','e') - will return the position of 'e' as 2
Is This Answer Correct ? | 65 Yes | 6 No |
Answer / shrikant
Hi,
Yes Tulsi is right.
Execute the below queries & you will see the diff clearly -
SELECT instr('hello','e') FROM dual
SELECT substr('hello',2,3) FROM dual
Is This Answer Correct ? | 34 Yes | 4 No |
Answer / atchala ramanareddy
substr:
select substr('atchala ramanareddy',2,9) from dual;
it will return tchala ra.
instr:
select instr('atchala ramanareddy','a',1,2) from dual;
it will return 5.
Is This Answer Correct ? | 19 Yes | 3 No |
what is rollback? : Sql dba
What is the difference between pl and sql?
What is union and union all keyword in sql and what are their differences?
what is definer rights invoke rights?
what are the join types in tsql? : Transact sql
Why are cursors used?
What are pl/sql cursor exceptions?
take one table is t1 and in that column name is f1 f1 column values are 200 5000 3000 7000 300 600 100 400 800 400 i want display the values asc and desc in a single output. sample output is f1.a 100 200 300 400 500 600 etc...... and f1.d is 5000 4000 3000 2000 1000 etc...
How can I tell if sql is running?
how to enter binary numbers in sql statements? : Sql dba
Does view contain data?
How many sql commands are there?