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: Puzzles on SQL/Oracle

Re: Puzzles on SQL/Oracle

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 21 Dec 2006 17:56:54 -0800
Message-ID: <1166752613.93661@bubbleator.drizzle.com>


Charles Hooper wrote:
> DA Morgan wrote:

>>> What I was looking for when I started building the second example was a
>>> way to retrieve the binary values of all columns in a row (ragardless
>>> of the column names), pass the binary values through DBMS_CRYPTO.HASH
>>> to generate a hash key, and then use that to see if two rows resolved
>>> to exactly the same hash key.  I didn't find the function that I was
>>> searching for to pull the binary values of all columns.  Something like
>>> this, but without listing each of the columns:
>>> SELECT
>>>   NVL(A.COL1,B.COL1) COL1,
>>>   NVL(A.COL2,B.COL2) COL2,
>>>   NVL(A.COL3,B.COL3) COL3,
>>>   NVL2(A.COL1,'TABLE A','TABLE B') FROM_TABLE
>>> FROM
>>>   TABLE_A A
>>> FULL OUTER JOIN
>>>   TABLE_B B ON A.COL1=B.COL1 AND A.COL2=B.COL2 AND A.COL3=B.COL3
>>> WHERE
>>>
>>> DUMP(A.COL1||'^'||A.COL2||'^'||A.COL3)<>DUMP(B.COL1||'^'||B.COL2||'^'||B.COL3);
>>>
>>> Charles Hooper
>>> PC Support Specialist
>>> K&M Machine-Fabricating, Inc.
>> I personally like the question because, as I stated before, it allows
>> the interviewer to really get a sense of someone's skills as well as
>> how they approach a problem.
>>
>> Other approaches I've seen include an INTERSECT or INNER JOIN and then
>> filtering out anything in the intersection.
>> --
>> Daniel A. Morgan
>> University of Washington
>> damorgan_at_x.washington.edu
>> (replace x with u to respond)
>> Puget Sound Oracle Users Group
>> www.psoug.org

>
> There are a lot of variants - I agree that it is a good question. I
> posted a couple solutions that used an ANSI FULL OUTER JOIN, a couple
> that used INTERSECT, another that used NOT IN, another using an inline
> view and left outer joins (simulating the NOT IN, just more efficient
> on older versions of Oracle), and even one that used an analytic
> function. EscVector posted a method using MINUS syntax. I am sure
> that there are still methods ways.
>
> Is there no method of retrieving the byte values of all columns in a
> row without listing the column names?
>
> Charles Hooper
> PC Support Specialist
> K&M Machine-Fabricating, Inc.

Not of which I am aware.

--
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Thu Dec 21 2006 - 19:56:54 CST

Original text of this message

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