Home All Groups Group Topic Archive Search About
Author
11 Aug 2005 8:30 PM
mikeb
I'm reviewing a SELECT statement written by someone else...

....FROM { OJ  PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY = LQ.STKKEY }
WHERE S.STKKEY = 1030 GROUP BY S.STKKEY

Can you tell me what the "{ OJ" is for?

First, I've not seen the use of {} in a FROM clause, is it just to make it
more readable?

Second, what is the "OJ" supposed to do?  Outer Join??

If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server
Driver]Syntax error or access violation"

Author
11 Aug 2005 8:53 PM
Tibor Karaszi
This seems to be an ODBC escape clause. I was confused at first when looking at the code. The "{"
got me thinking. Pairs of { and } is something that the ODBC driver is looking for to replace with
something that is specific for a certain vendor syntax. This allow some things to be specified in a
generic way and the driver translates it into the vendor specific syntax. The "{" is followed by a
string which tells the ODBC driver what it is. I have a feeling that the string "OJ" stands for
"outer join". I did a quick Google search for below and got some hits. You can probably get a better
understanding from browsing those hits:

ODBC "{ OJ"

Show quote
"mikeb" <m***@nohostanywhere.com> wrote in message news:ek25FOrnFHA.2916@TK2MSFTNGP14.phx.gbl...
> I'm reviewing a SELECT statement written by someone else...
>
> ...FROM { OJ  PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY = LQ.STKKEY } WHERE S.STKKEY = 1030
> GROUP BY S.STKKEY
>
> Can you tell me what the "{ OJ" is for?
>
> First, I've not seen the use of {} in a FROM clause, is it just to make it more readable?
>
> Second, what is the "OJ" supposed to do?  Outer Join??
>
> If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server Driver]Syntax error or access
> violation"
>
Author
11 Aug 2005 9:01 PM
Alejandro Mesa
Google for OJSyntax.


AMB

Show quote
"mikeb" wrote:

> I'm reviewing a SELECT statement written by someone else...
>
> ....FROM { OJ  PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY = LQ.STKKEY }
> WHERE S.STKKEY = 1030 GROUP BY S.STKKEY
>
> Can you tell me what the "{ OJ" is for?
>
> First, I've not seen the use of {} in a FROM clause, is it just to make it
> more readable?
>
> Second, what is the "OJ" supposed to do?  Outer Join??
>
> If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server
> Driver]Syntax error or access violation"
>
>
>
Author
11 Aug 2005 9:02 PM
David Portas
The {} bracket notation is an ODBC function call. The ODBC interface will
interpret anything between the brackets and execute it appropriately for the
target data source. These functions exist so that ODBC applications can have
access to a standard set of features and syntax that may not be directly
supported by all data sources.

For SQL Server this is totally redundant since TSQL directly supports the
same outer join syntax.

--
David Portas
SQL Server MVP
--
Author
11 Aug 2005 9:36 PM
mikeb
I wasn't even sure where to start, but you're right, google of 'OJ syntax'
got me an explanation... and how to work it in qa.
http://db.apache.org/derby/docs/10.0/manuals/reference/sqlj235.html

Thx guys, -m

Show quote
"mikeb" <m***@nohostanywhere.com> wrote in message
news:ek25FOrnFHA.2916@TK2MSFTNGP14.phx.gbl...
> I'm reviewing a SELECT statement written by someone else...
>
> ...FROM { OJ  PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY =
> LQ.STKKEY } WHERE S.STKKEY = 1030 GROUP BY S.STKKEY
>
> Can you tell me what the "{ OJ" is for?
>
> First, I've not seen the use of {} in a FROM clause, is it just to make it
> more readable?
>
> Second, what is the "OJ" supposed to do?  Outer Join??
>
> If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server
> Driver]Syntax error or access violation"
>

AddThis Social Bookmark Button