You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Kent Spaulding <ke...@iotabits.com> on 2009/02/18 23:18:45 UTC
Derby Syntax for (+)?
Hi again,
I hope this is a simple question: one troubling query:
select distinct o.d, o.u, o.e
from my_table o, my_table_2 t
where o.u = t.u(+)
and t.u is null
and o.u not like 'P%';
This fails with a syntax error - on the (+) on line 3 of the SQL -
what's the corresponding Derby syntax?
Re: Derby Syntax for (+)?
Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Kent,
I believe that this is Oracle's old syntax for outer joins. I think that
Oracle 9i added the ANSI standard syntax to Oracle. As I recall, the old
syntax gave rise to non-standard results.
Regards,
-Rick
Kent Spaulding wrote:
> thanks for the quick reply - I suppose I'll try left and right outer
> joins ;-)
>
> So (+) is shorthand, not part of the standard SQL?
>
> --Kent
>
> On Feb 18, 2009, at 11:24 PM, Bryan Pendleton wrote:
>
>>> select distinct o.d, o.u, o.e
>>> from my_table o, my_table_2 t
>>> where o.u = t.u(+)
>>> and t.u is null
>>> and o.u not like 'P%';
>>> This fails with a syntax error - on the (+) on line 3 of the SQL -
>>> what's the corresponding Derby syntax?
>>
>> Looks like you may be trying to write an outer join. You can
>> find the Derby syntax for outer joins documented here:
>> http://db.apache.org/derby/docs/10.4/ref/rrefsqlj18922.html
>>
>> I think you'll want something like
>>
>> select distinct o.d, o.u, o.e
>> from my_table o left outer join my_table_2 t on o.u = t.u
>> where t.u is null and o.u not like 'P%';
>>
>> thanks,
>>
>> bryan
>>
>
Re: Derby Syntax for (+)?
Posted by Kent Spaulding <ke...@iotabits.com>.
thanks for the quick reply - I suppose I'll try left and right outer
joins ;-)
So (+) is shorthand, not part of the standard SQL?
--Kent
On Feb 18, 2009, at 11:24 PM, Bryan Pendleton wrote:
>> select distinct o.d, o.u, o.e
>> from my_table o, my_table_2 t
>> where o.u = t.u(+)
>> and t.u is null
>> and o.u not like 'P%';
>> This fails with a syntax error - on the (+) on line 3 of the SQL -
>> what's the corresponding Derby syntax?
>
> Looks like you may be trying to write an outer join. You can
> find the Derby syntax for outer joins documented here:
> http://db.apache.org/derby/docs/10.4/ref/rrefsqlj18922.html
>
> I think you'll want something like
>
> select distinct o.d, o.u, o.e
> from my_table o left outer join my_table_2 t on o.u = t.u
> where t.u is null and o.u not like 'P%';
>
> thanks,
>
> bryan
>
Re: Derby Syntax for (+)?
Posted by Bryan Pendleton <bp...@amberpoint.com>.
> select distinct o.d, o.u, o.e
> from my_table o, my_table_2 t
> where o.u = t.u(+)
> and t.u is null
> and o.u not like 'P%';
>
> This fails with a syntax error - on the (+) on line 3 of the SQL -
> what's the corresponding Derby syntax?
Looks like you may be trying to write an outer join. You can
find the Derby syntax for outer joins documented here:
http://db.apache.org/derby/docs/10.4/ref/rrefsqlj18922.html
I think you'll want something like
select distinct o.d, o.u, o.e
from my_table o left outer join my_table_2 t on o.u = t.u
where t.u is null and o.u not like 'P%';
thanks,
bryan