Is it possible to receive a String[] back into stored procedure?

Hi,
Is it possible to return String [] into plsql procedure?
I have a class :
class CreditCard {
public static String cc (String args []) []
throws
SQLException, ClassNotFoundException
I load it into the database and then create a plsql procedure:
CREATE OR REPLACE PROCEDURE check_credit(
card_number IN          VARCHAR2,
exp_month IN          VARCHAR2,
exp_year      IN          VARCHAR2,
flag1      OUT varchar2,
flag2          OUT varchar2)
AS LANGUAGE JAVA
NAME 'CreditCard.cc(java.lang.String[]) return java.lang.String[]';
trying to compile it gives me:
20/1 PLS-00311: the declaration of "CreditCard.cc(java.lang.String[])
return java.lang.String[]" is incomplete or malformed
Is it possible to receive a String[] back into stored procedure?
Thanks
Leonid

I don't think you can use a String Array directly, you have to use an oracle.sql.ARRAY.
You use the oracle.sql.ARRAY parameter in Java as an OUT parameter in the stored procedure. You need to use an ArrayDescriptor which requires a corresponding Oracle Nested Table type.
Try something like the following:
First the Nested Table Type:
     CREATE OR REPLACE TYPE
     TBL_STRINGS AS TABLE OF VARCHAR2(999);
Then the Java method:
public static void getStrings(oracle.sql.ARRAY[] theStrings) //has to be an array of oracle.sql.ARRAY's as we use it as an OUT parameter
try
     //get a connection
     Connection conn = DriverManager.getConnection("jdbc:default:connection:");
     String [] colours = new String []{"RED", "GREEN", "GOLD"};
ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TBL_STRINGS", conn);
theStrings[0] = new oracle.sql.ARRAY(desc, conn, colours);
     conn.close();
catch (SQLException sqle)
          //report error
Then the call spec:
     PROCEDURE GET_STRINGS(p_the_strings     OUT     TBL_STRINGS)
     AS LANGUAGE JAVA
     NAME 'mypackage.MyClass.getStrings(oracle.sql.ARRAY[])';

Similar Messages

  • Using comma seperated String in a Stored Procedure, in a "IN" keyword

    Hello,
    I am stuck trying to figure out the best way to pass an array of Ids into a stored procedure, and evaluate then in a SELECT WHERE statement. e.g. I have:
    possibleIds VARCHAR2(50);
    BEGIN
    SELECT blah FROM foobar
    WHERE foobar.id IN (possibleIds);
    Where possibleIds looks like "10,11,12,30,101"...
    Is this possible somehow? The above fails because possibleIds is evaluated as a VARCHAR2, and is not "concatenated" to the SQL statement.
    Thanks for the help!

    The split function Scott used is some variant on one of the solutions posted in the Ask Tom link I posted. More specifically, it is probably a variant on either one of the pipelined function solutions, or one based on splitting the string into a SQL table of objects.
    Look at Tom's original response to the question for a working solution. If you have a reasonably new version of Oracle, then you may also want to look at the modificataion/modernization later in the thread which can be found here
    HTH
    John

  • Return national language strings from java stored procedures

    Hi, all.
    How does i can return String which contains national characters from java stored procedure? I.e. convert UTF java string to national language of database. It's does not processing automatically (why?).
    declaration of procedure:
    CREATE OR REPLACE FUNCTION TestNLSString RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'test.SomeClass.getNLSString() return java.lang.String';
    SELECT TestNLSString AS X FROM DUAL;
    X
    iiiii
    OS: Windows 2000 Server
    Oracle Server version: Oracle 8.1.7.1.4

