- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
Believe it or not, his way is faster... Way faster...
http://blog.sqlauthority.com/2007/06/08/sql-server-insert-multiple-records-using-one-insert-statement-use-of-union-all/
Admin
If you use UNION ALL (not UNION), it's faster. Plus I don't think Oracle has that syntax yet.
Admin
I've done something not to far from this once or twice. I'm guessing they're writing PL/SQL for a company or (more likely) government agency where database changes take forever.
Sometimes it's not worth the battle to get a lookup table created.
Admin
Admin
Or one of the devs mentioned that doing it as a table would let them add new entries or update the times if anything changed, and manglement freaked out: "NO! You CAN'T let the times change! They're defined in our contracts! No tables. At all. Do it some way where you can't change the times.". And the dev rolled his eyes, decided it was Friday afternoon and he just didn't want to have this fight, and lo and behold another WTF is born.
Admin
Admin
Why is everyone sayinmg that Oracle requirirng FROM is a WTF?
SQL = Structured Query Language.
Why should you be able to select other stuff (like constants, or the current time, or the timezone in Beijing?). It might sometimes be CONVENIENT to, but usually whatever you're calling the SQL FROM has more convenient ways to do it....
If I want to add two numbers, I would do it in my calling code, not on the DB (unless it was related to a query on a table- in which aase I have my FROM clause eg "SELECT i.Create_time + t.TimeOffset FROM Invoice i, Timezone t WHERE i.timezone_id = t.timezone_id")
TRWTF is the people here who think we should use a databse to select stuff out of nowhere.
Admin
Not all of them - ORA-20000 to ORA-20999 are "supposed" to be free for users to use, although there are some Oracle-supplied packages which use error numbers in this range.
Admin
You're still querying something, just not a database. Just think of "select ..." as SQL for "Oh great machine, pray tell, what is ... ?"
Admin
I understood each word perfectly, but could make no sense of the whole
Admin
Admin
Admin
I wish I could slap that code.
I've already slapped Oracle.
Admin
liberate tutemae ex Oracle...
Admin
A procedure where you want a consistent timestamp for your transactions that are in multiple insert/update statements.
Now please go into another field of work.
Admin
ugly, but I've seen much worse.
My favorite are the EAV tables for everything under the sun... which someone will create some nifty view around for a small result set, and yet it is near impossible to read... but had it been a well-defined table structure for the relation at hand, it would have been straightforward and sensible.
But hey, who has time for all those pesky little doo-dads? Let's just consolidate all to a single SUPER/MASTER/EVERYTHING table.. That way we only have a one-stop shop!!! <rolls eyes>
Admin
Perhaps it was meant to be "DUEL", as in I'll fight you to the death over this design!
Admin
[quote user="Andy"][quote user="Captain Oblivious"] Indeed, the table dual is dual to the empty table. In other words, it is the top of the Dedekind-Maclane completion of the lattice of relations defined by the schema. [/quote]
The relational algebra turns a schema into a lattice. But such a lattice might not be "complete". In other words, meets and joins for relations might not be defined by the schema. For example, if you have a key constraint on a relation, then the key constraint defines a join.
In these theoretical terms, the purpose of a RDBMS is to compute "arbitrary" meets and joins. Even those not explicitly defined by the schema. In other words, it is "contains" (in a mathematical/metaphysical sense) the Dedekind-Maclane completion of the lattice (the intersection of all the complete lattices which contain the lattice defined by the schema).
A complete lattice has a "bottom" element (the empty relation), and a "top" element (the relation which contains every field). The table called "dual" is the top element of the lattice. It is called "dual" because it is "dual" to the bottom element. It could also be called "top".
Admin
Dual is the dual of the wooden table.
Admin
SELECT without FROM is not standard SQL. The standard way of doing it is with a bare VALUES command: http://www.postgresql.org/docs/current/static/sql-values.html Works on PostgreSQL and DB2.
Admin
Admin
1/ No good way (in any DB platform) to keep lookup / config tables continuously synched with version controlled code[/quote]
Not built in sure, but maybe you should check out some decent source control tools like Red-Gate source control. It allows you to source control static data on any table with a primary key. We just source control all of our lookup or control tables check them in from dev, and to a get latest to prod.
Admin
Because Oracle in all of its perfect glory doesn't allow normal crap in their DB. Just try to work with dates and see if you don't lose your mind.
Admin
No one noticed the line /* SNIP a few dozen lines for brevity */
Instead: /* SKIP a few dozen lines for brevity */
All of you that tryied ti "Fix" it just copied it and didn't think at all.
Maybe not the WTF but Read and understand ALL the code also the remaks
BTW there is no DBMS that follows the standard completely and only. they all have their owd additions
Admin
Clearly the developer of the view did not have priviledge to create a table for the data, so we see the circumvention.
Admin