我尝试根据用户的搜索条目创建搜索表的过程并显示它们。我在我的程序中在p_brand中遇到重复的参数错误。
这是代码
- 常规DDL - 注意:服务器不会存储例程正文之前和之后的注释
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `MAS_pSearchinventory`
(
IN p_Category VARCHAR(20),
IN p_Brand VARCHAR(20),
IN P_Model varchar(20),
IN p_Pricefrom INT(20),
IN p_Priceto INT(20),
OUT p_Product varchar(30),
OUT p_Brand varchar(30),
OUT p_Model varchar(30),
OUT p_Series varchar(30),
OUT p_Color varchar(30),
OUT p_MotherBoard varchar(30),
OUT p_Processor varchar(30),
OUT p_Ram varchar(30),
OUT p_ScreenType varchar(30),
OUT p_ScreenSize varchar(30),
OUT p_OpticalDiskdrive varchar(30),
OUT p_Usb varchar(30),
OUT p_ModemEthernet varchar(30),
OUT p_Bluetooth varchar(30),
OUT p_TVOutput varchar(30),
OUT p_SoundCard varchar(30),
OUT p_KeyboardAndMouse LONGTEXT,
OUT p_Accessories LONGTEXT,
OUT p_OperatingSystem varchar(30),
OUT p_GraphicsCard varchar(30),
OUT p_ScreenResolution varchar(30),
OUT p_HardDrive varchar(30),
OUT p_MemoryCardReader varchar(30),
OUT p_Wifi varchar(30),
OUT p_AudioInterface varchar(30),
OUT p_ExpantionCardSlot varchar(30),
OUT p_Webcam varchar(30),
OUT p_Battery varchar(30),
OUT p_SoftwareIncluded varchar(30),
OUT p_Price varchar(30),
OUT p_Discount varchar(30),
OUT p_HomeDelivery varchar(30),
OUT p_FileName varchar(100),
OUT p_Result varchar(100)
)
BEGIN
SELECT
Product,Brand,Model,Series,Color,MotherBoard,
Processor,
Ram,
ScreenType,
ScreenSize,
OpticalDiskdrive,
Usb,
ModemEthernet,
Bluetooth,
TV put,
SoundCard,
KeyboardAndMouse,
Accessories,
OperatingSystem,
GraphicsCard,
ScreenResolution,
HardDrive,
MemoryCardReader,
Wifi,
AudioInterface,
ExpantionCardSlot,
Webcam,
Battery,
SoftwareIncluded,
Price,
Discount,
HomeDelivery,
FileName,
Result
from mas_tinsertinventorydetails
WHERE
(
(category=p_Category) and
(Brand=p_Brand) and
(model=p_Model) and
(pricefrom=p_Pricefrom) and
(priceto=p_Priceto)
);
END
答案 0 :(得分:1)
将OUT p_Brand param重命名为其他内容。还有p_Model
答案 1 :(得分:0)
尝试这个...它对我来说很好..
此处我更改了p_Brand to p_Brand_out
和p_Model to p_Model_out
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `MAS_pSearchinventory`
(
IN p_Category VARCHAR(20),
IN p_Brand VARCHAR(20),
IN P_Model varchar(20),
IN p_Pricefrom INT(20),
IN p_Priceto INT(20),
OUT p_Product varchar(30),
OUT p_Brand_out varchar(30),
OUT p_Model_out varchar(30),
OUT p_Series varchar(30),
OUT p_Color varchar(30),
OUT p_MotherBoard varchar(30),
OUT p_Processor varchar(30),
OUT p_Ram varchar(30),
OUT p_ScreenType varchar(30),
OUT p_ScreenSize varchar(30),
OUT p_OpticalDiskdrive varchar(30),
OUT p_Usb varchar(30),
OUT p_ModemEthernet varchar(30),
OUT p_Bluetooth varchar(30),
OUT p_TVOutput varchar(30),
OUT p_SoundCard varchar(30),
OUT p_KeyboardAndMouse LONGTEXT,
OUT p_Accessories LONGTEXT,
OUT p_OperatingSystem varchar(30),
OUT p_GraphicsCard varchar(30),
OUT p_ScreenResolution varchar(30),
OUT p_HardDrive varchar(30),
OUT p_MemoryCardReader varchar(30),
OUT p_Wifi varchar(30),
OUT p_AudioInterface varchar(30),
OUT p_ExpantionCardSlot varchar(30),
OUT p_Webcam varchar(30),
OUT p_Battery varchar(30),
OUT p_SoftwareIncluded varchar(30),
OUT p_Price varchar(30),
OUT p_Discount varchar(30),
OUT p_HomeDelivery varchar(30),
OUT p_FileName varchar(100),
OUT p_Result varchar(100)
)
BEGIN
SELECT
Product,Brand,Model,Series,Color,MotherBoard,
Processor,
Ram,
ScreenType,
ScreenSize,
OpticalDiskdrive,
Usb,
ModemEthernet,
Bluetooth,
TV put,
SoundCard,
KeyboardAndMouse,
Accessories,
OperatingSystem,
GraphicsCard,
ScreenResolution,
HardDrive,
MemoryCardReader,
Wifi,
AudioInterface,
ExpantionCardSlot,
Webcam,
Battery,
SoftwareIncluded,
Price,
Discount,
HomeDelivery,
FileName,
Result
from mas_tinsertinventorydetails
WHERE
(
(category=p_Category) and
(Brand=p_Brand) and
(model=p_Model) and
(pricefrom=p_Pricefrom) and
(priceto=p_Priceto)
);
END