SQL Syntax Error - HELP!
Posted in 1999
Topics: Connectivity: ODBC / JDBC / .NET, Server Administration
The following SQL statement was generated from Crystal Reports. When
executed, it generates a "syntax error".
SELECT
ship_line_tbl.cust_id, ship_line_tbl.part_num,
ship_line_tbl.qty_ord,
inventory_tbl.location, inventory_tbl.qty,
ship_addr_tbl.sold_name, ship_addr_tbl.ship_name,
dms_item_view.dms_item_desc1,
dms_item_w_view.dms_list_price,
dms_ship_via_view.dms_desc_1,
pcktck_rsvd_qty.rsvd_qty
FROM
srswms_db:srs0232.ship_tbl ship_tbl,
srswms_db:srs0232.ship_line_tbl ship_line_tbl,
srswms_db:srs0232.ship_addr_tbl ship_addr_tbl,
srswms_db:srs0232.dms_item_view dms_item_view,
srswms_db:srs0232.dms_item_w_view dms_item_w_view,
srswms_db:srs0232.dms_ship_via_view dms_ship_via_view,
srswms_db:srs0232.pcktck_rsvd_qty pcktck_rsvd_qty,
OUTER srswms_db:srs0232.inventory_tbl inventory_tbl
WHERE
ship_line_tbl.cust_id = inventory_tbl.cust_id AND
ship_line_tbl.part_num = inventory_tbl.part_num AND
ship_line_tbl.order_num = 58 AND
ship_addr_tbl.order_num = 58 AND
dms_item_view.dms_item_num = Trim(ship_line_tbl.cust_id) || "-" ||
ship_line_tbl.part_num AND
dms_item_w_view.dms_whse_code = ship_line_tbl.whse_code AND
dms_item_w_view.dms_item_num = dms_item_view.dms_item_num AND
dms_ship_via_view.dms_ship_via_code = ship_tbl.ship_via AND
pcktck_rsvd_qty.cust_id = ship_line_tbl.cust_id AND
pcktck_rsvd_qty.part_num = ship_line_tbl.part_num AND
ship_tbl.order_num = 58;
If I comment out the two lines in the WHERE clause that start with
pcktck_rsvd_qty, the syntax error is eliminated. If I comment out the
line in the WHERE cluase that has the TRIM function in it, the systax
error is also eliminated, meaning that it isn't the specific syntax of
any of the lines in the WHERE clause. I've narrowed this down tothe
fact that I'm referencing some of the columns a fair number of times. I
was receiving this same syntax error, before the "pcktck..." lines were
added. This previous syntax error was eliminated by using the order
number 58 in the WHERE clause, rather than referencing the order_num
column in one of the tables.
I cut and pasted this SQL statement into two different applications and
they also resulted in a syntax error.
Is there a buffer size environment variable, or something else, that I
need to increase to allow this SELECT to be accepted? The statement
does not appear to be that complex to me.
The Informix DB is running on a SCO-Unix server and I'm connecting
through ODBC to access the DB from the client. Although I believe that
I eliminated the client as a possible problem, because I received the
same syntax error from within "dbaccess" on the SCO box.
Joel
Sent via Deja.com http://www.deja.com/
Before you buy.