Concatenating field values together
-
What is up with the character used to concatenate field values together?
"||"
??? WTF?
Is "+" or "&" really too illogical or something?
And get this...I found the answer to this on MSDN...not on OTN or any Oracle-related site. But I guess I should've known that would happen...since MSDN'ers have probably been figuring out stupid crap like this for a long time.
-
oh, and another thing...what's up w/ all the Oracle world calling fields "columns" ?
I mean...they're only "columns" when they're displayed in a data grid or something...otherwise they're "fields" of a table (entity) just like you have "fields" of a class (entity) in your code...makes perfect sense to me.
I know what they mean but, their terminology could improve, IMO.
-
Yeah, the "||" is stupid, but it makes me think of boolean OR's which is kind of a concatenation (mix the 2 together). Or at least you can think of it that way.
However- the server does give you a -really- decent error (surprise!) which TELLS you that you have to use "||" instead of "+".
But then why doesn't it just do what you want if it's smart enough to return an error telling you what to do?
And "&" for string concat is nonsensical...
-
Boolean OR is nothing like concatenation, you must mean binary OR, used to combine flags (MB_STUPID | MB_ASSHOLE) :P And I think now you're just using any excuse we can find to put down Oracle. Not that I care, I've never used it anyway :P
-
Calling them "columns" is not even close to being unique to Oracle folk. It is SQL standard practice. Joe CELKO is constantly harping on this in comp.databases.ms-sqlserver.
-
Sadly, "||" is the ANSI-SQL concatenation operator. So, the standard uses a stupid notation for conatenation as well.
I prefer "&", but many flavors of SQL use it for bitwise AND.
In a weakly-typed language, I like concatenation to be a different
symbol than addition in order to avoid confusion about which is being
performed, so at least Oracle/ANSI doesn't "overload" the meaning of
"+". Not that I'm defending Oracle in general (I'd never do that).
Now, in Jet/Access, you can use "&" or "+" for string
concatenation, which I like since I can use "&", but there are
subtle differences which can bite you in the butt. "&" will
treat NULL as empty strings (which is usually what I want), and "+"
will use normal SQL NULL logic.
-
@jamauss said:
oh, and another thing...what's up w/ all the Oracle world calling fields "columns" ?
I
mean...they're only "columns" when they're displayed in a data grid or
something...otherwise they're "fields" of a table (entity) just like
you have "fields" of a class (entity) in your code...makes perfect
sense to me.
I know what they mean but, their terminology could improve, IMO.
Hey MORON! Go read a relational database book!! You are all a bunch of idiots.
-
Since that post - I have actually read and studied many relational database books and other text and will concede that "columns" is the proper terminology, not "field".
Hey, it takes a while for an OOP'er to come around to thinking in RDB terms...gimme a break.
-
@rpresser said:
Calling them "columns" is not even close to
being unique to Oracle folk. It is SQL standard practice. Joe
CELKO is constantly harping on this in comp.databases.ms-sqlserver.
Erm, what ELSE would you call them?
-
@jamauss said:
Hey, it takes a while for an OOP'er to come around to thinking in RDB terms...gimme a break.
So why bother talking/complaining about something you have neither knowledge or understanding of?
-
It's also the Concatenation symbol in SAS ;-)
-
@Otis Mukinfus said:
It's also the Concatenation symbol in SAS ;-)
But SAS uses variables for columns and observations for rows. Except when you're using SAS/SQL, when it doesn't.
-
@jamauss said:
oh, and another thing…what’s up w/ all the Oracle world calling fields “columns”?
What clickety GUI tool did you fall out of?
-
Since Oracle does automatic type conversion, "+" cannot be used.
'123'+2 => 125
'123'||2 => '1232'
even the following works:
'2'+'2' => 4
2||2 => '22'
They could have used "&", though. It has no conflicting meaning in Oracle SQL, neighter in Oracle's tools (SQL*PLUS etc.)