Subject | Re: [firebird-support] Order by :variable in a S tored Procedure |
---|---|
Author | Mark Rotteveel |
Post date | 2015-11-03T19:13Z |
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_macchi@... [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
Van: "Gugui gugui_sarubi_macchi@... [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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-digest@yahoogroups.com firebird-support-fullfeatured@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscribe@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/