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: UNIX : script help/input

Re: UNIX : script help/input

From: Vladimir Begun <Vladimir.Begun_at_oracle.com>
Date: Wed, 01 Oct 2003 18:19:34 -0800
Message-ID: <F001.005D1B74.20031001181934@fatcity.com>


Jared

Jared Still wrote:

>>Good! The more the merrier! Welcome to the club.

>
> Oh most definitely.
>
> As I just finished writing a prototype package for assigning MAC
> addresses ( we make network stuff - that's a technical term ), I
> have endured the agonies of doing hex math in PL/SQL.
>
> I finally bit the bullet and used string manipulation to convert
> hex to decimal and do what I needed that way. Couldn't get BITAND
> to work properly on very large integers. Besides, doing XOR with
> BITAND in PL/SQL is very painful.

BITAND in PL/SQL works for INTEGER/PLS_INTEGER only.

> UTL_RAW has an XOR, but it requires RAW values and I didn't feel
> like messing with it.
>
> This is all very simple in Perl.

Sure!

> Given a MAC of 000050000AA, with a fixed portion of 00005000000,
> it is very easy to determine the variable portion of the address
> via $x = 0x000050000AA ^ 00005000000.
>
> Not quite so simple in PL/SQL.

"Globally unique addresses are allocated by the IEEE in blocks containing 2^24 (16,777,216) addresses. In each allocation, the first 3 octects are fixed (e.g. 00-00-0C is Cisco) and the last three octects are variable (e.g. 00-00-00 through FF-FF-FF). The fixed portion of the allocation is known formally as the Organizationally Unique Identifier (OUI), and infomally as the Ethernet Vendor ID. Often, the OUI portion of a MAC address is extremely helpful in indentifying which physical piece of equipment is generating a particular packet."

00-00-50 is for RADISYS CORPORATION, right?

x := SUBSTR('0x0000500000AA', -6);

Then you can use BITAND. However, I'm not saying that PL/SQL is better than perl -- every language has its own purpose.

-- 
Vladimir Begun
The statements and opinions expressed here are my own and
do not necessarily represent those of Oracle Corporation.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Vladimir Begun
  INET: Vladimir.Begun_at_oracle.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Oct 01 2003 - 21:19:34 CDT

Original text of this message

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