cancel
Showing results for 
Search instead for 
Did you mean: 

unload statement error introduced post 16.0.0.1324

dhkom
Participant
936

A SQL Anywhere code construct that worked up to and including 16.0.0.1324 produces an error in 16.0.0.2798 and 17.0.10.5963. This seems related to the topic "¿Bug in Unload Select?", however I thought I'd publish a clean post - especially since I have the problem pretty well isolated. I also found a work-around to prevent the problem - namely, restructuring the joins.

Please see my "//" comments embedded with the code below:

create view view_test as 
  select 
    wo.wk_ord_id,
    wo.wk_ord_no,
    p.prt_id,
    p.prt_cd 
  from
    work_order as wo join work_order_part_part as wopp on
      (wo.wk_ord_id = wopp.wk_ord_id),
    work_order_part_part as wopp join part as p 
go

-- Following works for all tested SQL Anywhere versions:
select * from view_test;

-- Following:
-- 1) Works for SQL Anywhere 16.0.0.1324
-- 2) Issues error for SQL Anywhere 16.0.0.2798, 17.0.10.5963: "Column 'prt_id' not found"
begin
  declare s_result_set      long varchar;
  --
  unload
    select * from view_test
  into variable
    s_result_set
  delimited by '\\x09' quotes off;
end
go

-- Create a view representing the same query but restructured joins:
create view view_test_2 as 
  select 
    wo.wk_ord_id,
    wo.wk_ord_no,
    p.prt_id,
    p.prt_cd 
  from
    work_order as wo 
    join work_order_part_part as wopp on (wo.wk_ord_id = wopp.wk_ord_id)
    join part as p on (wopp.prt_id = p.prt_id)
go

-- Following works for all tested SQL Anywhere versions:
select * from view_test_2;

-- *** FOLLOWING WORKS *** for all tested SQL Anywhere versions:
begin
  declare s_result_set      long varchar;
  --
  unload
    select * from view_test_2
  into variable
    s_result_set
  delimited by '\\x09' quotes off;
end
go

Certainly I can restructure my joins to keep the later versions of SQL Anywhere happy, but it would be nice not to.

Accepted Solutions (0)

Answers (0)