0
DELIMITER $$

DROP PROCEDURE IF EXISTS
`ufdc_sales`.`depot_stack_register3_7_2` $$
CREATE DEFINER=`root`@`%` PROCEDURE `enter code here`
`depot_stack_register3_7_2`( IN stackId BIGINT,IN speciesId 
BIGINT,IN fromdate DATE,IN todate DATE)
BEGIN
set @mysql='select  sdt.depot_lot_no

from stack st , stock_detail_trans  sdt 

where sdt.stack_id=st.id 
      SET @mysql = @mysql+' AND st.SPECIES_ID='+1;
END $$
DELIMITER ;

附加错误。我想知道如何添加此查询。

4

2 回答 2

1

尝试,

SET @mysql='select  sdt.depot_lot_no
            from stack st , stock_detail_trans  sdt 
            where sdt.stack_id=st.id';
SET @mysql = CONCAT(@mysql, ' AND st.SPECIES_ID = 1');
于 2012-10-16T09:26:08.417 回答
0

报价成对出现。代替:

set @mysql='select  sdt.depot_lot_no
from stack st , stock_detail_trans  sdt 
where sdt.stack_id=st.id 
      SET @mysql = @mysql+' AND st.SPECIES_ID='+1;

... 尝试:

set @mysql='select  sdt.depot_lot_no
    from stack st , stock_detail_trans  sdt 
    where sdt.stack_id=st.id ';
SET @mysql = @mysql+' AND st.SPECIES_ID='+1;

并且请不要忽略错误消息。他们是来帮助你的!

于 2012-10-16T09:38:09.363 回答