Oracle 自定义函数
来源:互联网 发布:阿里云mx记录值 编辑:程序博客网 时间:2024/05/16 04:31
create or replace function ipmsdw.fun_dw_o_max_stat_time(v_dw_table_name in varchar2) return varchar2 is o_table_max_time_record varchar2(32767); TYPE ref_cursor_type IS REF CURSOR; --定义动态游标 v_o_table_name ipmsdw.dw_o_relation.o_table_name%type; v_sql varchar(1000); v_max_stat_time date; v_str varchar(1000); cur_o_tables ref_cursor_type;begin v_sql := 'select o_table_name from dw_o_relation where dw_table_name= ''' || v_dw_table_name || ''''; --拼接sql open cur_o_tables for v_sql; --打开游标 loop fetch cur_o_tables into v_o_table_name; exit when cur_o_tables%notfound; v_sql := ' select max(stat_time) from ' || v_o_table_name; -- execute immediate v_sql into v_max_stat_time; v_str := to_char(sysdate, 'yyyy-mm-dd hh24:mm:ss') || ' ' || v_o_table_name || ' ' || v_max_stat_time || chr(13)||chr(10); o_table_max_time_record := o_table_max_time_record || v_str; dbms_output.put_line(v_str); end loop; close cur_o_tables; return o_table_max_time_record; --返回值exception --异常处理 when too_many_rows then dbms_output.put_line('返回记录超过一行'); close cur_o_tables; when no_data_found then dbms_output.put_line('无数据记录'); close cur_o_tables; end;
参考链接:https://www.cnblogs.com/superjt/p/4274329.html
参考链接:http://www.cnblogs.com/defias/p/3334098.html#tip2.4.2.3
阅读全文
0 0
- oracle用户自定义函数
- oracle用户自定义函数
- ORACLE自定义合计函数
- Oracle自定义聚集函数
- oracle 自定义函数
- oracle自定义函数
- oracle自定义函数
- Oracle自定义聚集函数
- oracle自定义聚合函数
- Oracle之自定义函数
- Oracle自定义聚集函数
- Oracle自定义函数
- oracle 自定义函数实例
- Oracle 自定义Java函数
- Oracle 自定义函数Function
- Oracle自定义函数
- oracle自定义函数积累
- oracle 自定义函数入门
- 深度学习5:python实现三层神经网络
- Android Studio生成签名文件AND用正式签名进行调试
- HDU
- JS操作cookie的方法
- VMware安装centos虚拟机 通过NAT与主机互通并能上网
- Oracle 自定义函数
- PHP超级全局变量的完整列表
- Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVers
- Qt对象模型
- 最能激怒程序员的十句话
- Shell输出重定向:> 2>&1
- websocket 简介
- Mybatis进阶用法详解
- 小小总结