Re: ORDER BY ?, ?, ? DESC
Posted in 1995
rnatesan@bactc.com (Ramki Natesan) wrote: >Hi, > 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 achive 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 > ................. > ............. > ============================= > > This seems not working for me, Is there any other way to > arrive this form?. I am using INFORMIX-4GL Version 4.10.UE2, > on SunOS. > > Could some one help me regarding this? > > Thanks in Advance, Ramki. Hello Ramki, try the following: PROMPT "enter col1" FOR c1 PROMPT "enter col2" FOR c2 PROMPT "enter col3" FOR c3 LET dynamic="SELECT * FROM emp_tab ORDER BY ",c1 CLIPPED,",", c2 CLIPPED,",",c3 CLIPPED PREPARE stmt FROM dynamic OPEN cur1 .. I hope, this should help with Your problem. Greetings Roland