最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

mysql临时表cann'treopen解决方案_MySQL

来源:动视网 责编:小采 时间:2020-11-09 18:58:29
文档

mysql临时表cann'treopen解决方案_MySQL

mysql临时表cann'treopen解决方案_MySQL:bitsCN.com 当你创建临时表的时候,你可以使用temporary关键字。如: create temporary table tmp_table(name varchar(10) not null,passwd char(6) not null); 或 create temporary table if not exists
推荐度:
导读mysql临时表cann'treopen解决方案_MySQL:bitsCN.com 当你创建临时表的时候,你可以使用temporary关键字。如: create temporary table tmp_table(name varchar(10) not null,passwd char(6) not null); 或 create temporary table if not exists


bitsCN.com

当你创建临时表的时候,你可以使用temporary关键字。如:

create temporary table tmp_table(name varchar(10) not null,passwd char(6) not null);



create temporary table if not exists sp_output_tmp engine= memory select …from … where ID=current_id;

临时表只在当前连接可见,当这个连接关闭的时候,会自动drop。这就意味着你可以在两个不同的连接里使用相同的临时表名,并且相互不会冲突,或者使用 已经存在的表,但不是临时表的表名。(当这个临时表存在的时候,存在的表被隐藏了,如果临时表被drop,存在的表就可见了)。创建临时表你必须有
create temporary table 权限。
下面几点是临时表的:
1、临时表只能用在 memory,myisam,merge,或者innodb
2、临时表不支持mysql cluster(簇)
3、在同一个query语句中,你只能查找一次临时表。例如:下面的就不可用

mysql> SELECT * FROM temp_table, temp_table AS t2;
ERROR 1137: Can't reopen table: 'temp_table'

mysql bug地址:http://bugs.mysql.com/bug.php?id=10327
如果在一个存储函数里,你用不同的别名查找一个临时表多次,或者在这个存储函数里用不同的语句查找,这个错误都会发生。
4、show tables 语句不会列举临时表
你不能用rename来重命名一个临时表。但是,你可以alter table代替:

mysql>ALTER TABLE orig_name RENAME new_name;

临时表用完后要记得drop掉:

DROP TEMPORARY TABLE IF EXISTS sp_output_tmp;

bitsCN.com

文档

mysql临时表cann'treopen解决方案_MySQL

mysql临时表cann'treopen解决方案_MySQL:bitsCN.com 当你创建临时表的时候,你可以使用temporary关键字。如: create temporary table tmp_table(name varchar(10) not null,passwd char(6) not null); 或 create temporary table if not exists
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top