oracle与sqlserver插入数据动态字段值
记录一下以备下次快速找到。。。
往tb_wf_privgrant表中插入一条记录,workflow_id字段值从tb_wf_workflow 表中获取workflow_name='知识审核'的所有记录中workflow_id最大值。
--oracle
declare a NUMBER(10);
begin
select max(workflow_id) into a from tb_wf_workflow where workflow_name='知识审核';
insert into tb_wf_privgrant(grant_Id,workflow_id,member_id,member_type,knowledge_code) values (HIBERNATE_SEQUENCE.NEXTVAL, a,'r001','R','6001');
end;
--sqlserver
--方法一
insert into tb_wf_privgrant(workflow_id,member_id,member_type,knowledge_code)
select max(workflow_id),'r001','R','6001' from tb_wf_workflow where workflow_name='知识审核'
--方法二
declare @a numeric(10,0)
select @a = max(workflow_id) from tb_wf_workflow where workflow_name='知识审核'
insert into tb_wf_privgrant(workflow_id,member_id,member_type,knowledge_code)
values (@a,'r001','R','6001')
相关文档:
什么是合并多行字符串(连接字符串)呢,例如:
SQL> desc test;
Name Type Nullable Default Comments
------- ------------ -------- ------- --------
COUNTRY VARCHAR2(20) Y &nb ......
Exam Number/Code : 1z0-047
Exam Name : Oracle Database SQL Expert
Questions and Answers : 278 Q&As
Update Time: 2010-04-15
1. Which two statements are true regarding the execution of the correlated subqueries? (Choose two.)
A. The nested query executes after the outer query returns th ......
1.创建表:
a. 创建xs表中计算机专业学生的备份
Create table xs_jsj as select * from xs where zym=’计算机’;
b.完整的例子:
Create table test ......
如果web方式的em,isqlplus访问不了。
1. 检查主机名/IP、端口是否正确
安装时的主机名/IP、端口记录在$ORACLE_HOME/install/portlist.ini 文件中。
缺省是:
一般用户
http://ip:5560/isq ......