    Ok. I had a specific problem.
    I want to use java stored procedure (function) to make a connection to remote db using supplied connection parameters make some quieries there end return results in a form of structured data - object.
    I have defined an object type in a database where the function will reside. I granted execute privilege to public user on this type, made public synonyms to both, the object type and the function, so anybody connected to the same database would have an access to this functionality.
    I supposed that if I supply connection parameters for some other user but the same database when running the function, everything should go smooth. Yeah.
    My java code executed ok: it made a connection to the db with some x user, it resolved object type descriptor given (oracle.sql.StructDescriptor), but pl/sql wrapper function reported the error I've mentioned. If I executed the function giving it the connection parameters for same account as where object type was declared, everything went fine.
    My final solution is:
    Make TWO! connection in java code: 1st for ("jdbc:default:connection:"), 2nd for remote database account.
    Use first connection to construct oracle.sql.StructDescriptor
    Use second connection to retreive data from remote db

  • Is it possible to use iFS API within java stored procedure?

    question:
    is it possible to use the iFS API for file handling
    within a java stored procedure (which is invoced by a trigger)?
    is there an "elegant" workaround if it is not possible?
    problem:
    my java code using the iFS API works fine outside
    the java stored procedure
    but invoked via trigger as java stored procedure
    it throws following exception:
    IFS-20102: Unable to start service (IfsDefault)
    i am using:
    oracle 9.0.1
    oracle internet file system 9.0.1.1.0
    windows 2000
    thanks

    thanks for your help
    i looked through the applications developers guide
    the basics behind advanced queueing (as far as i understand) is:
    program A inserts a message into the queue - and program B gets message from the queue and processes it
    question 1:
    but what is the difference between advanced queuing and a queue i create by myself
    (simply with a database table) and let application B (which runs in a loop)
    check if the queue is filled
    or am i missing something important which makes advanced queuing more practicable for my problem?
    question 2:
    you wrote about advanced queuing support in iFS 9.0.3, but the newest version i found was iFS 9.0.2
    did you reffer to the advanced queuing mechanism in general or to a spezial queuing feature in iFS 9.0.3?
    thanks

  • I want to pass String array to Stored procedure .

    ArrayDescriptor claim = ArrayDescriptor.createDescriptor("POOJA.VARCHAR_TBL" , conn);
    String test[] = {"an","jk"};
    ARRAY a = new ARRAY(claim,conn,test);
    cstmt.setArray(noOfParms,a);
    It gives class cast exception at ArrayDescriptor .. Dont know why ?
    Need an urgent help ...

    ArrayBinding feature is for bulk operation where a SP or SQL statement executes ArrayBindCount time in one server round trip. Each execution uses the nth element in the parameter (array) and execute the SP or SQL statement.
    This is done internally in the database, and not related to the SP or SQL statement at all.
    The PL/SQL Associative array support might be the feature that you're looking for.
    Please take a look from our Doc on these topics for further information. Also take a look in the ODP.NET dissucssion forum's samples section.
    Thanks
    Martha

  • XML structure in SAP XI for receiving output para of AS400 stored procedure

    Dear all,
    I submit a stored procedure of AS/400 via SAP XI with JDBC adapter by using below XML format. I try to define two output parameters at the end of this XML. How to get the return value ? Should I define a response message type ? and what is the XML format ?
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_SYN_t1 xmlns:ns0="http://xxx.xxu.hk/zxxxpgs/jdbc">
    <update>
    <storedProcedurename action="EXECUTE">
    <table>LIBRARY.PANSYTEST</table>
    <TRNX_TYPE IsInput="TRUE" TYPE="CHAR">4</TRNX_TYPE>
    <TRNX_NO IsInput="TRUE" TYPE="CHAR">2</TRNX_NO>
    <ACTIN IsInput="TRUE" TYPE="CHAR">23</ACTIN>
    <RCRT_DATM IsInput="TRUE" TYPE="CHAR">3</RCRT_DATM>
    <RCRT_USER IsInput="TRUE" TYPE="CHAR">8</RCRT_USER>
    <STUD_ID IsInput="TRUE" TYPE="CHAR">8</STUD_ID>
    <AWD_SEQ IsInput="TRUE" TYPE="CHAR">6899</AWD_SEQ>
    <AW_PSDATE IsInput="TRUE" TYPE="CHAR">89</AW_PSDATE>
    <AW_PEDATE IsInput="TRUE" TYPE="CHAR">99</AW_PEDATE>
    <OUT_TRNX_TYPE IsOutput="TRUE" TYPE="CHAR">4</OUT_TRNX_TYPE>
    <OUT_TRNX_NO IsOutput="TRUE" TYPE="CHAR">2</OUT_TRNX_NO>
    </storedProcedurename>
    </update>
    </ns0:MT_SYN_t1>

