gpt4 book ai didi

java - Oracle EBS 种子 APi 调用 java.sql.SQLException : Non supported SQL92 token at position: 6

转载 作者:太空宇宙 更新时间:2023-11-04 09:48:21 26 4
gpt4 key购买 nike

我正在尝试从java数据库调用中调用orcale EBS API hr_person_address_api.create_person_address,但收到此错误 线程“main”java.sql.SQLException 中出现异常:位置不支持 SQL92 标记:6 在 oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:1275) 在 oracle.jdbc.driver.OracleSql.parse (OracleSql.java:1161) 在 oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:328) 在 oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:630) 在 oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205) 在 oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043) 在 oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336) 在 oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613) 在 oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3714) 在 oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755) 在 oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378) 在workdaytooracleebsapipoc.hrPersonCall.main(hrPersonCall.java:108)

Can anyone help me with this.
PACAKAGE API DETAILS:
hr_person_address_api.create_person_address( P_VALIDATE IN BOOLEAN := FALSE,
P_EFFECTIVE_DATE IN DATE,
P_PRADD_OVLAPVAL_OVERRIDE IN BOOLEAN := FALSE,
P_VALIDATE_COUNTY IN BOOLEAN := TRUE,
P_PERSON_ID IN NUMBER := NULL,
P_PRIMARY_FLAG IN VARCHAR2,
P_STYLE IN VARCHAR2,
P_DATE_FROM IN DATE,
P_DATE_TO IN DATE := NULL,
P_ADDRESS_TYPE IN VARCHAR2 := NULL,
P_COMMENTS IN LONG := NULL,
P_ADDRESS_LINE1 IN VARCHAR2 := NULL,
P_ADDRESS_LINE2 IN VARCHAR2 := NULL,
P_ADDRESS_LINE3 IN VARCHAR2 := NULL,
P_TOWN_OR_CITY IN VARCHAR2 := NULL,
P_REGION_1 IN VARCHAR2 := NULL,
P_REGION_2 IN VARCHAR2 := NULL,
P_REGION_3 IN VARCHAR2 := NULL,
P_POSTAL_CODE IN VARCHAR2 := NULL,
P_COUNTRY IN VARCHAR2 := NULL,
P_TELEPHONE_NUMBER_1 IN VARCHAR2 := NULL,
P_TELEPHONE_NUMBER_2 IN VARCHAR2 := NULL,
P_TELEPHONE_NUMBER_3 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE_CATEGORY IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE1 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE2 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE3 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE4 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE5 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE6 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE7 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE8 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE9 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE10 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE11 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE12 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE13 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE14 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE15 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE16 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE17 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE18 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE19 IN VARCHAR2 := NULL,
P_ADDR_ATTRIBUTE20 IN VARCHAR2 := NULL,
P_ADD_INFORMATION13 IN VARCHAR2 := NULL,
P_ADD_INFORMATION14 IN VARCHAR2 := NULL,
P_ADD_INFORMATION15 IN VARCHAR2 := NULL,
P_ADD_INFORMATION16 IN VARCHAR2 := NULL,
P_ADD_INFORMATION17 IN VARCHAR2 := NULL,
P_ADD_INFORMATION18 IN VARCHAR2 := NULL,
P_ADD_INFORMATION19 IN VARCHAR2 := NULL,
P_ADD_INFORMATION20 IN VARCHAR2 := NULL,
P_PARTY_ID IN NUMBER := NULL,
P_ADDRESS_ID OUT NUMBER,
P_OBJECT_VERSION_NUMBER OUT NUMBER
);


Java Code
String procedure ="call{ hr_person_address_api.create_person_address(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?); }";

System.out.println(procedure);
//String procedure = "{begin call hr_person_address_api.create_person_address(false,'12-MAR-19',false,true,126444,'Y','US','12-MAR-19',null,'PHCA',null,'10330 Legacy Hill',null,null,'San Antonio','Bexar','TX',null,78240,'US',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,p_address_id,p_object_version_number); ";
CallableStatement hr_person_address_apiCreate_person_address = conn.prepareCall(procedure);



// CallableStatement hr_person_address_apiCreate_person_address = conn.prepareCall (procedure);

System.out.println(hr_person_address_apiCreate_person_address.toString());

