当前位置:网站首页>MySQL create stored procedure ------ [hy000][1418] this function has none of deterministic, no SQL
MySQL create stored procedure ------ [hy000][1418] this function has none of deterministic, no SQL
2022-07-28 02:14:00 【kjshuan】
# You have to set Otherwise an error
set @@global.log_bin_trust_function_creators = 1;
# Five tables joint query And call the stored procedure
select e.empid,e.empname,e.telephone,e.entertime,e.gender,e.age,
j.jobname,d.depname,
c.cardno,c.gettime,c.outdate,c.cardtype,c.photo,
c2.comname, cal_addr(c2.addrid,c2.address) detailaddr
from employees e
inner join jobs j on e.jobid=j.jobid
inner join departments d on e.depid = d.depid
inner join company c2 on d.comid = c2.comid
left join credentials c on e.empid = c.empid;
set @@global.log_bin_trust_function_creators = 1;
# Delete stored procedure
drop function if exists cal_addr;
# Create stored procedure
create function cal_addr(addr int,compaddr varchar(200))
returns varchar(300)
begin
declare cityinfo varchar(50) default "";
select concat( a1.addrname,a2.addrname,a3.addrname) into cityinfo
from address a1,address a2,address a3
where a3.addrid=addr and a3.subaddr=a2.addrid and a2.subaddr=a1.addrid;
set cityinfo=concat(cityinfo,compaddr);
return cityinfo;
end;
# Calling stored procedure
select cal_addr(20,' Specific address ');
#mybaits One to many Use resultMap
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC
"-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.kgc.towercrane.tchr.mapper.QueryHrMapper">
<resultMap id="emp-emp" type="EmpPage">
<result property="currentPage" column="currentpage"/>
<result property="rowPage" column="rowPage"/>
<collection property="datas"
column="{c=currentPage,r=rowPage}"
ofType="EmployeesVO"
select="findEmpByPage"/>
</resultMap>
<select id="findEmp" parameterType="EmpPage" resultMap="emp-emp">
<![CDATA[
select ceil(count(*)/#{rowPage}) total,#{rowPage} rowPage,#{currentPage} currentPage,
if(#{currentPage}<ceil(count(*)/#{rowPage}),#{currentPage}+1,#{currentPage}) next,
if(#{currentPage}=1,#{currentPage},#{currentPage}-1) previous,
if(#{currentPage}<ceil(count(*)/#{rowPage}),1,0) hasNext,
if(#{currentPage}=1,0,1) hasPrevious from employees
]]>
</select>
<select id="findEmpByPage" resultType="EmployeesVO">
select e.empid,e.empname,e.telephone,e.entertime,e.gender,e.age,
j.jobname,d.depname,
c.cardno,c.gettime,c.outdate,c.cardtype,c.photo,
c2.comname, cal_addr(c2.addrid,c2.address) detailaddr
from employees e
inner join jobs j on e.jobid=j.jobid
inner join departments d on e.depid = d.depid
inner join company c2 on d.comid = c2.comid
left join credentials c on e.empid = c.empid limit ${(c-1)*r},#{r}
</select>
</mapper>
边栏推荐
- 软件测试面试题:常见的 POST 提交数据方式
- [database data recovery] data recovery case of insufficient disk space of SQL Server database
- Linux Installation mysql8.0.29 detailed tutorial
- 微信小程序图片根据屏幕比例缩放
- 软考 --- 数据库(2)关系模型
- Structure pseudo class selector - find single - find multiple - nth of type and pseudo elements
- mysql创建存储过程---------[HY000][1418] This function has none of DETERMINISTIC, NO SQL
- synchronized详解
- UE4 unreal ndisplay plug-in easy to use three fold screen details
- Appium click operation sorting
猜你喜欢

Go learn 02 basic knowledge

2022 software testing skills robotframework + selenium library + Jenkins web Keyword Driven Automation practical tutorial

Common problem types and methods of mathematical univariate differential proof problems in postgraduate entrance examination

MPLS tunnel experiment

SkyWalking分布式系统应用程序性能监控工具-中

Small bulk quantitative stock trading record | data is the source in the quantitative system, which teaches you to build a universal data source framework
![Likeshop takeout ordering system [100% open source, no encryption]](/img/e6/a73aa817b5b30339d755aa53708072.png)
Likeshop takeout ordering system [100% open source, no encryption]

ArcGIS: loading historical remote sensing images

Flex layout learning completed on PC side

In it, there is a million talent gap, and the salary rises, but it is not capped
随机推荐
Flex布局—固定定位+流式布局—主轴对齐—侧轴对齐—伸缩比
go 学习01
华为APP UI自动化测试岗面试真题,真实面试经历。
11-Django-基础篇-数据库操作
Unity universal red dot system
小米网站主页面大模块——小模块+导航(浮动案例)
如何评估研发人员效能?软件工程师报告帮你看见每个人的贡献
Vxe Table/Grid 单元格分组合并
Starfish Os X MetaBell战略合作,元宇宙商业生态更进一步
Hcip day 12 notes
FreeRTOS kernel summary
Starfish OS X metabell strategic cooperation, metauniverse business ecosystem further
Unittest unit test framework full stack knowledge
Product interpretation - Design and distributed expansion of metersphere UI test module
Gbase 8C snapshot synchronization function
ArcGIS: loading historical remote sensing images
Flex布局学习完成PC端
二叉树的遍历和性质
Gbase 8C server signal function
【Star项目】小帽飞机大战(六)