Oracle自动生成编号的函数
来源:互联网 发布:asp工资管理系统源码 编辑:程序博客网 时间:2024/04/25 19:45
第一次用oracle 函数,跟sql有太多的不同,涉及的知识点还是很多 函数创建、类型转换、if else的用法、必须要传参数、字符型相加的特殊写法、substr函数的用法等等
CREATE or replace FUNCTION fun_DelegateNo(currentdate in date)
RETURN VARCHAR2 IS v_result VARCHAR2(50);
begin
select max(DELEGATENO) INTO v_result from EXPORTDELEGATE
-- rownum=1 ;to_number(substr(,5,12))'yymmdd hh24:mi:ss'
where CreateTime
between to_date(to_char(currentdate,'yyyyMMdd')||' 00:00:00','yymmdd hh24:mi:ss') and
to_date(to_char(currentdate,'yyyyMMdd')||' 23:59:59','yymmdd hh24:mi:ss');
if v_result is null
then
v_result:= 'FLEC'||to_char(currentdate,'yyyyMMdd')||'0001';
else
v_result:= 'FLEC'|| to_char(currentdate,'yyyyMMdd')||substr(('000'||to_char(to_number(substr(v_result,-4,4))+1)),-4,4);
end if;
RETURN v_result;
end;
- Oracle自动生成编号的函数
- 关于生成oracle自动编号的浅析
- sql 自动生成编号函数
- sql server 按照日期自动生成单据编号的函数
- 自动生成编号的方法
- ORACLE存储过程自动生成编号
- 自动生成人才编号的存储过程
- 自动生成16位的单据编号
- ASP自动生成编号的方法
- Flex的DataGrid自动生成编号
- SQL生成按月的自动编号
- sql获取自动生成的ID编号
- LightSwitch中自动编号的生成
- 自动生成编号
- 自动生成编号
- 自动生成编号
- dbgrid自动生成编号
- 自动生成字母编号
- WARNING: gnome-keyring:: couldn't connect to
- PHP实践之路(三)PHP初探数据类型
- [Paper Study] Polychronization: Computation with Spikes
- 装饰者模式
- 50幅惊艳的分形艺术作品
- Oracle自动生成编号的函数
- 工厂方法模式
- Servlet重构
- 苹果脚本-How to send a message using iChat and AppleScript
- [Code] Polychronization and resonance occur in 5-neuron-SNN
- 一个简易的WebServer程序
- 内存管理之虚拟内存篇
- Oracle 索引介绍
- 64bit服务器上运行32bit DLL文件报错的解决办法