ocp 11g認證題庫詳解:1Z0-051-076題
最新學訊:近期OCP認證正在報名中,因考試人員較多請盡快報名獲取最近考試時間,報名費用請聯系在線老師,甲骨文官方認證,報名從速!
我要咨詢ocp 11g認證題庫詳解:1Z0-051-076題,完整題庫請點擊這里聯系老師咨詢了解
76. You need to display the first names of all customers from the CUSTOMERS table that contain the
character 'e' and have the character 'a' in the second last position.
Which query would give the required output?
A. SELECT cust_first_name
FROM customers
WHERE INSTR(cust_first_name, 'e')<>0 AND
SUBSTR(cust_first_name, -2, 1)='a';
B. SELECT cust_first_name
FROM customers
WHERE INSTR(cust_first_name, 'e')<>'' AND
SUBSTR(cust_first_name, -2, 1)='a';
C. SELECT cust_first_name
FROM customers
WHERE INSTR(cust_first_name, 'e')IS NOT NULL AND
SUBSTR(cust_first_name, 1,-2)='a';
D. SELECT cust_first_name
FROM customers
WHERE INSTR(cust_first_name, 'e')<>0 AND
SUBSTR(cust_first_name, LENGTH(cust_first_name),-2)='a';
Answer: A
試題解析:
SUBSTR:提取確定長度的字符串
SUBSTR(cust_first_name, -2, 1)='a'意思是cust_first_name從右邊開始數,第二個字符是a
INSTR:查找指定字符串的數字位置,如果沒有找到,instr函數返回0
INSTR(cust_first_name, 'e')確定是否有e這個字符,有則輸出器位置,沒有則輸出0,。
則A正確。
INSTR(源字符串, 目標字符串, 起始位置, 匹配序號)
在oracle/PLSQL中,instr函數返回要截取的字符串在源字符串中的位置。只檢索一次,就是說從字符的開始到字符的結尾就結束。
語法如下:instr( string1, string2 [, start_position [, nth_appearance ] ] )
參數分析:string1源字符串,要在此字符串中查找。
string2要在string1中查找的字符串.
start_position代表string1 的哪個位置開始查找。此參數可選,如果省略默認為1. 字符串索引從1開始。如果此參數為正,從左到右開始檢索,如果此參數為負,從右到左檢索,返回要查找的字符串在源字符串中的開始索引。
nth_appearance代表要查找第幾次出現的string2. 此參數可選,如果省略,默認為 1.如果為負數系統會報錯。
注意:如果String2在String1中沒有找到,instr函數返回0.