    Send a message to DB, that you see how the response looks like.

  • JDBC Receiver Adapter - Call Stored Procedure

    Hi,
    I am using a JDBC receiver adapter to call a stored procedure in oracle.
    My target structure looks like:-
    <STATEMENT>
    <storedProcedureName action="EXECUTE">
    <table>realStoredProcedureName</table>
    <serialDate hasQuot="NO" isInputType="true" type="date">TO_DATE('07-15-2008 08:00:11','MM-DD-YYYY HH24:MI:SS')</serialDate>
    <serialNo isInputType="true" type="NUMERIC">123456</serialNo>
    </storedProcedureName>
    </STATEMENT>
    The storedprocedure takes two input values and has one output value.
    The first parameter of the stored procedure is serialDate and the second input parameter is serialNo.
    I am getting an exception:-
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'storedProcedureName' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('07"</SAP:AdditionalText>
    Any ideas how to fix this issue.
    Thanks.
    Krishnan

    Hi Krishnan,
    <STATEMENT>
    <storedProcedureName action="EXECUTE">
    <table>realStoredProcedureName</table>
    <serialDate hasQuot="NO" isInputType="true" type="date">TO_DATE('07-15-2008 08:00:11','MM-DD-YYYY HH24:MI:SS')</serialDate>
    <serialNo isInputType="true" type="NUMERIC">123456</serialNo>
    </storedProcedureName>
    </STATEMENT>
    The storedprocedure takes two input values and has one output value.
    The first parameter of the stored procedure is serialDate and the second input parameter is serialNo.
    I am getting an exception:-
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'storedProcedureName' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('07"</SAP:AdditionalText>
    In the XML structure you cannot use TO_DATE function . Please pass the DATE in the correct format which the Stored procedure can accept .  Get the out put what you expected from TO_DATE function and use that value in the structure.
    Regards,
    Kishore

  • JDBC receiver adapter to call MS SQLServer stored procedure with parameters

    We are trying to use the JDBC receiver adapter to call a stored procedure in MS SQLServer with parameters.  According to the help documentation for the JDBC receiver adapter for action=EXECUTE,  "The elements within the stored procedure are interpreted as parameters" and "The parameter names must be identical to those of the stored procedure definition".  The parameters within a MS SQLServer stored procedure are required to begin with the '@' symbol.  The element names within a XML document i.e. used to call the stored procedure can not contain a special character such as '@' in the first position.  For all of the tests we have done where the parameter name in the XML document omits the '@' character, the parameters are not being received by the stored procedure.  Is there a way around this  problem?
    Thank you,
    Harold

    Hello Harold - I am facing the EXACTLY SAME problem.Pls let me know how did you fix this problem ?
    This is the message I am passing on to the DB SP:
    <?xml version="1.0" encoding="UTF-8"?>
    <MRIRequestInbound>
       <StatementName>
          <prc_FC_InsertStagingJournalEntries action="EXECUTE"/>
          <JournalData isInput="true" type="STRING">
    <NewDataSet><Table ITEM = "" ENTITYID = "" PERIOD = "" ACCTNUM = "" DEPARTMENT = "" JOBCODE = "" AMT = "" REF = "" DESCRPN = "" ENTRDATE = "" BASIS = " " BALFOR = "N" REQUESTNUM = "" ACCTNAME = "" TYPE = "" DESCRPTN = "" GDEP_DESCRPN = "" GJOB_DESCRPTN = "" JOBTYPE = ""  /></NewDataSet>
    </JournalData>
       </StatementName>
    </MRIRequestInbound>
    Out of which,
    <NewDataSet> tag contains the value of the parameter in the SP. So, my value to the SP's parameter is :
    <NewDataSet><Table ITEM = "" ENTITYID = "" PERIOD = "" ACCTNUM = "" DEPARTMENT = "" JOBCODE = "" AMT = "" REF = "" DESCRPN = "" ENTRDATE = "" BASIS = " " BALFOR = "N" REQUESTNUM = "" ACCTNAME = "" TYPE = "" DESCRPTN = "" GDEP_DESCRPN = "" GJOB_DESCRPTN = "" JOBTYPE = ""  /></NewDataSet>
    Any clue ?
    Cheers,
    Amrish.

  • Taking control back while calling stored procedure using java programme

    I have stored procedure to load data. This procedure is invoked by java program.
    The stored procedure take around 10 to 15 minutes to do complete loading of database. I want to write stored procedure when it starts loading of database at the same return the control to calling java programme so that java program can do other operation i.e. java program can not wait for control back from stored procedure.
    In short stored procedure runs in background and return control back to java program when stored procedure is invoked. Is it possible then How we can achieve this.

    U can acheive this using Java Threads. Create a thread submit this loading job. Once you submit the thread, you will get the control back to do other stuff.
    Documentation:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html
    -aijaz

  • Database toolkit stored procedure return String

    Hi all,
    How I can return the entire string from my stored procedure using the attached code ?
    With this code I only retrive the first caractere of the string return by the stored procedure.
    Thanks for your help.
    MHP

    It could be that there is something screwy with LV, but given that it uses standard interfaces for comm with the DBMS, I would not expect that. A much more realistic possibility is that the toolkit is mucking things up. (A fairly common occurrence.)
    Try bypassing the toolbox -- which you don't really need anyway -- an talk directly to the ActiveX or .net interface.
    Also, what DBMS? What drivers are you using?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Parsing String Oject into another JFrame page

    Hi,
    Can I know if it is possible to parse a string object into another JFrame page that I had created.
    Say i created a string object called obj, i want to pass the value of the string object "obj" to another JFrame page. How can it be done?
    String obj= new String();
              obj=table.getValueAt(table.getSelectedRow(),table.getSelectedColumn()).toString();Next, can i know how tocheck if a connection exist?
    Like i wann connect to a FTP server and i would like to check in the first place if the connection exist/available.
    appreciate all help.
    thanks.

    Essentially the same problem as solved here: http://forum.java.sun.com/thread.jspa?threadID=698985
    You should keep in mind that there is a difference between static and non-static thingies...
    * what goes into the class and what goes into the objects?
    ...and you should also keep in mind that Java is case sensitive and Java programmers (well, almost everyone) follow the same naming conventions :
    * use Capital letter for classes
    * finals all capital (with undercores denoting words)
    * everything else have lowercase letter
    * capitalize first character whenever "a new word" comes along
    You will keep bashing your head against a wall with minor problems until you figure it out. A "Java naming-ized" version of your (presumed) code might act as some kind of starting point?
    public class Search extends JFrame {
      //instance/object thingies -----------------
      private String aString;            // a instance field (unique for this instance)
      public Search(String anArgument) { // the Search constructor, with an argument
        aString = anArgument;          //do something with the argument ...
      //class thingies -----------------
      public static String str= "Some string";  // a static field (shared by all instances)
      public static void main(String[] args) {  // the main method is static...
        Search frame = new Search(str);      // create the Search object/frame, passing a parameter
        frame.setVisible(true);     
    }

  • Binding multi-byte string to stored procedure parameters

    Can someone post a piece of sample code to show how to bind a multi-byte string to a stored procedure's INPUT parameter?
    Thank you!
    Regards, Nancy

    Can someone post a piece of sample code to show how to bind a multi-byte string to a stored procedure's INPUT parameter?
    Thank you!
    Regards, Nancy

  • I purchased an iPhone 4s in Paris a month ago and I lost the receipt Is it possible to receive a receipt by e-mail in my name?

    I purchased an iPhone 4s in Paris a month ago and I lost the receipt Is it possible to receive a receipt by e-mail in my name?

    You purchased a "hacked" iPhone(hacked to unlock it) from a non-official source for iPhones. Unfortunately, that's the risk you take when you purchase from a non-official source. There is no way to get your phone officially unlocked, & all warranty & support has been voided. Sorry, but you don't have any good choices here. Your best bet is to go back to Carrefour Supermarket & get your money back, then purchase an iPhone from an official source. If they won't give you your money back, have them "fix" your phone...they will have to "hack" it again. Good luck.

  • Is it possible to convert from string to variant?

    Hi!
    I would like to convert a text string to variant. I'm doing this because I would like to merge a couple of signals and then save all the signals in a lvm-file. Could someone please explain how to convert from text to variant, is it possible?
    Thanks in advance!
    Regards,
    Mattias
    Attachments:
    Merge signals.JPG ‏27 KB

    What you are attempting to do is possible, but might not give you the results you expect.  All you need to do is convert your string to an array of U8s using the String to Byte Array conversion primitive.  In the file, you will get a single character per line of the file expressed as the ASCII code.  When you read it, convert to U8s, then use Byte Array to String to get your string back.
    You may also want to read up on LVM files.  There are several places to put strings that work a little better than this.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • I have forgot my I pad In saudi airlines SV883 , on 09-09-2012, then I have immediate inform them but not received any feed back from their side, please advise and protect my Ipad.

    Dear Sir,
    I have forgot my I pad In saudi airlines SV883 , on 09-09-2012, then I have immediate informed them but not received any feed back from their side, please advise and protect my Ipad.
    LOCATION : SAUDI ARABIA. DAMMAM - I have travelled from KOZHIKODE TO DAMMAM.
    I HAVE KEPT MY IPAD SEAT POCKET#42H, ,
    I have tay it several time thru ICloud still it's in offline.
    Saudi air lines customer support services not responding properly,
    You are requested to protect my IPAD and advice for the next.
    * Can I get back up files from that IPad.,
    waiting for your prompt reply as soon as possible,
    best regards,
    ZAMEER MAIDANI
    <Personal Information Edited By Host>

    This is a user-to-user technical support forum. We can't do anything to "protect" your iPad. If your files are backed up (and only you would know if so and where) you should be able to access them from your back up.
    Did you have Find My iPad enabled?

Maybe you are looking for

  • Still not working please help

    I was here a while ago about the flash player not working. I downloaded 9 and it worked for a little but some how I would have to keep re instaling it. Now it is installed but not in manage add ons. The only thing is adobe reader. I can see the other

  • Now playing on Technetast: "Web Services: The End of Packaged Software?"

    "Web Services: The End of Packaged Software?" http://technetcast.ddj.com/tnc_play_stream.html?stream_id=535 Now playing on Technetcast (video and audio streams available). Recorded at the International Conference for Java Development in New York (Feb

  • Mobility groups with multicast - 7.4.100.60

    Hello all, I am not sure if this is a bug, but here we go. I configured 2 controllers in a mobility group using multicast signalling. I expect that from the moment i enable multicast, the controller joins this group AND STAYS IN THIS GROUP so he will

  • Cameraw raw says it can't read files from T2i from 6.1 but ...

    I had installed CS5 as trial and installed Camera Raw 6.1 - everything worked fine. Then I bought and registered CS5, uninstalled CS4 and suddenly LR 2.7 didn't find CS5 as an external editor - even after a reboot and there was no apparent way to mak

  • Single inspection lot for multiple operation

    Hi I am creating a process order having 10 operation. the 3,5 and 8 are quality inspection (inprocess inspection) & last is PP operation that is for final confirmation. The control key in quality operations are pi02 and for production operation are p