oracle-function-into时为null报错
oracle-function-into时为null报错
create or replace function P_ADD_CUSTOMER_FOR_CSS_heyt_test(i_cust_name in varchar2,
i_en_name in varchar2,
i_cust_sex in varchar2,
i_cust_birthday in date,
i_cust_id_type in varchar2,
i_cust_id_no in varchar2,
i_data_quality_level in char,
i_death_date in date,
i_part_code in varchar2,
i_risk_level_time in date,
i_risk_level in varchar2,
i_risk_level_reason in varchar2,
i_risk_level_user in varchar2,
i_address in varchar2,
i_postcode in varchar2,
i_landline_phone in varchar2,
i_mobile in varchar2,
i_email in varchar2,
i_papers_effect_date in date,
i_papers_matu_date in date,
i_occupation_grade in varchar2,
i_occupation_code in varchar2,
i_nationality in varchar2,
i_sys_source in varchar2,
i_cif_cust_no in varchar2,
i_oper in varchar2,
i_remark in varchar2)
return varchar2 is
tInsuredNo varchar2(20);
tInsuredNo_temp varchar2(20);
i_cust_id_type_temp varchar2(20);
i_cust_sex_temp varchar2(5); --pragma autonomous_transaction;
--tInsuredNo ldperson.customerno%type;
begin
DBMS_OUTPUT.put_line('sql:'||'查询客户号开始');
begin
DBMS_OUTPUT.put_line('sql:'||i_cust_id_no);
DBMS_OUTPUT.put_line('sql:'||i_cust_name);
DBMS_OUTPUT.put_line('sql:'||i_cust_id_type);
DBMS_OUTPUT.put_line('sql:'||i_cust_id_no);
DBMS_OUTPUT.put_line('sql:'||i_cust_birthday);
DBMS_OUTPUT.put_line('sql:'||i_cust_sex);
Execute Immediate 'ALTER SESSION SET NLS_DATE_FORMAT = ''YYYY-MM-DD HH24:MI:SS'''; select count(1)
into tInsuredNo_temp
from ldperson_heyt_test t
where t.customername = i_cust_name
and t.idtype = decode(i_cust_id_type,'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',i_cust_id_type)
and UPPER(t.idno) = UPPER(i_cust_id_no)
and t.birthday = i_cust_birthday
and t.gender = decode(i_cust_sex,'','','','','','','')
and rownum = 1; if tInsuredNo_temp != 0 then
select t.customerno
into tInsuredNo
from ldperson_heyt_test t
where t.customername = i_cust_name
and t.idtype = decode(i_cust_id_type,'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',i_cust_id_type)
and UPPER(t.idno) = UPPER(i_cust_id_no)
and t.birthday = i_cust_birthday
and t.gender = decode(i_cust_sex,'','','','','','','')
and rownum = 1;
return tInsuredNo;
end if;
DBMS_OUTPUT.put_line('sql:'||'查询客户号结束'); --如果客户号存不存在即需要生成客户号,添加客户地址两张表
if tInsuredNo_temp = 0 Then
DBMS_OUTPUT.put_line('sql:'||'查询客户号未找到,需要生成');
Execute Immediate 'ALTER SESSION SET NLS_DATE_FORMAT = ''YYYY-MM-DD HH24:MI:SS'''; select decode(i_cust_id_type,'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',i_cust_id_type) into i_cust_id_type_temp from dual;
select decode(i_cust_sex,'','','','','','','') into i_cust_sex_temp from dual; --调用生成规则
tInsuredNo := 'CP' || lpad(createmaxno('CUSTOMERNO', 'SN'), 18, '');
DBMS_OUTPUT.put_line('sql:'||'客户号已生成'); Execute Immediate 'insert into ldperson (CustomerNo, CustomerName, Gender, Birthday, IDType, IDNo, IDInitiateDate, IDExpiryDate, Nationality, OccupationType, OccupationCode, DeathDate, NameEn, Remark, managecom, comcode, makeoperator, makedate, maketime, modifyoperator, modifydate, modifytime) Values
('''||tInsuredNo||''','''||i_cust_name||''','''||i_cust_sex_temp||''','''||i_cust_birthday||''','''||i_cust_id_type_temp||''','''||i_cust_id_no||''','''||i_papers_effect_date||''','''||i_papers_matu_date||''','''||i_nationality||''','''||i_occupation_grade||''','''||i_occupation_code||''','''||i_death_date||''','''||i_en_name||''','''||i_remark||''','''||''||''','''||''||''','''||i_oper||''','''||sysdate||''','''||'00:00:00'||''','''||i_oper||''','''||sysdate||''','''||'00:00:00'||''')';
DBMS_OUTPUT.put_line('sql:'||'添加客户完成'); Execute Immediate 'insert into ldpersoncontactinfo (CustomerNo,PostalAddress,ZipCode,Phone,Mobile1,EMail1, makeoperator, makedate, maketime, modifyoperator, modifydate, modifytime)values ('''||tInsuredNo||''','''||i_address||''','''||i_postcode||''','''||i_landline_phone||''','''||i_mobile||''','''||i_email||''','''||i_oper||''','''||sysdate||''','''||'00:00:00'||''','''||i_oper||''','''||sysdate||''','''||'00:00:00'||''')';
DBMS_OUTPUT.put_line('sql:'||'添加地址完成'); Execute Immediate 'commit';
elsif tInsuredNo IS not null then
return(tInsuredNo);
End If;
return(tInsuredNo);
end;
Exception When Others Then
dbms_output.put_line('sqlcode:'||sqlcode);
DBMS_OUTPUT.put_line('sqlerrm:'||substr(sqlerrm,1,100));
Execute Immediate 'rollback';
return(tInsuredNo);
end P_ADD_CUSTOMER_FOR_CSS_heyt_test;
/
oracle-function-into时为null报错的更多相关文章
- 数据库 插入时 碰到NULL报错判断的一种方法(技巧)
//public static object ToDBNull(object value) 判断插入数据的时候个别参数不能为空的时候做的判断方法 //{ // if (value == null) / ...
- 连接远程MySQL数据库项目启动时,不报错但是卡住不继续启动的,
连接远程MySQL数据库项目启动时,不报错但是卡住不继续启动的, 2018-03-12 17:08:52.532DEBUG[localhost-startStop-1]o.s.beans.factor ...
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:4.安装Oracle RAC FAQ-4.1.系统界面报错Gnome
1.错误信息:登录系统后,屏幕弹出几个错误对话框,无菜单.无按钮 GConf error: Failed to contact configuration server; some possible ...
- soamanager发布的Webservice服务,调用时出现http500报错
最近再给薪酬那边发布ws服务时出现了报错,调用方反馈了errorCode:BEA-380002.在使用XMLspy工具去调用这个WSDL时候,则反馈http500的错误消息.如下图: 遇到这种问题我通 ...
- 当子查询内存在ORDER BY 字句时查询会报错
问题:当子查询内存在ORDER BY 字句时查询会报错 SQL: SELECT * FROM ( SELECT * FROM USER ORDER BY USER_CORD ) S. 解决办法:在子查 ...
- 关于使用CodeFirst,修改类或上下文时操作数据库报错解决方法
在操作已经创建好的数据库时,若是添加新的实体类或者修改原有数据库上下文,会报如下错误: The model backing the 'StudentDbContext' context has cha ...
- nuget包管理nuget服务器发布包时出现请求报错 406 (Not Acceptable)
在window服务器上部署nuget服务器时,发布包时出现请求报错 406 (Not Acceptable) 验证用户名.密码正确的情况下,还是出现上面错误.后面跟踪服务器日志,发现window\te ...
- Jenkins安装时Web页面报错提示离线安装
先跳过所有. 方法1 先看它的提示:”参考离线Jenkins安装文档“发现链接点不开,我还以为是被墙了呢,FQ以后还是打不开.看来这个参考文档是没有用滴.点击配置HTTP代理跳出如下界面:安装Jenk ...
- python3写入文件时编码问题报错
在字符串写入文件时,有时会因编码问题导致无法写入,可在open方法中指定encoding参数 chfile = open(filename, 'w', encoding='utf-8') 这样可解决大 ...
随机推荐
- Shell 01 shell概述
1.查看shells:/etc/shells /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/nologin / ...
- windows游戏编程X86 32位保护模式下的内存管理概述(一)
本系列文章由jadeshu编写,转载请注明出处.http://blog.csdn.net/jadeshu/article/details/22445945 作者:jadeshu 邮箱: jades ...
- Linux 修改文件夹的用户组权限
将ubsadm文件夹所属用户修改为userschown -R ubsadm:users /home/ubsadm 此命令将用户123的用户组改为rootusermod -g 123 root
- 未能加载文件或程序集“Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral, PublicKeyToken...
刚开始看老师 用VS新建一个“ADO.NET 实体数据模型” 但是一直报错:未能加载文件或程序集“Microsoft.SqlServer.Management.Sdk.Sfc, Version=11. ...
- 2-SAT两题
看了大白书,学习了一下two-sat,很有意思的算法.题目就是大白书上的两题. 仅仅放一下代码作为以后的模板参考. #include <stdio.h> #include <algo ...
- Ubuntu14.04-OpenCV2和3共存相关设置
文章转自:http://blog.csdn.net/a356337092/article/details/73529635 安装依赖项: sudo apt-get install build-esse ...
- centos7中oracle数据库安装和卸载
参考: 完全命令行安装(验证可行):https://jingyan.baidu.com/article/90895e0f29c92164ec6b0bd1.html 存在疑问:是否需要jdk的配置(因为 ...
- cxf报错 Cannot find any registered HttpDestinationFactory from the Bus.
错误信息:Cannot find any registered HttpDestinationFactory from the Bus. 报错主要是因为缺少jetty依赖 一般添加如下依赖即可 < ...
- RISC-V riscv64-unknown-elf
riscv64-unknown-elf 为 RISC-V指令集的交叉编译工具 以下环境在Liunx ubuntu x86_64 环境下进行,下面示例以生成32位文件为目标来操作使用. screen / ...
- SPSS python教程:[1]安装Python Essentials
python机器学习-乳腺癌细胞挖掘(博主亲自录制视频)https://study.163.com/course/introduction.htm?courseId=1005269003&ut ...