Re: Stored Procedure with a "ORDER BY" parameter
Roland, I now have this and it works ok. Maybe you mentioned this in the other thread where we discussed this concept, but does it mean you cannot use parameters in the execute statement? That is, where I had before:
execute stmt_handle using @sorder;
and @sorder was the replacement for the ? placeholder, we now know does not work. But the SP below does work. I'm wondering if you cannot have ? parameters in the prepare statement?
DELIMITER $$
DROP PROCEDURE IF EXISTS `cachelistener`.`AuditTest` $$
CREATE PROCEDURE `AuditTest`(in sorder varchar(250))
BEGIN
set @stmt_text := concat('select * from audit order by ', sorder);
prepare stmt_handle from @stmt_text;
execute stmt_handle;
deallocate prepare stmt_handle;
END $$
DELIMITER ;
Subject
Views
Written By
Posted
3675
November 08, 2005 07:59PM
2867
November 09, 2005 02:37AM
3215
November 09, 2005 02:49AM
2674
November 09, 2005 09:40AM
3126
November 09, 2005 04:07PM
2728
November 09, 2005 04:20PM
Re: Stored Procedure with a "ORDER BY" parameter
2887
November 09, 2005 04:33PM
8007
November 09, 2005 05:21PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.