Everything is a Bit Bucket
By: Michael O'Neill
@oraclenudeoraclenude.crisatunity.comIn response to
Chet's frustration over yet another encounter with a database agnostic, I wanted to contribute my first article to the
oraclenerd franchise. My thoughts seemed too long for the comment stream.
I ascribe the kernel of thought behind "the database is a bit bucket" primarily to each and every database vendor that ever existed. Every database vendor, in an effort to persuade users of competitive products to adopt their product, has participated willingly in espousing some core aspect of how "same as the other guy" their product is in addition to whatever differentiation pitch they have.
Now, the generally weak-minded and lazy developer (yes, I think the majority of developers are in fact weak-minded and lazy) latches on to the vendor's selective "sameness" claims for professional and personal reasons. (full disclosure: I am both an Oracle DBA and .NET developer)
Professionally, because they are financially invested in writing third-party code not database code. To them, the less they spend learning and understanding the particulars of things like databases, operating systems, networks, human beings, etc. the better. Personally, because there is a dominate thread in the culture of developers to dismiss the database as interesting or meaningful. It is a form of heresy to show affection towards any platform in any specificity.
This is why Java's Big Lie of "write once, run any where" swoons so many. Java's Big Lie is analogous to "the database is a bit bucket" by declaring that even the language of software code should be as absolutely interchangeable as possible - even at the expense of being cost-effective or useful. There is an unquestioned faith that decoupling everything from everything is a good thing. This faith gives us code that is as far from the simplest thing that could work from the first moment writing the code is undertaken. It is a faith I reject. That's why I'm an
ORACLENERD.
P.S. I know oraclenude and oraclenerd is confusing. It's supposed to be.
Labels: database, moneill, rant
APEX: Create and Parse Arrays
It's been awhile since I've been able to work with APEX extensively, so I am rusty.
A question came up today whether we could get multiple values into a single variable (Item in APEX).
Yes we can!
APEX_UTILSNeed some data first:
CREATE TABLE t ( some_text VARCHAR2(10) );
INSERT INTO t ( some_text )
SELECT dbms_random.string( 'a', 10 ) some_text
FROM dual
CONNECT BY LEVEL <= 5;
CJUSTICE@TESTING>SELECT * FROM t;
SOME_TEXT
----------
thrFXviVWJ
kpfGRRwctv
EVxNrcmBHC
gcBlHaKrLa
irYduOZfkS
I want that table data to be in a single item.
TABLE_TO_STRING is your function.
VAR C VARCHAR2(100);
DECLARE
l_table APEX_APPLICATION_GLOBAL.VC_ARR2;
BEGIN
SELECT some_text
BULK COLLECT INTO l_table
FROM t;
:c := apex_util.table_to_string( p_table => l_table );
END;
/
PL/SQL procedure successfully completed.
C
-----------------------------------------------------------
thrFXviVWJ:kpfGRRwctv:EVxNrcmBHC:gcBlHaKrLa:irYduOZfkS
Easy enough. How about converting it back to a table?
STRING_TO_TABLE is your answer.
DECLARE
l_table APEX_APPLICATION_GLOBAL.VC_ARR2;
BEGIN
l_table := apex_util.string_to_table( p_string => :c );
FOR i IN 1..l_table.COUNT LOOP
d( 'value ' || i || ': ' || l_table(i) );
END LOOP;
END;
/
value 1: thrFXviVWJ
value 2: kpfGRRwctv
value 3: EVxNrcmBHC
value 4: gcBlHaKrLa
value 5: irYduOZfkS
PL/SQL procedure successfully completed.
Done.
Labels: apex, apex_util, howto
The "Database is a Bucket" Mentality
Front and center again...I just woke up from a nap, I'm grumpy, so I must write. Besides, I haven't had a good rant in quite some time.
Friend of mine asked me last week for some advice, specifically asking if there was a tool to convert Oracle SQL Syntax to the ANSI SQL syntax. (A quick search turned up
this (it was the first result), if you're interested).
I had to ask why.
Client is switching to an open source database, i.e. "free." Oracle licensing is way too pricey.
I'm sure Oracle costs a lot of money, it's pretty darn good software. Quite possibly the best in the world especially in the database realm. I've written about the incredibly feature rich goodness that is the Oracle database
here here...actually, just trust me. It's in my name.
Why is there even a comparison?
Could it be that everyone out there believes that the sole purpose of a database is to store data? That it can't do
anything else? The storage and retrieval of data...that's all it does of course.
It's like saying the Democrats and Republicans are the same...at face value, perhaps, but the devil is in the details.
This, this "Bit Bucket" mentality is what is so incredibly frustrating.
I am no position to argue the differences between the various flavors of database, I lack the experience. But if I were using SQL Server, I would leverage the shit out of it's capabilities. If I were using MySQL, I would leverage the shit out of it's capabilities. If I were using Firebird, I would leverage the shit out of it's capabilities. Same goes for every single flavor out there. Get my point here?
The database is NOT a bit bucket!Do I need to use more 4-letter words?
I know that Oracle is feature rich and that 99% percent of your code can live in the database...think APEX and PL/SQL. You could probably put ALL of your code inside the database if you wanted to put the javascript in BLOBs as well.
Please, please please quit telling me they are the same...
they are not.
Follow up rant by Mr. O'Neill can be found on this following post
Everything is a Bit BucketLabels: database, design, development, oracle, rant
Code Comment WTF? Part 209
Found this in a snippet today:
-- ********************************
-- End of Package Body
END package_pkg ;
/
Seriously? Was that necessary? Could I possibly be under the illusion that it is
not the end of the package?
Stop it.
Now.
Labels: code, funny, style, wtf