You cannot use ? in the ORDER BY clause.
You can, of course, reverse the order of the PROMPT statements and the
PREPARE, and build the string using the input data from the prompts. The
cursor would not need a USING clause for the ORDER BY clause. (though it
might still need it for other reasons).
Dropping into ESQL/C is no help -- ESQL/C imposes the limitation on the
contents of the ORDER BY clause. I don't know of any system that provides
what you seek; it is not mandated by ANSI standard SQL.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
PS: 4.10.UE2 is a really old version -- you should upgrade, probably to
4.13.UE1; unless you're also using a really old version of SunOS.
}From: rnatesan@bactc.com (Ramki Natesan)
}Date: Tue, 6 Jun 1995 08:57:23 -0700 (PDT)
}X-Informix-List-Id: <list.6462>
}
} In one of my i4gl tools, user wants to sort and display the records
} by any given column names from the form. What I need to do is, take
} those column names and use them in "ORDER BY ?, ?, ?" or in
} "PREPARE" statement. I couldn't get it done in i4gl. Is there any
} way, to achieve this?.
}
} I am trying the following method and it is not working.
} .............
} PREPARE stmt FROM "SELECT * FROM emp_tab ORDER BY ?, ?, ?"
}
} PROMPT "enter col1" FOR c1
} PROMPT "enter col2" FOR c2
} PROMPT "enter col3" FOR c3
}
} DECLARE cur1 SCROLL CURSOR FOR stmt
}
} OPEN cur1 USING c1, c2, c3
} .................
} I am using INFORMIX-4GL Version 4.10.UE2, on SunOS.