Re: SQL operator '*='

Thomas Kellerer <[email protected]> Mon, 23 Dec 2019 15:49:03 +0100
Newsgroups gmane.comp.db.postgresql.general
Message-ID <[email protected]>
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