Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Oracle Outer joins
Message
From
21/07/2004 12:10:34
 
 
To
21/07/2004 11:00:20
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00926563
Message ID:
00926600
Views:
16
This message has been marked as the solution to the initial question of the thread.
Jerry,

Which version of Oracle are you using. Oracle did not add support for the 'OUTER JOIN' syntax until version 9.

Prior to that you have to use the (+) on your join statements. For example, the syntax below will return all the rows in the SO table and Nulls if there is no item.

Mace

TEXT to lc_SQL TEXTMERGE NOSHOW PRETEXT 3
SELECT *
FROM myOracle.SO So, myOracle.ITEM Item
WHERE So.ITEM = Item.ITEM (+)
AND So.so = ?lc_so
ORDER BY So.so_line
ENDTEXT
lc_SQL = STRTRAN(lc_SQL, CHR(13) + CHR(10), [ ])
ln_result = SQLEXEC(myconn, lc_sql, 'c_so')





>How can I perform a LEFT or RIGHT join on 2 tables in Oracle from VFP? I can get an inner join to work but not a Left or Right.
>
>
>***Works.
>TEXT to lc_SQL TEXTMERGE NOSHOW PRETEXT 3
>SELECT *
>  FROM myOracle.SO So, myOracle.ITEM Item
>  WHERE So.ITEM = Item.ITEM
>  AND So.so = ?lc_so
>  ORDER BY So.so_line
>ENDTEXT
>lc_SQL = STRTRAN(lc_SQL, CHR(13) + CHR(10), [ ])
>ln_result = SQLEXEC(myconn, lc_sql, 'c_so')
>
>
>***Does NOT work. Returns a -1.
>TEXT to lc_SQL TEXTMERGE NOSHOW PRETEXT 3
>SELECT *
>  FROM myOracle.SO So LEFT JOIN myOracle.ITEM Item
>  ON So.ITEM = Item.ITEM
>  AND So.so = ?lc_so
>  ORDER BY So.so_line
>ENDTEXT
>lc_SQL = STRTRAN(lc_SQL, CHR(13) + CHR(10), [ ])
>ln_result = SQLEXEC(myconn, lc_sql, 'c_so')
>
>
>Thanks,
>
>Jerry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform