Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help needed: OCP exam_cram book questons

Re: Help needed: OCP exam_cram book questons

From: yong huang <yong321_at_yahoo.com>
Date: Mon, 31 Jul 2000 08:25:26 -0700 (PDT)
Message-Id: <10575.113377@fatcity.com>


Rachel and others,

This is the first time I seriously look at some OCP exam questions. I think Oracle is right at least for the first question you posted:

You query the database with this command:

SELECT
CONCAT(LOWER(SUBSTR(description,10)), LENGTH(product_name)) "Product ID" FROM inventory;

Which function is evaluate second?
a CONCAT()
b. LOWER()
c. SUBSTR()

According to the book:
The correct answer is c.

The reason why SUBSTR is evaluated second is that there're 4 functions in here. Oracle parses a SQL statement from the end to the beginning. I know this because if you have a statement with multiple column names (or table names) that are wrong, the last one is pointed by Oracle to be wrong. After you correct it, it points to the second last, and so on. There's no tool like explain plan for assessing the semantic analysis sequence of the Oracle SQL interpreter. But based on the above observation, we can imagine Oracle evaluates the functions LENGTH, SUBSTR and LOWER in order (LOWER after SUBSTR for a different reason: parenthesis).

Yong Huang
yong321_at_yahoo.com



Do You Yahoo!?
Kick off your party with Yahoo! Invites. Received on Mon Jul 31 2000 - 10:25:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US