- 浏览: 668532 次
- 性别:
- 来自: 中山
文章分类
最新评论
-
wuhuizhong:
jFinal支持Rest风格吗?可以想spring mvc那样 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
在jfinal中应如何获取前端ajax提交的Json数据?ht ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
jfinal如何处理json请求的数据:问题: 在某些api接 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
Ubuntu14.04 安装 Oracle 11g R2 Ex ...
Oracle 11g release 2 XE on Ubuntu 14.04 -
alanljj:
这个很实用,已成功更新,谢过了!
odoo薪酬管理模块l10n_cn_hr_payroll
CREATE OR REPLACE TYPE STRARRAY AS TABLE OF VARCHAR2 (255) / CREATE OR REPLACE PACKAGE DEMO_PASSING_PKG AS -- Varchar2's are most easily mapped to the java String type PROCEDURE PASS ( P_IN IN VARCHAR2, P_OUT OUT VARCHAR2) AS LANGUAGE JAVA NAME 'demo_passing_pkg.pass( java.lang.String, java.lang.String[] )'; PROCEDURE PASS ( P_IN IN STRARRAY, P_OUT OUT STRARRAY) AS LANGUAGE JAVA NAME 'demo_passing_pkg.pass_str_array( oracle.sql.ARRAY, oracle.sql.ARRAY[] )'; FUNCTION RETURN_STRING RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'demo_passing_pkg.return_string() return java.lang.String'; END DEMO_PASSING_PKG; /
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "demo_passing_pkg" AS import java.io.*; import java.sql.*; import java.math.*; import oracle.sql.*; import oracle.jdbc.driver.*; public class demo_passing_pkg extends Object{ public static void pass( java.lang.String p_in, java.lang.String[] p_out ){ /* * the simplest of datatypes -- the String. If you remember * the C version with 6 formal parameters, null indicators, * strlen's, strcpy's and so on -- this is trivial in * comparision */ if ( p_in != null ){ System.out.println ( "The first parameter is " + p_in.toString() ); p_out[0] = p_in.toUpperCase(); System.out.println ( "Set out parameter to " + p_out[0].toString() ); } } private static void show_array_info( oracle.sql.ARRAY p_in ) throws SQLException{ System.out.println( "Array is of type " + p_in.getSQLTypeName() ); System.out.println( "Array is of type code " + p_in.getBaseType() ); System.out.println( "Array is of length " + p_in.length() ); } public static void pass_str_array( oracle.sql.ARRAY p_in, oracle.sql.ARRAY[] p_out ) throws java.sql.SQLException,IOException{ show_array_info( p_in ); String[] values = (String[])p_in.getArray(); for( int i = 0; i < p_in.length(); i++ ) System.out.println( "p_in["+i+"] = " + values[i] ); Connection conn = new OracleDriver().defaultConnection(); ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor( p_in.getSQLTypeName(), conn ); p_out[0] = new ARRAY( descriptor, conn, values ); } public static String return_string(){ return "Hello World"; } }
SET serveroutput on size 1000000 EXEC dbms_java.set_output( 1000000 ) DECLARE L_IN STRARRAY := STRARRAY (); L_OUT STRARRAY := STRARRAY (); BEGIN FOR I IN 1 .. 5 LOOP L_IN.EXTEND; L_IN (I) := 'Element ' || I; END LOOP; DEMO_PASSING_PKG.PASS (L_IN, L_OUT); FOR I IN 1 .. L_OUT.COUNT LOOP DBMS_OUTPUT.PUT_LINE ('l_out('|| I || ') = ' || L_OUT (I) ); END LOOP; END; /
o STRARRAY is simply our Oracle type that represents the array (collection) we want to
pass.
o DEMO_PASSING_PKG is our "binding" to the java. Maps the SQL types to the Java types.
o when you run the PLSQL block at the bottom of your question, we are calling the code:
public static void
pass_str_array( oracle.sql.ARRAY p_in, oracle.sql.ARRAY[] p_out )
throws java.sql.SQLException,IOException{
show_array_info( p_in );
String[] values = (String[])p_in.getArray();
for( int i = 0; i < p_in.length(); i++ )
System.out.println( "p_in["+i+"] = " + values[i] );
Connection conn = new OracleDriver().defaultConnection();
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor( p_in.getSQLTypeName(), conn );
p_out[0] = new ARRAY( descriptor, conn, values );
}
That code just
1) dumps the array meta data -- type name, length and so on.
2) gets the array of java strings from the parameter (p_in.getArray())
3) prints out each string in turn (system.out.println)
4) creates a new array to be returned (first half of example shows how to PASS IN, second
half shows how to pass OUT).
5) Then, it copies the values in the array we want to return into the OUT parameter.
发表评论
-
用函数unistr将Oracle数据库中的Unicode转换为中文
2016-07-19 11:51 7880例子: DECLARE V_EXT_DES V ... -
ORACLE APPLICATION EXPRESS 5.0 升级
2016-05-12 11:43 544Oracle11GR2 XE 缺省是安装了oracle ap ... -
Oracle ACL(Access Control List)
2016-05-12 11:36 848在oralce 11g中假如你想获取server的ip或者h ... -
如何随机产生唯一的app_key和app_secret
2016-05-06 08:57 2801UUID含义是通用唯一识 ... -
develop web service
2016-05-04 07:13 410develop a RESTful we ... -
了解systemstate dump
2016-04-26 14:09 458当数据库出现严重的性能问题或者hang了的时候,我们非常需要 ... -
通过ORACLE的UTL_HTTP工具包发送包含POST参数的请求
2016-03-18 16:25 5086DECLARE req utl_http. ... -
Shell: extract more from listener.log(分析监听日志)
2016-03-16 14:57 1111统计一天内每小时的session请求数 # fgrep ... -
快速上手JFinal
2016-03-16 00:12 520JFinal是国产的MVC框架,由 Handler、Inte ... -
jfinal用fastjson处理json的插件
2016-03-15 23:37 2167FastJsonActiveRecordPlugin: p ... -
在JFinal的Controller中接收json数据
2016-03-15 23:31 3281原文 http://boytnt.blog.51cto.c ... -
jfinal中model转map
2016-02-25 23:33 968import java.util.HashMap; i ... -
ORA-01031: insufficient privileges 问题解决笔记
2016-02-01 15:53 1153A) File $Oracle_HOME/network/a ... -
listener.log中报Warning: Subscription For Node Down Event Still Pending问题的解决方法
2016-01-07 16:34 1604一套Oracle 10.2.0.1 for aix的数据库环 ... -
获取股票实时交易数据的方法
2015-12-01 23:47 9243调用sina专门的js服务器来获得数据,速度飞快: htt ... -
Oracle触发器和MySQL触发器之间的区别
2015-11-19 12:55 618Oracle触发器格式: CREATE [OR RE ... -
Myeclipse验证js语法报错
2015-11-14 14:09 624js报红叉,点进js文件发现错误信息如下: The lef ... -
查询正在执行的存储过程
2015-11-13 09:27 19921、找正在执行的PROCEDURE的 sid ,serial# ... -
eclipse server整合tomcat
2015-11-02 17:32 482安装配置tomcat 8http://jingyan.ba ... -
undo表空间损坏的处理过程
2015-10-14 13:49 1188磁碟陣列故障,分區/rman上包括undo和archivel ...
相关推荐
Reactive Streams in Java explains how to manage the exchange of stream data across an asynchronous boundary―passing elements on to another thread or thread-pool―while ensuring that the receiving ...
jGuru has been dedicated to promoting the growth of the Java technology community through evangelism, education, and software since 1995. You can find out more about their activities, including ...
深入讲解了python函数传参的原理,值得一看
ArrayIndexOutOfBoundException is thrown when we have to indicate that an array has been accessed with an illegal index. printStackTrace in jsp printStackTrace is a method of the Throwable class. By ...
如何将多维数组传递给一个函数,附实例说明,得出结果
google-java-format is a program that reformats Java source code to comply with Google Java Style. The formatter can act on whole files, on limited lines, on specific offsets, passing through to ...
Exam Ref 70-761 Querying Data with Transact-SQL by Itzik Ben-Gan English | 4 Apr. 2017 | ASIN: B06Y21QGGQ | 352 Pages | AZW3 | 23.79 MB Prepare for Microsoft Exam 70-761–and help demonstrate your ...
With an understanding of the transport used for J2ME MIDP/J2EE integration, the bulk of the document moves on to compare and contrast the various options for messaging formats over ...
This book proposes to be an integration of the theoretical aspects of java programming complemented with the implementation of the same in real world situations. The book would be all encompassing ...
matlab转换java代码utl_passing_sas_macro_variables_to_R_and_retrieving_macro_variables_from_R 将宏变量传递给R并从R中检索宏变量。关键字:sas sql连接合并大数据分析宏oracle teradata mysql sas社区...
To achieve this, one computational approach for representing human relationships and attributes is to use an explicit knowledge graph, which allows for high-level reasoning. We introduce a novel end-...
Microservices can be seen as an extension of the basic idea of modularity: programs connected by message-passing instead of direct API calls so that they can be distributed among multiple services....
collinear arrays and stacked element arrays, with gains ranging from 3 to 9 dB1. The higher gain antennas have a lower vertical beamwidth. For example, a typical 4-element exposed dipole offset array ...
$optParams = array('filter' => 'free-ebooks'); $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams); foreach ($results as $item) { echo $item['volumeInfo']['title'], "<br /> ...
Java Web Services shows you how to use SOAP to perform remote method calls and message passing;how to use WSDL to describe the interface to a web service or understand the interface of someone else's ...
So how did I go from absolutely loathing writing to being willing to dedicate so many nights and weekends to writing this book? Since the first 1.0 release of the Flex framework, I've been a fan. I ...
choosing an initial subset of data points and then iteratively refining it, but this works well only if that initial choice is close to a good solution. We devised a method called “affinity ...
将人脸识别和近似消息传递算法结合起来,实现了算法更好的鲁棒性,对于算法研究比较有意义