If you pass a variable into an order by, it will sort on that *value*, and as 
that is the same for all rows, it is essentially a no-op. You can only do this 
by either sourcing the order by using a case to specify the column from a 
parameter, or by dynamically constructing the query, and executing it with 
execute statement, with risk for SQL injection.
Mark

----- Reply message -----
Van: "Gugui gugui_sarubi_mac...@yahoo.com.br [firebird-support]" 
<firebird-support@yahoogroups.com>
Aan: <firebird-support@yahoogroups.com>
Onderwerp: [firebird-support] Order by :variable in a Stored Procedure
Datum: di, nov. 3, 2015 19:58

Hi all,
is it possible to pass a variable into a Order by ?

I did it and the StoredProcedure was created without errors
but the variable passed into an 'order by' was ignored and firebird 
assumed the primary key order instead

any tip ?

thanks




------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links



https://info.yahoo.com/legal/us/yahoo/utos/terms/
  • [firebird-suppor... Gugui gugui_sarubi_mac...@yahoo.com.br [firebird-support]
    • Re: [firebi... 'Mark Rotteveel' m...@lawinegevaar.nl [firebird-support]

Reply via email to