pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedSQL operator '*='
3+ messages / 3 participants
[nested] [flat]
* SQL operator '*='
@ 2019-12-23 14:33 Matthias Apitz <guru@unixarea.de>
2019-12-23 14:49 ` Re: SQL operator '*=' Thomas Kellerer <spam_eater@gmx.net>
2019-12-23 16:46 ` Re: SQL operator '*=' Alban Hertroys <haramrae@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: Matthias Apitz @ 2019-12-23 14:33 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hello,
I've here a smaller problem of our porting from Sybase/Oracle/Informix
code to PostgreSQL; the code reads for the mentioned DBS:
...
#ifdef DBSINF
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, OUTER devisen
WHERE land.wkz = devisen.wkz AND land.brgroup = devisen.brgroup AND land.brgroup = :brgroupHost_for_helpland_cursor
ORDER BY stammprio, landbez;
#endif
#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
#ifdef DBSPOS
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...
Any ideas about how to express this correctly in PostgreSQL?
Thanks
matthias
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
"Glaube wenig, hinterfrage alles, denke selbst: Wie man Manipulationen durchschaut"
"Believe little, scrutinise all, think by your own: How see through manipulations"
ISBN-10: 386489218X
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SQL operator '*='
2019-12-23 14:33 SQL operator '*=' Matthias Apitz <guru@unixarea.de>
@ 2019-12-23 14:49 ` Thomas Kellerer <spam_eater@gmx.net>
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Kellerer @ 2019-12-23 14:49 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SQL operator '*='
2019-12-23 14:33 SQL operator '*=' Matthias Apitz <guru@unixarea.de>
@ 2019-12-23 16:46 ` Alban Hertroys <haramrae@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Alban Hertroys @ 2019-12-23 16:46 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org
> On 23 Dec 2019, at 15:33, Matthias Apitz <guru@unixarea.de> wrote:
>
> #ifdef DBSPOS
> 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
LEFT JOIN devisen ON land.wkz = devisen.wkz AND land.brgroup = devisen.brgroup
> WHERE land.brgroup = :brgroupHost_for_helpland_cursor
> ORDER BY stammprio, landbez;
> #endif
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-12-23 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 14:33 SQL operator '*=' Matthias Apitz <guru@unixarea.de>
2019-12-23 14:49 ` Thomas Kellerer <spam_eater@gmx.net>
2019-12-23 16:46 ` Alban Hertroys <haramrae@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox