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

Home -> Community -> Usenet -> c.d.o.server -> Re: And the correct answer is?

Re: And the correct answer is?

From: Karsten Farrell <kfarrell_at_belgariad.com>
Date: Fri, 04 Apr 2003 20:59:39 GMT
Message-ID: <MPG.18f7921965ee7e3898971e@news.la.sbcglobal.net>


nospan_at_noway.org said...
> The following is from a text..... I would like some opinions .... what
> is the correct answer.
>
> EMP Table is defined as follows:
> EMPNO NUMBER 4
> ENAME VARCHAR2 30
> SALARY NUMBER 14,2
> COMM NUMBER 10,2
> DEPTNO NUMBER 2
>
> You perform the following tow queries:
>
> 1. SELECT empno enumber, ename FROM emp ORDER BY 1;
> 2. SELECT empno, ename FROM emp ORDER BY ASC;
>
> Which of the following is true?
> A. Statements 1 and 2 will produce the same result.
> B. Statement 1 will execute; statement 2 will return an error.
> C. Statement 2 will execute; statement 1 will return an error.
> D. Statement 1 and 2 will execute but produce different results.
>

Oh, goodie! A contest! What do I win if I'm the first to get the right answer?

I choose answer "A" ... because I forgot to login as SCOTT, who owns the EMP table ... and both queries (once I corrected the syntax error in query #2) produced the exact same result - no rows returned.

But wait, since I had to correct the syntax error, does that mean "B" is correct?

No, wait again ... after I corrected the query #2 syntax error, I needed to run it in pl/sql, and forgot to supply an INTO clause. Once I added that, it returned too many rows and I got another error. Darn! It can't be "C" because I got 2 errors instead of AN error on query #1.

Oh, ok ... I think I got it now ... it's definitely "D" ... because after all the changes I've made, they definitely return different answers.

-- 
/Karsten
DBA > retired > DBA
Received on Fri Apr 04 2003 - 14:59:39 CST

Original text of this message

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