因此,im在将数据库从Oracle迁移到PGSql项目中,现在im修复了一些查询.我有一个这样的错误:
Caused by: org.postgresql.util.PSQLException: ERROR: function nvl(timestamp without time zone, timestamp with time zone) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
并且我在这个字符串生成器上发现了来自控制台的nvl错误
public List<InsEmployeeInfoVo> load(int first, int pageSize,
String sortField, SortOrder sortOrder, SearchFilter searchFilter) {
SQLQuery query = null;
try {
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.append(" select ");
sqlQuery.append(" pts.PERSON_TRAN_SING_ID, ");
sqlQuery.append(" ext.INTERNALID PERSON_EXT_ID, ");
sqlQuery.append(" people.internalid PERSON_ID, ");
sqlQuery.append(" people.EMPLOYEE_NUMBER NIK, ");
sqlQuery.append(" people.PER_INFORMATION1 PERSON_NAME, ");
sqlQuery.append(" case ");
sqlQuery.append(" when pts.INS_MEMBER_NO is not null ");
sqlQuery.append(" then pts.INS_MEMBER_NO ");
sqlQuery.append(" else ext.INS_MEMBER_NO ");
sqlQuery.append(" end INS_MEMBER_NO, ");
sqlQuery.append(" case ");
sqlQuery.append(" when pts.INS_TOTAL_COVER is not null ");
sqlQuery.append(" then pts.INS_TOTAL_COVER ");
sqlQuery.append(" else ext.INS_TOTAL_COVER ");
sqlQuery.append(" end INS_TOTAL_COVER, ");
sqlQuery.append(" null INS_PLAN_NAME, ");
sqlQuery.append(" case ");
sqlQuery.append(" when pts.INS_BH_CARD_NO is not null ");
sqlQuery.append(" then pts.INS_BH_CARD_NO ");
sqlQuery.append(" else ext.INS_BH_CARD_NO ");
sqlQuery.append(" end INS_BH_CARD_NO, ");
sqlQuery.append(" case ");
sqlQuery.append(" when pts.INS_BH_TOTAL_COVER is not null ");
sqlQuery.append(" then pts.INS_BH_TOTAL_COVER ");
sqlQuery.append(" else ext.INS_BH_TOTAL_COVER ");
sqlQuery.append(" end INS_BH_TOTAL_COVER, ");
sqlQuery.append(" null INS_BH_PLAN_NAME, ");
sqlQuery.append(" pts.PROCESS_STATUS PROCESS_STATUS, ");
sqlQuery.append(" BTPN_INS_F_GET_CHECKER (people.internalid,:singSourceType,1) PROCESS_STATUS_NAME, ");
sqlQuery.append(" pts2.PERSON_TRAN_SING_ID PERSON_TRAN_SING_ID_2, ");
sqlQuery.append(" pts2.PROCESS_STATUS PROCESS_STATUS_2, ");
sqlQuery.append(" upl.PERSON_DATA_UPL_DTL_ID, ");
sqlQuery.append(" upl.PROCESS_STATUS PROCESS_STATUS_UPLOAD, ");
sqlQuery.append(" NVL(pts.UPDATE_ON, pts.CREATE_ON) INPUT_DATE, ");
sqlQuery.append(" BTPN_INS_F_GET_CHECKER (people.internalid,:singSourceType,2) NOTE_APPROVE, pts.NOTE ");
sqlQuery.append(" from WOT_PEOPLE people ");
sqlQuery.append(" inner join WOT_ASSIGNMENT assign ");
sqlQuery.append(" on assign.PERSON_ID = people.internalid ");
sqlQuery.append(" and assign.PRIMARY_FLAG = 'Y' ");
sqlQuery.append(" and (date_trunc('day', now()) between assign.EFFECTIVE_START_DATE and assign.EFFECTIVE_END_DATE) ");
sqlQuery.append(" left join BTPN_INS_PEOPLE_EXT ext ");
sqlQuery.append(" on ext.PERSON_ID = people.internalid ");
sqlQuery.append(" and date_trunc('day', now()) between ext.EFFECTIVE_START_DATE and NVL(ext.EFFECTIVE_END_DATE, now()) ");
您可以尝试使用PostgreSQLCOALESCE
函数(请参见9.17.2.COALESCE部分),而不是oracleNVL
函数。
这里是上面代码的错误-> 没有与给定的名称和参数类型匹配的函数。您可能需要添加显式类型转换。
我使用DBEaver在PostgreSQL中创建了一个存储过程。我正试图通过从DBeaver调用过程将数据插入到表中。但这给了我一个错误 SQL错误[42883]:错误:函数public.proc_insert_test(integer,unknown,unknown,unknown,unknown,unknown,timestamp with time zone,integer,integer,
我在PostgreSQL中有一个存储过程,如下所示: 我的数据库中有带精度值的类型。对于numeric,我只需要使用。这条路对吗?
代码中的以下语句给了我一个错误: 是Postgres中的用户定义聚合函数,定义为: 错误消息为:
但这段代码有一个错误: 错误:函数log(数值,双精度)不存在行1:select log(2.7,c) 提示:没有函数与给定的名称和参数类型匹配。您可能需要添加显式类型转换。 查询:select log(2.7,c)context:pl/pgsql function inline_code_block line 11 at SQL语句SQL state:42883
我使用NPGSQLADO.net连接器从C#代码与postgresql通信。 函数在postgresql数据库中可用,我也可以从pgadmin工具执行它,但无法从c#code调用它。 获取错误 42883:函数public.insert_json_array_to_test_method_temp(p_input_test_name= 错误提示-没有与给定名称和参数类型匹配的函数。您可能需要添加显