8.0032 - SQL interpretation is broken

ScriptCase interprets SQL incorrectly.

Create a grid application with nested SQL:

SELECT t0.Item_Name, (SELECT AVG(Price) FROM t_inventory WHERE id = t0.iid) AS aprice FROM items t0

The SC SelectLimit() function will have an error in the order-by parameter: “nm_sel_esp order by Item_Name asc, 12, 0”

[LIST=1]

  • ScriptCase should not add an ORDER BY clause
  • If a field was defined using an explicit table reference, that table reference is required (not optional) [/LIST]

    The full error will be:

    Error
    Error while accessing the database:
    Unknown column 'Item_Name' in 'order clause'
    SelectLimit(SELECT t0.Item_Name, (SELECT AVG(Price) FROM t_inventory WHERE id = t0.iid) AS aprice FROM items t0 ) nm_sel_esp order by Item_Name asc, 12, 0)
    

    The workaround is to create a VIEW, but if you must interpret the SQL, then you should interpret it correctly, and not add arbitrary clauses like ORDER BY.