- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在提出这个问题之前,我已经用谷歌搜索了一段时间,但是现在找到了结果。我的代码尝试调用oracle包中的过程(我对oracle包不太熟悉),并且总是得到“ORA-03115:不支持的网络数据类型或表示法”,英文应该是“不支持的网络数据类型或表示法”。
下面是我的包装:
create or replace
PACKAGE PKG_ACTIVITY_REPORT
IS
TYPE activity_report_item_type IS RECORD
( emp_id MERCHANT.merchant_id%TYPE,
emp_name MERCHANT.MERCHANT_NAME%TYPE,
emp_gender MERCHANT.MERCHANT_CODE%TYPE );
TYPE activity_report_items_type IS TABLE OF activity_report_item_type INDEX BY BINARY_INTEGER;
-- Procedure to retrive the activity report of given operator
PROCEDURE enquiry_activity_report(activity_report_items OUT activity_report_items_type);
END PKG_ACTIVITY_REPORT;
create or replace
PACKAGE BODY PKG_ACTIVITY_REPORT
IS
PROCEDURE enquiry_activity_report (activity_report_items OUT activity_report_items_type)
IS
activity_report_item activity_report_item_type;
BEGIN
activity_report_item.emp_id := 300000000;
activity_report_item.emp_name := 'Barbara';
activity_report_item.emp_gender := 'Female';
activity_report_items(1) := activity_report_item;
activity_report_item.emp_id := 300000008;
activity_report_item.emp_name := 'Rick';
activity_report_item.emp_gender := 'Male';
activity_report_items(2) := activity_report_item;
FOR i IN 1..activity_report_items.count LOOP
DBMS_OUTPUT.PUT_LINE('i='||i||', emp_id ='||activity_report_items(i).emp_id||', emp_name ='
||activity_report_items(i).emp_name||', emp_gender = '||activity_report_items(i).emp_gender);
END LOOP;
END enquiry_activity_report;
END PKG_ACTIVITY_REPORT;
我想从该过程返回一个数组,并从 java 调用该过程:
conn = ds.getConnection();
String storedProc = "{call pkg_activity_report.enquiry_activity_report(?)}";
CallableStatement cs = conn.prepareCall(storedProc);
// register output parameter
cs.registerOutParameter(1, java.sql.Types.ARRAY);
cs.execute();
Array array = cs.getArray(1);
System.out.println(array);
cs.close();
运行时抛出异常。如何将 OUT 参数映射到 java 类型?请帮忙。
注意:当从 oracle sqldeveloper 运行此过程时,它可以正常工作。
DECLARE
ACTIVITY_REPORT_ITEMS RAMON.PKG_ACTIVITY_REPORT.ACTIVITY_REPORT_ITEMS_TYPE;
BEGIN
PKG_ACTIVITY_REPORT.ENQUIRY_ACTIVITY_REPORT(
ACTIVITY_REPORT_ITEMS => ACTIVITY_REPORT_ITEMS
);
END;
DBMS输出结果:
i=1, emp_id =300000000, emp_name =Barbara, emp_gender = Female
i=2, emp_id =300000008, emp_name =Rick, emp_gender = Male
最佳答案
现在我创建了 2 个架构级别类型:
CREATE OR REPLACE TYPE activity_report_item_type AS OBJECT(
emp_id NUMBER,
emp_name VARCHAR2(30),
emp_gender VARCHAR2(30)
);
CREATE OR REPLACE TYPE activity_report_items_type AS TABLE OF activity_report_item_type;
并将PROCEDURE enquiry_activity_report移出包,独立制作,然后从java中成功调用它。
conn = ds.getConnection();
String storedProc = "{call enquiry_activity_report(?)}";
CallableStatement cs = conn.prepareCall(storedProc);
// register output parameter
cs.registerOutParameter(1, OracleTypes.ARRAY, "ACTIVITY_REPORT_ITEMS_TYPE");
cs.execute();
Array array = cs.getArray(1);
ResultSet rs = array.getResultSet();
while (rs.next()) {
// why getObject(2) instead of getObject(1)?
Object elements[] = ((STRUCT) rs.getObject(2)).getAttributes();
System.out.println(elements[0]);
System.out.println(elements[1]);
System.out.println(elements[2]);
}
cs.close();
如果我将类型声明和过程放在包中,java代码将抛出异常,通知“未找到“ACTIVITY_REPORT_ITEMS_TYPE”的类型定义”。
关于java - ORA-03115 : unsupported network data type or representation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17992583/
我有一个 Python 字典 dict。想象一下这个简单的例子。字典: bin1:{apple,apple,cherry,cherry,cherry,banana,banana,avocado} bi
我在Google上搜索了规范表示的含义,然后发现文件太含糊了。谁能提供规范表示的快速解释,以及网站中典型表示攻击的一些典型漏洞是什么? 最佳答案 规范化是您接受输入(例如文件名或字符串)并将其转换为标
本文整理了Java中org.restlet.representation.WriterRepresentation类的一些代码示例,展示了WriterRepresentation类的具体用法。这些代码
这个问题已经有答案了: How to convert number to words in java (32 个回答) 已关闭10 年前。 我有一个列表 Integer从 1 到 100。如果我循环遍
我正在使用 Coin-or Linear Programming图书馆。我想构建一个 ClpPlusMinusOneMatrix .它的构造函数是: ClpPlusMinusOneMatrix (in
免责声明:我完全知道表示日期/时间的最佳方式是 Unix 时间戳或 PHP 的 DateTime 类和 Oracle 的DATE 数据类型。 顺便说一句,我想知道最适合存储时间 数据的数据类型是什么(
我已经编写了我的代码,但就我个人所知,我想知道如何对其进行建模。 我们开始吧:一个用户可以拥有多个配置文件,每个配置文件都与一个且唯一的应用程序相关联。配置文件定义了用户在应用程序中的权限:同一用户可
我想了解 Representable 的含义在 Haskell 中代表。定义 Representable endofunctors over the category of Haskell types
如何构建一个 API,其中相同的数据可以以不同的格式(RESTful 格式)请求。例如。 GET /person/ //get the details of resource 现在,根据客户端(浏
这是这个问题的更具体的变体:Mutate only focus of Store Comonad? ,这样做的好处是不要一次提出多个问题。 是否有兼容 Control.Lens 的镜头它允许我与 co
我一直在为 iOS 开发一个日历应用程序,这让我遇到了很多问题。 我正在使用本地通知进行提醒。存储事件日期、警报日期或其他内容的最佳方式是什么?我的意思是,问题是由时区差异等引起的。我将事件存储在核心
我正在构建一个网络 CMS,用户可以在其中为某些网站元素选择颜色。我想将所有颜色值转换为十六进制以避免任何进一步的格式化麻烦(“rgb(x,y,z)”或命名颜色)。我为此找到了一个很好的 JS 库。
我有像这个例子这样的简单代码: int main() { double i_3 = 4.1; // 8 bytes return 0; } 让我们用 -S 选项编译这个示例: g++ -S -
我正在尝试执行 POST 操作: 我的 Controller 是: @RestController @RequestMapping({"/contacts"}) public class Contac
我需要一个数据表,以便在由一些生成的数据增强的 WPF 数据网格中显示数据。但我还需要将数据从数据库加载到本地 C# 对象,因为表示数据的类会进行很多计算。 那什么更好呢?仅依赖于数据表?或者对象和数
我正在开发一个 Java Spring Boot 应用程序,我使用的是版本 2.1.5 RELEASE。就我而言,我还使用 DozerBeanMapper (5.4.0) 和 Lombok 以防万一这
我正在使用 Postgresql 和 PHP 5.3.x with PDO 来访问数据库。 我有这个 SQL 查询(精简版),需要填写一个 PDO 占位符: INSERT INTO t_article
根据 C11 WG14 draft version N1570 : The header declares several functions useful for classifying and
我正在构建一个网络 CMS,用户可以在其中为某些网站元素选择颜色。我想将所有颜色值转换为十六进制以避免任何进一步的格式化麻烦(“rgb(x,y,z)”或命名颜色)。我为此找到了一个很好的 JS 库。
在golang中,如何将字符串转换为二进制字符串?示例:'CC' 变为 10000111000011 最佳答案 这是一个简单的方法: func stringToBin(s string) (binSt
我是一名优秀的程序员,十分优秀!