DELIMITER $$DROP FUNCTION IF EXISTS `wellmeadows`.`positions` $$
CREATE FUNCTION `wellmeadows`.`positions` (@po_code varchar) RETURNS varchar(45)
BEGIN
declare po varchar
po=@po_code
select po_describe from positions where po=po_code
return po_describe
END $$DELIMITER ;以上是代码 .. 我有一个表是positions 有两个column 一个是po_code 用来放职位代码的 另一个是po_describe 是用来放职位的描述
其它表调用的都是po_code, 所以我想写一个function用来返回po_describe.
我这样写,mysql说我Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@po_code varchar) RETURNS varchar(45)
BEGIN
declare po varchar
po=@po_code
s' at line 1请问应该怎样改呢?? 谢谢..
CREATE FUNCTION `wellmeadows`.`positions` (@po_code varchar) RETURNS varchar(45)
BEGIN
declare po varchar
po=@po_code
select po_describe from positions where po=po_code
return po_describe
END $$DELIMITER ;以上是代码 .. 我有一个表是positions 有两个column 一个是po_code 用来放职位代码的 另一个是po_describe 是用来放职位的描述
其它表调用的都是po_code, 所以我想写一个function用来返回po_describe.
我这样写,mysql说我Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@po_code varchar) RETURNS varchar(45)
BEGIN
declare po varchar
po=@po_code
s' at line 1请问应该怎样改呢?? 谢谢..
解决方案 »
- 求救,pgsql自定义聚合函数的方法
- 求两条查询优化
- MySQL,如何实现类似partition的功能
- 我装的mysql-5.0.0a-alpha,为什么看不到mysql这个database,只有test一个?
- 日期时间型转日期(十万火急)
- [mysqldump] 指令詳解 [文檔]
- 关于order by和limit的问题
- 为什么在MYSQL中新建的用户无法登录?
- 各位前辈,我有一个很好的创意,无奈受自身水平所限,空有其心无有其力.这是一个大的工程,请进听小生慢慢道来!!!!
- Windows下没有生成慢查询日志
- 请教一下,把MSSQL数据库导到MYSQL里面的时候出现BLOB错误该怎样做呢?
- 求达人解答:MFC里如何获得MySQL表中某一列的均值
BEGIN
declare po varchar
po=@po_code
select po_describ' at line 1
CREATE FUNCTION `wellmeadows`.`positions` (po_code varchar(5)) RETURNS varchar(45)
BEGIN
declare po varchar(5)
po=po_code
select po_describe from positions where po=po_code
return po_describe
END $$DELIMITER ;错误变了地方Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'po=po_code
select po_describe from positions where po=po_code
return po_descri' at line 4
po=po_code
唔要
END $$距话呢句出问题.
最后
CREATE FUNCTION `wellmeadows`.`positions` (po_code varchar(5)) RETURNS varchar(45)
BEGIN
select po_describe from positions where po=po_code into po_code
return po_describe
END $$DELIMITER ;还是不行..
Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'return po_describe
END' at line 4
CREATE FUNCTION `wellmeadows`.`positions` (po_code varchar(5)) RETURNS varchar(45)
BEGIN
select po_describe from positions where po=po_code into @hh
return @hh
END $$
CREATE FUNCTION `wellmeadows`.`positions` ($po_code varchar(255)) RETURNS varchar(45)
BEGIN
declare $po_describe varchar(45);
select po_describe from positions where po_code = $pa_code into $po_describe;
return $po_describe;
END$$DELIMITER ;