Quantcast
Channel: pacesettergraam
Viewing all articles
Browse latest Browse all 314

Splitting of words in two statements in SQL using INSTR and SUBSTR functions

$
0
0

Below is the code snippet

 

select substr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, 0, case when instr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, ‘ ‘,45, 1)= 0 then 45 else instr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, ‘ ‘,45, 1) end) first_var
, substr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, instr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, ‘ ‘,45, 1), case when instr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, ‘ ‘,45, 1)>45 then instr(‘One Hundred Ninety Five Thousand Two Hundred Seventeen Qatari Riyals And Twenty Six Dirhams*****’, ‘ ‘,45, 1) else 0 end) sec_var from dual;


Viewing all articles
Browse latest Browse all 314

Trending Articles