Pass array as parameter
Does anyone know how to put v_array1D into a hashtable??
I must also be able to get it as an array of String
Hashtable v_array2D=null;
String[] v_array1D=new String[c_colsize];
while (rs.next()){
row_exist=true;
for (int j=0;j<c_colsize;j++){ //I selected 6 rows from above
System.out.print(rs.getString(j+1)+" ");
v_array1D[j]=rs.getString(j+1);//getString starts from index 1 for column 1
v_array2D.put(new Integer(i),v_array1D);//create a 2D array, but not successful
i++;
}//end of resultset, 2D array created
Beside you have not instansiate the Hashtable v_array2D, it should work otherwise.
How do you get the array back? Like this:
String[] sa = (String[]) v_array2D.get(new Integer(i));
--lichu
Similar Messages
-
How to passing array as parameter to oracle stored procedure from JPA
Hi All,
I need to call a stored proc in Oracle that accepts an array as input parameter.
Pls let me know how should i call it from my JPA. Is this even possible without using JDBC directly?
i keep getting the ff error:
wrong number or types of arguments in call to ....
my code is something like this:
String[] myArr...
Query query = em.createNativeQuery("BEGIN myStoredProc(:arr); END;");
query.setParameter("arr", myArr);
Thanks in advance.I also fail to get this done my code till now is:
PLSQL Function:
function getHtml(pWhere VARCHAR2 DEFAULT NULL,
pColSort HTP.STRINGARRAY) return clob is
begin
errorhndl.Log(pMessage => 'called');
htp.prn('das ist der test
for i in 1 .. pColSort.count loop
htp.p('
pColSort['||i||']: '||pColSort(i));
end loop;
htp.prn('
<table> <tr> <td> max1.0 </td> <td> max2.0 </td> </tr>');
htp.prn('<tr> <td> max1.1 </td> <td> max2.1 </td> </tr> </table>');
htp.prn('test ende');
return htp.gHtpPClob;
exception
when others then
null;
end getHtml;
PLSQL TYPE: (in HTP package - self created - but could be anywhere else too)
type STRINGARRAY is table of varchar2(256) index by binary_integer;
JAVA DOA:
public class ShowReportDOAImpl implements ShowReportDOA {
private JdbcTemplate jdbcTemplate;
private SimpleJdbcCall procShowReport;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
procShowReport = new SimpleJdbcCall(this.jdbcTemplate)
.withCatalogName("Show_Report")
.withFunctionName("getHtml")
.withoutProcedureColumnMetaDataAccess()
.declareParameters(
new SqlParameter("pWhere", Types.VARCHAR),
new SqlParameter("pColSort", Types.ARRAY, "HTP.STRINGARRAY"),
new SqlOutParameter("RETURN", Types.CLOB)
public String readReport(Long id, ParameterHelper ph) {
String[] sortCol = {"max", "michi", "stefan"};
String pWhere = "fritz";
MapSqlParameterSource parms = new MapSqlParameterSource();
parms.addValue("pWhere", pWhere);
parms.addValue("pColSort", sortCol, Types.ARRAY, "HTP.STRINGARRAY");
parms.addValue("pColSort", Arrays.asList(sortCol), Types.ARRAY, "HTP.STRINGARRAY");
Clob clob = procShowReport.executeFunction(Clob.class, parms);
String clobString = "";
try {
System.out.println("length: "+new Long(clob.length()).intValue());
clobString = clob.getSubString(1, new Long(clob.length()).intValue());
} catch (SQLException e) {
e.printStackTrace();
return clobString;
EXCEPTION IS:
org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{? = call SHOW_REPORT.GETHTML(?, ?)}]; SQL state [null]; error code [17059]; Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]; nested exception is java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:969)
org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:860)
oracle.sql.ARRAY.toARRAY(ARRAY.java:209)
oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7767)
oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7448)
oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7836)
oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4586)
org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:356)
org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:127)
org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:212)
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:947)
org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
Please help!!
Please help!! -
C# pass array as parameter in SAP XI web service
I can get this to work if all parameters are strings.
This new web service retrieves Bill Of Material. Last parameter appears to be an array and it's a reference parameter. The tooltip in VS2003 is "ref ZBOM[] BILL_OF_MATERIAL"
I create an array object
public SAPBOMTest.refREADBOM.ZBOM[] myZBOM;
I use myZBOM for the last parameter. It compiles OK in VS2003. I then get a SOAPReadResponse error.There is an error in your SQL.
-
How can i pass array as parameter
I want to pass user input array to a separate class and do mathematical
operations . I want to know how to pass thedata entred by user to another class method or same class separate methodI want to pass user input array to a separate class
and do mathematical
operations . I want to know how to pass thedata
entred by user to another class method or same class
separate methodThis is several tasks. Break the problem down into managable parts.
If by "input array" you mean the keyboard you have to
-capture the input stream from the keyboard in a string or stringbuffer
-parse the string or stringbuffer into pieces which can be converted to numbers
-put the numbers into an array
-pass the array to your class (or method) which operates on it -
Passing array of long as Web Service parameter
Hello,
Is it possible in apex pass array as paramater ? I have method with one paramater Long[]: Numbers. Any idea, plsease.
Thank you.This might be helpful. You can create an application process (Shared Component) and call it while passing arrays.
Passing an array with htmldb_get
It isn't specifically about longs but, you should be able to move from their string to their numeric representations.
-Joe -
How can i pass array as argument in magento api method calling using sudzc API in iphone Native APP
0down votefavorite
I am implementing magento standard api method in native iphone app. I use webservice generated by sudzc. To call method I use:
[service call:self action:@selector(callHandler:) sessionId:@" " resourcePath:@" " args:@""];
When I used methods e.g. cart.info or product.info in which I have to pass one parameter; it gives valid response. But when I used method e.g. cart_product.add in which I have to pass an argument as value of array it gives error
SQLSTATE[42000]: Syntax error or access violation:
1064 You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
I have tested in SOAP UI also. There also it gives me same error. But same method works in PHP file. Even I tried by creating same soap request which I created using JavaScript but still it doesn't work.
Can anyone help me to pass array as a parameter using sudzc api to call magento web services?There is an error in your SQL.
-
How to pass array into xslt from java
i have a xslt in which i am passing some parameter from java there is one parameter which is a array in java which i need to pass becouse array length is not defined so that xslt will work dynakically according to the parameter.
right now i am passing parameter but not able to send the array parameter that's why my code is not fully dynamic
please give suggestion.
anaghit is not possible to pass array by using XSLT, you can wirite all values into a String with certain delim symbol, pass this string, then use xsl.substring() to get different values.
-
Problem with string constructor when using byte array as parameter
I am creating a string using constructor and passing byte array as parameter.This byte array i am getting from MessageDigest's digest() method,i.e. a hash value.
The problem is when i iterate through byte array i can able to print all the values in byte array.But when i construct a string from that byte array and printing that string ,that is printing some unknown characters.
I don't know whether i need to pass charsequence to the constructor and the type of charsequence.Can anybody help me?
Thanks in advanceIs there some problem today? I'm getting this sort of thing all over.
I already told you and so did Kayaman. Don't. String is not a holder for binary data. You have to Base-64 encode it. If you don't you cannot reconstruct the original binary digest value, so putting it into a database is completely utterly and entirely pointless.
Is that clear enough? -
ORA-00932 when trying to pass ARRAY from Java SP to PL/SQL
Hi all
I am trying to pass ARRAYs back and forth between PL/SQL and Java stored procedures. But I keep getting:
ORA-00932: inconsistent datatypes: expected a return value that is an instance of a user defined Java class convertible to an Oracle type got an object that could not be converted
Here's my PL/SQL:
create or replace type CONTENTP.sentences_array as VARRAY(1000) of CLOB
-- I've also tried .. as TABLE of CLOB and varray/table of VARCHAR2
declare
proc_clob CLOB;
arr SENTENCES_ARRAY;
begin
SELECT document_body
into proc_clob
from documents
where document_id = 618784;
arr := processdocument.sentencesplit (proc_clob);
end;
PROCESSDOCUMENT package definition:
CREATE OR REPLACE PACKAGE CONTENTP.PROCESSDOCUMENT AS
FUNCTION sentenceSplit(Param1 CLOB)
return SENTENCES_ARRAY
AS
LANGUAGE java
NAME 'com.contentp.documents.ProcessDocument.sentenceSplit(oracle.sql.CLOB) return oracle.sql.ARRAY';
FUNCTION removeHTML(Param1 CLOB)
return CLOB
AS
LANGUAGE java
NAME 'com.contentp.documents.ProcessDocument.removeHTML(oracle.sql.CLOB) return oracle.sql.CLOB';
end;
Java sentenceSplit code:
public static oracle.sql.ARRAY sentenceSplit ( CLOB text) throws IOException, SQLException
Connection conn = new OracleDriver().defaultConnection();
String[] arrSentences = sent.getsentences ( CLOBtoString (text) );
ArrayDescriptor arrayDesc =
ArrayDescriptor.createDescriptor ("SENTENCES_ARRAY", conn);
ARRAY ARRSentences = new ARRAY (arrayDesc, conn, arrSentences);
return ARRSentences;
I have confirmed that the String[] arrSentences contains a valid string array. So the problem seems to be the creation and passing of ARRSentences.
I have looked at pages and pages of documents and example code, and can't see anything wrong with my declaration of ARRSentences. I'm at a loss to explain what's wrong.
Thanks in advance - any help is much appreciated!I am trying to do something similar but seems like getting stuck at registerOutParameter for this.
Type definition:
CREATE OR REPLACE
type APL_CCAM9.VARCHARARRAY as table of VARCHAR2(100)
Java Stored Function code:
public static ARRAY fetchData (ARRAY originAreaCds, ARRAY serviceCds, ARRAY vvpcs) {
Connection connection = null;
ARRAY array = null;
try {
connection = new OracleDriver ().defaultConnection();
connection.setAutoCommit(false);
ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", connection);
String[] result = new String [2];
result[0] = "Foo";
result[1] = "Foo1";
array = new ARRAY (adString, connection, result);
connection.commit ();
return array;
} catch (SQLException sqlexp) {
try {
connection.rollback();
} catch (SQLException exp) {
return array;
Oracle Stored Function:
function FETCH_TRADE_DYN_DATA (AREA_CDS IN VARCHARARRAY, SERVICE_CDS IN VARCHARARRAY,VV_CDS IN VARCHARARRAY) return VARCHARARRAY AS LANGUAGE JAVA NAME 'com.apl.ccam.oracle.js.dalc.TDynAllocation.fetchData (oracle.sql.ARRAY, oracle.sql.ARRAY, oracle.sql.ARRAY) return oracle.sql.ARRAY';
Java Code calling Oracle Stored Procedure:
ocs = (OracleCallableStatement) oraconn.prepareCall(queryBuf.toString());
ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", oraconn);
String[] originAreaCds = sTDynAllocationVO.getGeogAreaCds();
ARRAY areaCdArray = new ARRAY (adString, oraconn, originAreaCds);
ocs.registerOutParameter(1, OracleTypes.ARRAY);
ocs.setArray (2, areaCdArray);
String[] serviceCds = sTDynAllocationVO.getServiceCds();
ARRAY serviceCdsArray = new ARRAY (adString, oraconn, serviceCds );
ocs.setArray (3, serviceCdsArray);
String[] vvpcs = sTDynAllocationVO.getVesselVoyagePortCdCallNbrs();
ARRAY vvpcsArray = new ARRAY (adString, oraconn, vvpcs);
ocs.setArray (4, vvpcsArray);
ocs.execute();
ARRAY results = ocs.getARRAY(1);
Error I get:
Parameter Type Conflict: sqlType=2003
Thanks for help in advance. -
Pass array to oracle stored procedure
I have such a problem: I have to pass array to stored procedure, so I declare type:
create type tNumberArray as table of number
and create procedure:
create or replace procedure proc_1 (in_param in tNumberArray) as
.... BODY OF PROCEDURE ...
when I call this procedure from C# like this:
int []pParam = new int[3] {1,2,3};
OracleCommand cmd = new OracleCommand("proc_1", dbConn);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter param14 = new OracleParameter("param", OracleDbType.Decimal);
param14.Value = pParam;
param14.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param14.Size = 3;
param14.Direction = ParameterDirection.Input;
cmd.Parameters.Add(param14);
cmd.ExecuteNonQuery();
an error occures. It say that there invalid number or type of parameters.
But when I declare both type and procedure in a package everything goes fine.
What is the matter? Did anybody have the same problem?Not I got next problem:
when I cannot pass parameter to stored procedure and get array fro it. In other words returning array from procedure and passing some input parameters to it does not word!
Does anybody know why it happens? -
Passing array of objects to the procedure
Hi I have written a procedure to accept array of objects as input . it worked fine.
this is the only input parameter in my procedure.
But now I tried to add an out put parameter of type varchar2 to my procedure to send some return value but it gives me an error
PLS-00410: duplicate fields in RECORD,TABLE or argument list are not permitted.
please suggest cant i pass any other arguments when using a record or object array as parameter?
this is my code
CREATE OR REPLACE TYPE PREF_OBJ_TYPE as object (
PREF_CD varchar2(20),
USR_ID VARCHAR2(20),
PROD_CD VARCHAR2(50),
DFLT_PREF_VAL_TX VARCHAR2(250),
USR_PREF_VAL_TX VARCHAR2(250),
CRE_USR_ID VARCHAR2(20),
UPDT_USR_ID VARCHAR2(20) );
CREATE OR REPLACE TYPE PREF_ARRAY is table of PREF_OBJ_TYPE;
CREATE OR REPLACE procedure MMM(in_pref PREF_ARRAY,v_err out varchar2 )
is
v_prod_dim_nb NUMBER;
v_usr_dim_nb NUMBER;
v_count NUMBER;
v_err varchar2(50);
begin
for i in in_pref.first.. in_pref.last
LOOP
/* Derive the product and user dim numbers */
select prod_dim_nb into v_prod_dim_nb from prod_dim where prod_cd=in_pref(i).prod_cd ;
select usr_dim_nb into v_usr_dim_nb from usr_xref where usr_id=in_pref(i).usr_id and sys_id='ACCESS';
/* check if the record already exist in usr_prod_pref corresponding to that user,prod,pref */
select count(1) into v_count from usr_prod_pref_test where prod_dim_nb=v_prod_dim_nb and usr_dim_nb=v_usr_dim_nb and pref_cd=in_pref(i).pref_cd;
if v_count=0 then
BEGIN
INSERT INTO USR_PROD_PREF_TEST values(v_usr_dim_nb,in_pref(i).pref_cd,v_prod_dim_nb,in_pref(i).DFLT_PREF_VAL_TX,in_pref(i).usr_PREF_VAL_TX,'Active',NULL,
in_pref(i).cre_usr_id,sysdate,in_pref(i).updt_usr_id,NULL);
END;
else
update USR_PROD_PREF_TEST set USR_PREF_VAL_TX=in_pref(i).USR_PREF_VAL_TX,DFLT_PREF_VAL_TX=in_pref(i).DFLT_PREF_VAL_TX,UPDT_USR_ID=in_pref(i).updt_usr_id,updt_dt=sysdate,cre_usr_id=in_pref(i).cre_usr_id where
prod_dim_nb=v_prod_dim_nb and usr_dim_nb=v_usr_dim_nb and pref_cd=in_pref(i).pref_cd;
end if;
end loop;
commit;
v_err:='abc';
end;
/Edited by: raj_fresher on Oct 9, 2009 6:56 AMokay i was wondering.... if he knew the error code in advance i thought user defined messages have numbers like -20000 to 209999 or something like that..
neverthless one final question ....
Now that my procedure is ready .. i have 2 final questions for this thread
1) is my usage of errorcode and error message to return to the calling application correct?
2) how to test this procedure in sql plus (or) toad?
i mean how to call?
exec modify_user_preferences(value, ?????(what should i write here for output variable ) ) ?? i want to check what value is it returning?
CREATE OR REPLACE procedure MODIFY_USER_PREFERENCES2(in_pref PREF_ARRAY,v_status_message out varchar2 )
is
v_prod_dim_nb NUMBER;
v_usr_dim_nb NUMBER;
v_count NUMBER;
v_product_exception EXCEPTION;
v_user_exception EXCEPTION;
p_error_code varchar2(50);
p_error_msg varchar2(50);
begin
for i in in_pref.first.. in_pref.last
LOOP
/* Derive the product and user dim numbers */
begin
select prod_dim_nb into v_prod_dim_nb from prod_dim where prod_cd=in_pref(i).prod_cd ;
EXCEPTION
WHEN NO_DATA_FOUND THEN
p_error_code := sqlcode;
p_error_msg := SQLERRM;
raise v_product_exception;
end;
BEGIN
select usr_dim_nb into v_usr_dim_nb from usr_xref where usr_id=in_pref(i).usr_id and sys_id='ACCESS';
EXCEPTION
WHEN NO_DATA_FOUND THEN
p_error_code := sqlcode;
p_error_msg := SQLERRM ;
raise v_product_exception;
raise v_user_exception;
END;
/* check if the record already exist in usr_prod_pref corresponding to that user,prod,pref */
select count(1) into v_count from usr_prod_pref_test where prod_dim_nb=v_prod_dim_nb and usr_dim_nb=v_usr_dim_nb and pref_cd=in_pref(i).pref_cd;
if v_count=0 then
BEGIN
INSERT INTO USR_PROD_PREF_TEST values(v_usr_dim_nb,in_pref(i).pref_cd,v_prod_dim_nb,in_pref(i).DFLT_PREF_VAL_TX,in_pref(i).usr_PREF_VAL_TX,'Active',NULL,
in_pref(i).cre_usr_id,sysdate,in_pref(i).updt_usr_id,NULL);
END;
else
update USR_PROD_PREF_TEST set USR_PREF_VAL_TX=in_pref(i).USR_PREF_VAL_TX,DFLT_PREF_VAL_TX=in_pref(i).DFLT_PREF_VAL_TX,UPDT_USR_ID=in_pref(i).updt_usr_id,updt_dt=sysdate,cre_usr_id=in_pref(i).cre_usr_id where
prod_dim_nb=v_prod_dim_nb and usr_dim_nb=v_usr_dim_nb and pref_cd=in_pref(i).pref_cd;
end if;
end loop;
commit;
v_status_message:='SUCCESS';
exception
when v_product_exception then
v_status_message:= 'invalid product code '||p_error_code||p_error_msg;
when v_user_exception then
v_status_message:= 'invalid user'||p_error_code||p_error_msg;
end;
/Edited by: raj_fresher on Oct 9, 2009 7:33 AM -
Passing array of Types to java class
I am trying to pass a user defined type (that is an array) from PL/Sql to a javaclass. Here are the definitions that make-up the parameter to pass from PL/Sql to Java (uri_digest_array):
CREATE OR REPLACE TYPE uri_digest as object (uri VARCHAR2(256),
digest_value CLOB);
CREATE OR REPLACE TYPE uri_digest_array AS VARRAY(10) OF uri_digest;
In Oracle-land, java classes are published to PL/Sql by way of the following definition. Note that the intent here is to have compatible data-types.
CREATE OR REPLACE FUNCTION SIGNRETURNINGXML (p_array IN uri_digest_array)
RETURN LONG
AS LANGUAGE JAVA
NAME 'SignReturningXml.main(oracle.sql.Array) return java.lang.String';
Here is a fragment of the java class code:
class SignReturningXml {
public static String main(String [] [] signItems ) // I have no idea what datatype to use here!
{ . . . . The code in here would process the passed array normally from first entry to last.
Currently I get the following error:
PLS-00311: the declaration of
"SignReturningXml.main(oracle.sql.Array) return
java.lang.String" is incomplete or malformed
I could use some suggestions on resolving the datatype conflicts. Any ideas? Has anyone tried this kind of thing?
Thanks,
MichaelMichael,
At the risk of another [non] useful response, I meant that you should try searching the "Ask Tom" Web site, because usually you will find an answer to your question that has already been asked by someone else. Perhaps these will be helpful:
[url=http://asktom.oracle.com/pls/ask/f?p=4950:8:1320383202207153292::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:8908169959941
]Can I Pass a nested table to Java from a pl/sql procedure
[url=http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:712625135727
]passing arrays into pl/sql stored procedures
Good Luck,
Avi. -
Passing array to call library function running on VxWorks (cRIO)
Hello,
I am using a cRIO 9012 running VxWorks.
I have a Call library function VI in my application and I want to pass arrays of doubles to this function.
The problem is that I can not access the values in the array.
Here is the source code of my function:
#include "D:\\Programme\\National Instruments\\LabVIEW 8.5\\cintools\\extcode.h"
double avg_num(double *in1, double *out1)
double ret;
ret = in1[0] + out1[0];
return ret;
The value of in1[0] and out1[0] is always.
When passing no arrays but single values, all is fine. But since my application is more complex than this example, I need to pass arrays.
The block diagram and parameter specification is as shown in the attached screenshots.
I am compiling the source code with the Gcc 6.3 which is available here:
http://zone.ni.com/devzone/cda/tut/p/id/5694
What am I doing wrong?
Or is passing arrays not supported on cRIO?
Maybe the makefile needs to be modified?
Thank you.
Best regards,
Christian
Attachments:
vi.JPG 88 KB
parameter.JPG 41 KBI guess I have solved the problem.
The key was to set the parameter "Minimum size" for all function parameters to <None>.
Having this, I can read the passed arrays. I do not know why this works but at the moment, it is ok for me.
Thank you all. -
How can i pass arrays in a procedure as IN parameter
for eg.
If I have a procedure which takes an input login id and a input status
procedure test(loginId IN varchar, status IN varchar)
-- the procedure does insert and update using the input login id and input status
Now, suppose i have a bunch of input login ids and a bunch of status, how can i pass the login id and status values as an array to the procedure instead of calling the procedure in a loop?This is best done using an object type and collection type, so you can make use of bulk SQL to perform the DML. I've given a short demo below:-
First your target table...
SQL> create table my_table ( id number, status varchar2(1) );
Table created.Now we create an object type ( this defines the record structure for your parameter ). We then create a nested table type (collection) based on this record structure:-
SQL> create type login_record_ot as object
2 ( id number
3 , status varchar2(1)
4 );
5 /
Type created.
SQL> create type login_records_ntt as table of login_record_ot;
2 /
Type created.Now a demo package with a procedure to insert the input collection into the target table. This uses the TABLE expression ( combined with CAST just in case you are on 8i )...
SQL> create package pkg as
2 procedure insert_records (
3 login_records_in in login_records_ntt
4 );
5 end pkg;
6 /
Package created.
SQL> create package body pkg as
2
3 procedure insert_records (
4 login_records_in in login_records_ntt
5 ) is
6 begin
7 insert into my_table ( id, status )
8 select x.id
9 , x.status
10 from table( cast( login_records_in as login_records_ntt )) x;
11 dbms_output.put_line( sql%rowcount || ' rows inserted.' );
12 end insert_records;
13
14 end pkg;
15 /
Package body created.Now to use it. I'll load a dummy variable with a collection of IDs/statuses and pass them to the pkg.insert_records procedure...
SQL> declare
2 some_records login_records_ntt := login_records_ntt(
3 login_record_ot( 1, 'X' ),
4 login_record_ot( 2, 'Y' ),
5 login_record_ot( 3, 'Z' ),
6 login_record_ot( 4, 'A' ),
7 login_record_ot( 5, 'B' )
8 );
9 begin
10 pkg.insert_records( some_records );
11 end;
12 /
5 rows inserted.
PL/SQL procedure successfully completed.
SQL>
SQL> select * from my_table;
ID S
1 X
2 Y
3 Z
4 A
5 BRegards
Adrian -
Pass array in request.getAttribute
Hello,
I have a jsp page in which on click of a button i am calling another jsp. i want to pass an array as parameter to the second jsp being called. var newwin="RegNotification.jsp?stuId="+stuId; by this code i am calling RegNotification & passing stuId which is an array. in RegNotification i have written this code
RegNotification inst_regNote = new RegNotification();
String[] inp;
System.out.println("inside regNote jsp");
for(int i=0; i<stuId.length; i++)
inp[i] = request.getParameter("stuId");
inst_regNote.applyXSL(out, "C:\\jboss-3.0.5\\server\\TCS041895_UTCS\\deploy\\MCApplication.ear\\MCAppWAR.war\\RegNote.xsl",inp);here i am calling a function in java class & passing these attributes as parameters. but this is not working can somebody helpeven tough you made a workaround for your problem i
still find it very strange the getParameterValues
returns a String and not a String arrayHi pgeuens,
You were right. when i am passing the array from the first jsp its getting passed an a comma separated list. though i have declared the variable as an array. in the first jsp if i access the array element wise it gives the correct output but when i just give the variable name without giving the element id i simply get a comma separated list. i dont know why that is happening. can you suggest something
Maybe you are looking for
-
I am running OSX 10.6.8 and when I try to install the latest security update there is an unknown error and the update cannot be implemented. I still have to restart my computer each time I try. Is anyone else experiencing this problem? I tried u
-
Hello all, Is there any method through which i can get the System ID( the hardware ID) of any particular System where my AIR application is installed. Regards, Varun Chopra
-
Is it possible to view singles photos on TV using the Apple iPod AV cable or just slide shows?
-
I am getting the 'invalid personalization information' error when I start my photoshop cs8. I cannot find my original disk to re-install, but do have the serial number. Can I download a trial version and then enter my serial number?
-
Remove All Website Data Not Working
Hello All, I am currently using a MacBook Pro, running OS X 10.8.5 with Safari ver 6.2.2. Recently I have noticed that when I go to preferences and click on Remove All Website Data it does not clean out the sites I have visited. Is this a common prob