oracle record、rowtype示例
record示例:
create or replace procedure pro_test_record(vid in varchar2) is
type userRow is record(
id t_user.id%type,
name t_user.name%type
);
realRow userRow;
begin
select id,name into realRow from t_user where id=vid;
dbms_output.put_line(realRow.id||','||realRow.name);
end pro_test_record;
rowtype示例:
create or replace procedure pro_test_rowType(vid in varchar2) is
userRow t_user%Rowtype;
begin
select * into userRow from t_user where id=vid;
dbms_output.put_line(userRow.id||','||userRow.name);
end pro_test_rowType;
相关文档:
转自:http://wallimn.javaeye.com/blog/472182
对于SPOOL
数据的SQL,最好要自己定义格式,以方便程序直接导入,SQL语句
如:
select
taskindex||'|'||commonindex||'|'||tasktype||'|'||to_number(to_char(sysdate,'YYYYMMDD'))
from ssrv_sendsms_task;
spool
常用的设置
set colsep' '; //域输出分隔符 ......
每天1点执行的oracle JOB样例
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X,
what => 'ETL_RUN_D_Date;',
next_date => to_date('2009-08-26 01:00:00','yyyy-mm-dd hh24:mi:ss'),
interval => 'trunc(sysdate)+1+1/24',
no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number ......
dc-test2<oracle>sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Feb 25 19:23:35 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> desc v$datafile;
SP2-0640: Not connected
SP2-0641: "DESCRIBE" requires connection to server
SQL> conn / a ......
oracle数据库的导入与导出是做为一名实施工程师或维护工程师每经常要做的工作。当数据库结构需要做变化的时候,我们一般先将数据做备份,此时我们需要使用到Oracle的导出功能。当我们在做导入的时候出错或者我们的数据遭到错误删除的时候,我们需要恢复数据库,那我们需要使用到导入的功能。现在也有很多功能能够帮我们做到 ......
在做应用系统开发时,我们会遇到一个问题,就是我们应用系统有些数据需要从其他数据库的某一张表拿到数据,那我们应该怎么办?比如:子公司的销售系统需要从广州总部人力资源管理系统的数据库当中获取最新的用户信息,那我们应该怎么实现?实现现在的做法有很多,可以通过WebService方式获取,但开发成本还是比较高,假设 ......