编写用于选择和插入的单个存储过程 [英] write single stored procedure for select and insert

查看:111
本文介绍了编写用于选择和插入的单个存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的项目中,我需要一个过程,即首先选择一行并将该行插入到该表中,该如何编写单个存储过程来做到这一点.
例如:从emp中选择eno,ename,sal
插入emp(eno,ename,sal)值(在此处插入上面选定的emp值)
请提供示例代码.
谢谢.


in my project i need one procedure i.e., first i select one row and that row is inserted into that table, how to write single stored procedure todo this.
ex: select eno,ename,sal from emp
insert into emp (eno,ename,sal) values (here we insert above selected emp values)
please give example code.
Thanks.

推荐答案

这有点不寻常.它不会在表中创建重复记录吗? :sigh:

顺便说一句,您可以使用此查询:
Its a bit unusual requirement. Won''t it create duplicate records in table? :sigh:

BTW, you can use this query :
insert into emp(eno,ename,sal)
select eno,ename,sal from emp where "some_condition"


这篇关于编写用于选择和插入的单个存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