This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Minggu, 12 Mei 2013

FUNGSI INSTR


Soal Drilling SQL NO.13

>> Pertanyaan <<
What value is returned after executing the following statement?
SELECT INSTR('How_long_is_a_piece_of_string?','_',5,3) FROM DUAL;
(Choose the best answer.)
A. 4
B. 14
C. 12
D. None of the above

Jawaban : B
>> Penjelasan <<
INSTR
Fungsi ini akan mengembalikan posisi karakter yang dicari dalam suatu string. Sama seperti LENGTH, fungsi ini biasanya digunakan bersama dengan fungsi yang lain. Bentuk umumnya adalah INSTR(string, set [, start [, occurence]]). set merupakan karakter yang dicari posisinya, bisa lebih dari satu karakter. Posisi yang dikembalikan adalah posisi karakter yang pertama kali ditemukan. Misal kita ingin mengetahui posisi ‘el’ dalam string ‘hellohello’, maka yang dihasilkan adalah 2, karena pencarian akan menemukan huruf ‘e’ yang merupakan huruf pertama dari ‘el’ pada string ‘hellohello’ di posisi dua.
SELECT INSTR(‘itfromzerotohero’ , ‘o’) FROM dual
Opsi start digunakan untuk menentukan awal mulai pencarian, defaulnya pada awal string. Sedangkan opsi kedua yaitu occurence digunakan untuk menentukan karakter keberapa yang cocok, defaultnya posisi yang dikembalikan adalah karakter pertama yang cocok.
SELECT INSTR(‘itfromzerotohero’ , ‘o’, 5) FROM dual
SELECT INSTR(‘itfromzerotohero’ , ‘o’, 6) FROM dual
SELECT INSTR(‘hellohello’, ‘el’, 1, 2) FROM dual

Twitter Delicious Facebook Digg Stumbleupon Favorites More