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') 这样可解决大 ...
随机推荐
- 015_使用 expect 工具自动交互密码远程其他主机安装 httpd 软件
#!/bin/bash#删除~/.ssh/known_hosts 后,ssh 远程任何主机都会询问是否确认要连接该主机rm -rf ~/.ssh/known_hostsexpect <<E ...
- [Luogu] 最大收益
题面:https://www.luogu.org/problemnew/show/P2647 题解:https://www.zybuluo.com/wsndy-xx/note/1142685
- CSP-S 模拟测试92 题解
话说我怎么觉得我没咕多长时间啊,怎么就又落了20多场题解啊 T1 array: 根据题意不难列出二元一次方程,于是可以用exgcd求解,然而还有一个限制条件就是$abs(x)+abs(y)$最小,这好 ...
- sync、fsync和fdatasync
转自 http://blog.csdn.net/todd911/article/details/11701847 传统的UNIX实现在内核中设有缓冲区高速缓存或页面高速缓存,大多数磁盘 I/O都通过缓 ...
- 转义字符\'和\"的使用示例
/* 转义字符\'和\"的使用示例 */ #include <stdio.h> int main(void) { printf("关于字符串常量和字符常量.\n&quo ...
- Golang 二维切片初始化
package main import "fmt" func main() { // 方法0 row, column := 3, 4 var answer [][]int for ...
- nginx使用certbot配置https
一般现在的网站都要支持https,即安全的http. 机器:阿里云Ubuntu 16.04.3 LTS 方案一:自己申请证书 配置时需要确保有ssl模块, 之后域名解析下, 之后时申请证书,可以去阿里 ...
- java递归复制文件夹
package com.haiyisoft.hyoaService; import java.io.BufferedInputStream;import java.io.BufferedOutputS ...
- Python: 根据利润计算奖金
简述:企业发放的奖金根据利润提成.利润(I)低于或等于10万元时,奖金可提10%: 利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%: 20万到40 ...
- 一个很好的开源视频播放器GiraffePlayer2(支持rtmp,rtsp,http,https)
一个很好的开源视频播放器GiraffePlayer2(支持rtmp,rtsp,http,https) https://github.com/tcking/GiraffePlayer2 GiraffeP ...