/*
* Register IN Parameters
*/
System.out.println(new java.sql.Date(new java.util.Date().getDate()));
System.out.println(new java.sql.Date(new java.util.Date().getTime()));
hr_person_address_apiCreate_person_address.setObject("p_validate", false);
hr_person_address_apiCreate_person_address.setDate("p_effective_date",new java.sql.Date(new java.util.Date().getTime())); //
//hr_person_address_apiCreate_person_address.setObject("p_effective_date", sqlDate);
hr_person_address_apiCreate_person_address.setObject( "p_pradd_ovlapval_override", false);
hr_person_address_apiCreate_person_address.setObject("p_validate_county", true);
hr_person_address_apiCreate_person_address.setObject("p_person_id",new BigDecimal(1222301));
hr_person_address_apiCreate_person_address.setObject("p_primary_flag", "Y");
hr_person_address_apiCreate_person_address.setObject("p_style", "Indai");
hr_person_address_apiCreate_person_address.setDate("p_date_from",new java.sql.Date(new java.util.Date().getTime())); //
// hr_person_address_apiCreate_person_address.setObject("p_date_from",sqlDate);
hr_person_address_apiCreate_person_address.setObject("p_date_to",null);
hr_person_address_apiCreate_person_address.setObject("p_address_type", "sss");
hr_person_address_apiCreate_person_address.setObject("p_comments", null);
hr_person_address_apiCreate_person_address.setObject("p_address_line1", "sss");
hr_person_address_apiCreate_person_address.setObject("p_address_line2", null);
hr_person_address_apiCreate_person_address.setObject("p_address_line3", null);
hr_person_address_apiCreate_person_address.setObject("p_town_or_city", "");
rex hr_person_address_apiCreate_person_address.setObject("p_region_1", "ss");
hr_person_address_apiCreate_person_address.setObject("p_region_2", null);
hr_person_address_apiCreate_person_address.setObject("p_region_3", null);
hr_person_address_apiCreate_person_address.setObject("p_postal_code","33333");
hr_person_address_apiCreate_person_address.setObject("p_country", "Indai");
hr_person_address_apiCreate_person_address.setObject("p_telephone_number_1", null);
hr_person_address_apiCreate_person_address.setObject("p_telephone_number_2",null);
hr_person_address_apiCreate_person_address.setObject("p_telephone_number_3", null);
hr_person_address_apiCreate_person_address.setObject( "p_addr_attribute_category", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute1", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute2",null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute3", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute4",null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute5",null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute6", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute7",null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute8", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute9", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute10", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute11", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute12",null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute13", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute14", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute15", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute16", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute17", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute18", null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute19",null);
hr_person_address_apiCreate_person_address.setObject("p_addr_attribute20",null);
hr_person_address_apiCreate_person_address.setObject("p_add_information13", null);
hr_person_address_apiCreate_person_address.setObject("p_add_information14",null);
hr_person_address_apiCreate_person_address.setObject("p_add_information15", null);
hr_person_address_apiCreate_person_address.setObject("p_add_information16", null);
hr_person_address_apiCreate_person_address.setObject("p_add_information17", null);
hr_person_address_apiCreate_person_address.setObject("p_add_information18", null);
hr_person_address_apiCreate_person_address.setObject("p_add_information19", null);
hr_person_address_apiCreate_person_address.setObject("p_add_information20", null);
hr_person_address_apiCreate_person_address.setObject("p_party_id",null);
/*
Register OUT Parameters
*/
hr_person_address_apiCreate_person_address.registerOutParameter( "p_address_id", java.sql.Types.NUMERIC);
hr_person_address_apiCreate_person_address.registerOutParameter( "p_object_version_number", java.sql.Types.NUMERIC);
Boolean b=hr_person_address_apiCreate_person_address.execute();
System.out.println(b);

arrayList.add(hr_person_address_apiCreate_person_address.getInt(54));
arrayList.add(hr_person_address_apiCreate_person_address.getInt(55));


hr_person_address_apiCreate_person_address.close();

最佳答案

这可能是过时的信息,但我最后知道,Oracle 的 JDBC 驱动程序不支持将 Boolean 类型传递给 PL/SQL 过程或函数。

您需要创建一个带有如下签名的包装程序:

xxcust_person_address_api.create_person_address_wrapper 
( --P_VALIDATE IN BOOLEAN := FALSE,
P_VALIDATE IN VARCHAR2 := 'N',
P_EFFECTIVE_DATE IN DATE,
--P_PRADD_OVLAPVAL_OVERRIDE IN BOOLEAN := FALSE,
P_PRADD_OVLAPVAL_OVERRIDE IN VARCHAR2 := 'N',
--P_VALIDATE_COUNTY IN BOOLEAN := TRUE,
P_VALIDATE_COUNTY IN VARCHAR2 := 'Y',
P_PERSON_ID IN NUMBER := NULL,
...

然后,在该包装器中,将必要的 VARCHAR2 输入转换为 BOOLEAN 并从包装器内调用 hr_person_address_api.create_person_address

此外,在您的 Java 代码中,更正如下行:

hr_person_address_apiCreate_person_address.setObject("p_address_line1", "sss");

...不要使用 setObject 来设置 VARCHAR2 参数的值,请使用 setString

与此类似:

hr_person_address_apiCreate_person_address.setObject("p_party_id",null);

...使用setNull代替。 (或者,如果您想将 p_party_id 设置为非空值,则可以使用 setLongsetBigDecimal)。

一般来说,不要使用 setObject ,除非您实际上传递的是非标量对象类型(即带有字段或数组的对象)。

最后一件事......我通常按位置传递识别参数。例如,

hr_person_address_apiCreate_person_address.setObject(5 ,new  BigDecimal(1222301));

而不是

hr_person_address_apiCreate_person_address.setObject("p_person_id",new  BigDecimal(1222301));

我不确定 JDBC 驱动程序是否足够智能,可以从 PL/SQL 函数读取参数名称,并将您按名称设置的值映射到函数中的正确参数。我不确定它是如何做到这一点的,因为它不知道期望的类型并且函数可能会被重载。如果仍然遇到问题,请按位置而不是按名称设置参数值。

关于java - Oracle EBS 种子 APi 调用 java.sql.SQLException : Non supported SQL92 token at position: 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55136998/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com