Re: SQL operator '*='

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: SQL operator '*='
Date: 2019-12-23 14:49:03
Message-ID: 509a447f-8304-c2c2-f3c8-fb46d07e6239@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matthias Apitz schrieb am 23.12.2019 um 15:33:
> I've here a smaller problem of our porting from Sybase/Oracle/Informix
> code to PostgreSQL; the code reads for the mentioned DBS:
>
>
> #ifdef DBSORA
> EXEC SQL DECLARE land_cursor CURSOR FOR
> SELECT stammprio, lkz, landbez, plkz, postbez, karenz1, karenz2,
> karenz3, land.wkz, webez, we, kurs, land.del
> FROM land, devisen
> WHERE land.wkz = devisen.wkz (+) AND land.brgroup = devisen.brgroup (+) AND land.brgroup = :brgroupHost_for_helpland_cursor
> ORDER BY stammprio, landbez;
> #endif
>
> #ifdef DBSSYB
> EXEC SQL DECLARE land_cursor CURSOR FOR
> SELECT stammprio, lkz, landbez, plkz, postbez, karenz1, karenz2,
> karenz3, land.wkz, webez, we, kurs, land.del
> FROM land, devisen
> WHERE land.wkz *= devisen.wkz AND land.brgroup *= devisen.brgroup AND land.brgroup = :brgroupHost_for_helpland_cursor
> ORDER BY stammprio, landbez;
> #endif
>
> (the code for DBSPOS was just copied from Sybase). It compiles fine but
> raises on execution en error about operator '*=' is not supported...

T-SQL (Sybase and SQL Server) uses *= for outer joins, just as Oracle uses (+)

Haven't used either of those outdated operators in decades, but I think the equivalent would be:

FROM land
LEFT JOINdevisen
on land.wkz = devisen.wkz
AND land.brgroup = devisen.brgroup
AND land.brgroup = :brgroupHost_for_helpland_cursor

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2019-12-23 14:56:47 Mixing greediness in regexp_matches
Previous Message Matthias Apitz 2019-12-23 14:33:48 SQL operator '*='