Execute db function from adf and return collection

Hi All
jdev version : 11.1.1.3
db : oracle
Can anyone suggest how do I get a collection(cursor or array) from a db function in a db package?
I want to call it from the adf side using a preparecall and executeupdate

Use Oracle's JDBC extentions of the standard Java JDBC API. Have a look here:
http://docs.oracle.com/cd/B28359_01/java.111/b31224/oraint.htm#BABBGDFA
http://docs.oracle.com/cd/B28359_01/java.111/b31224/oraarr.htm
Dimitar

Similar Messages

  • Procedure and Functions from ADF View Layer

    Hi,
    Before i ask my question ,I would like to mention that I have done lot of googling on this topic before asking this question.
    http://adfhowto.blogspot.in/2010/11/call-db-procedure-or-function-from-adf.html
    http://adf-tools.blogspot.ca/2010/03/adf-plsql-procedure-or-function-call.html
    Lot of threads on otn forum too on this topic.
    I m pretty new to ADf too.
    Now most of our logic is in procedures and functions ,so on various events on form(view layer) I need to call procedure and function and then return values back to value layer too.
    Now the approach mentioned in the link above is good whats best approach to return out parameters to view layer considering i will be using either the DbCall class for all calls to procedures and functions
    I am thinking of this approach to Create a view with static fields,and in Model layer set values for these fields and access them in view layer or binding view controls to these fields.
    From View layer i will call the methods in AppmodImpl which will be calling procedure( methods will be exposed as Client Interface)
    Also in few articles i came across generic CallStoredProcedure and CallStoredFunctions.
    But my main concern is how to share out parameters with view layer....can anyone give link of showing application of it on view layer.
    Regards,

    From your subject. am stating that, dont do all those stuff in backing bean. backing bean is 1:1 mapping with your .jpsx or .jsff .
    best approach would be call those things your Application Module(model layer) exposed it. access the method over your pagedef. well said by ram.

  • I purchased an unlocked iPhone 4S from US and returned to india,but now I can't activate the phone.

    I purchased an unlocked iPhone 4S from US and returned to india,but now I can't activate the phone. Called up the apple support team in India they said it is already unlocked from AT&T. What am I suppose to do ?
    Previously my iTunes was showing the phone and summary etc etc. The India Support center asked me to upgrade it to 5.1.1 then the new sim will be recognised, but now nothing is happening, even iTunes is not showing the Summary page.
    Please suggest?
    I never expected apple stuff to be like this.

    mithaani wrote:
    Got an (unlocked) iphone 4s from US
    As kb1951 states, unless this phone was purchased directly from Apple, it is not officially unlocked. In the US, only Apple sells officially unlocked iPhones. The message you got generally means your phone was hacked to unlock it...jailbroken...Apple's servers have detected such & are preventing your phone from activating...there's nothing wrong with the activation servers.
    You'll need a sim card from the carrier your phone is locked to in order to activate it. If you don't know what carrier, you'll have to call AppleCare in the US to determine this info. Be aware, US carriers will not authorize official unlocking unless you are a customer that used the phone on their network. Thus, there is most likely no way for you to get this phone officially unlocked.
    Good luck.

  • How to attatch sub vi . can we do it the same way as we call functions in C and return values to the main vi?

    I am creating a Vi. I want to do a sub function. I want to connect a switch to a toggle flip flop so need to  use a push button switch in the input  but at the same time take its output to a true/false loop and execute it according to the ourput of the toggle flip flop which will have an ON and OFF state.
    Jeril

    In the front panel you can r-click the top right icon and "Show Connector". Click which controls and indicator you want to be your interface. Then drag it to your main application and it'll work as a sub-vi. You can do this for all VI's. Just like the "+" VI takes two numbers (controls) and return one result (indicator).
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Whats the difference between executing a package from SQL and Visual Studio?

    Hi,
    We have a package that is currently failing to run when deployed to SQL. This has been tried from a schedule and also executed manually both are failing.
    I have tried from Visual studio running on various machines (windows 8, server 2012) and in all cases run perfectly.
    I am trying to understand the differences between deploying to SQL and running from VS so maybe I can figure out why this is happening.
    I have the following errors when I run from SQL.
    DTS_E_PROCESSINPUTFAILED - all errors like this point to the 'Sort' tasks in the script
    dts_e_processinputerror not enough storage is available
    I have tested in four environments and all fail from SQL but not from VS!
    Last night I tried from my laptop and executed the package from SQL - it didn't fail but was still running in the morning so I terminated. Note this takes around 20 mins running from VS! why would it be so quick from VS but fail or take so long on SQL?
    The test running at the moment is on a server with dynamic memory currently at 14GB. I decreased SQLs RAM to 4GB and it hasn't failed yet but has been running for two hours. Before changing this the package failed after a short time.
    I thought it may have something to do with running from a virtual machine but doesn't explain why it couldn't run locally on my laptop.
    All ideas welcome :) Many thanks,
    Davina

    I will try to address issues one by one
    The error doesn't seems to be related to SSISDB configuration mode. It may be because of
    Change in package definition (please confirm that the package which you are running on your laptop is the same on your msdb? - reload your SQL package from MSDB in BIDS/SSDT and recreate your source and destination components)
    As your error message shows, "not enough memory available" (may be because of multicast)  - Usually you can override this error by restarting SQL Server [not an optimal solution but it work & if that work it shows that your package fills
    the memory - Keep an eye on task manager]
    Make sure that your statics on table are updated [run EXEC sp_updatestastics] 
    Make sure your indexes are not de-fragmented [run rebuild indexes]
    If you are dealing with many rows may be 40000 * 12 (because of multicast) = 4,800,000 rows the try to separate package. 
    Check your excel file format/column data type is correct
    Check user permission who is running the job has required permission on folder/file.
    Understand that sort is a blocking transformation and it requires all your data in memory before it sorts. so, if there are large number of rows then your complete memory will be occupied. 
    Difference between Visual Studio & BIDS/SSDT
    Nothing much, other than BIDS runs on 32 bit while jobs on 64 bit (but there run time environment are configurable, though) 
    There shouldn't be any performance difference until your
    package is on network location because transferring data to the network may slow the package. If package runs on SQL Server it uses SQL buffer pool to fetch data via SQL statement and then SSIS works on its own memory allotment. 
    Hope this will help you to understand and fix the issue.
    Glad to help! Please remember to accept the answer if you found it helpful. It will be useful for future readers having same issue.

  • Executing sqlldr (sql loader) from java and returning the error code

    I'm wandering do sqlldr return any error code whenever it hit error while running in java.
    For example, if i run in command prompt using the command below,
    C:\ >sqlldr uid/pwd data=abc.dat control=abc.txt
    It might give me some indicator that error occurs such as
    SQL*Loader-601: For INSERT option, table must be empty. Error on table CURRENCY
    or
    SQL*Loader-500: Unable to open file (abc.txt)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: The system cannot find the file specified.
    But when i run in java using the code below,
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("sqlldr uid/pwd data=abc.dat control=abc.txt");
    int exitVal = proc.waitFor();
    System.out.println("Process exitValue: " + exitVal);
    it will only give me the same exitValue of 1(i presume its error) / 0 (i presume no error) instead of the details of the error.
    How can i get the exact error code/message if i were to execute it using java?
    Any solution?

    mg,
    I don't think user576271 wants the exit code, I think [s]he wants the error message.
    But wouldn't error messages from SQL*Loader be sent to the stderr stream, and not the stdout stream?
    In which case user576271 would need method "getErrorStream()" of class java.lang.Process, no?
    Good Luck,
    Avi.

  • Limitation on SQL executing select statement from ADO and Oracle 8.1.7.1 OleDB Driver

    Hi,
    we are running a query with a big dunamic select statement from VB code using ADO command object. When Execute method is called system hangs and control won't return back to the application. it seems to be that there is some type limitation on Query string length. Please tell us if there is any?
    we are running Oracle 8.1.7 Server on Windows 200 Server and connecting from a W2K professional, ADO 2.6 and Oracle OLEDB 8.1.7.1 OLEDB Driver.
    Sample code:
    Dim rs As ADODB.Recordset
    Dim cmd As ADODB.Command
    Set cmd = New Command
    With cmd
    .CommandText = ' some text with more than 2500 characters
    .CommandType = adCmdText
    Set rs = .Execute
    End With
    when i debug using VB6 and when .Execute line is called system hangs or return a message method <<somemethod> of <<some class name>> failed error.
    Any help is appreciated.
    Thanks,
    Anil

    A stored procedure would only slow you down here if it was poorly written. I suspect you want to use the translate function. I'm cutting & pasting examples from the documentation-- a search at tahiti.oracle.com will give you all the info you'll need.
    Examples
    The following statement translates a license number. All letters 'ABC...Z' are translated to 'X' and all digits '012 . . . 9' are translated to '9':
    SELECT TRANSLATE('2KRW229',
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    '9999999999XXXXXXXXXXXXXXXXXXXXXXXXXX') "License"
    FROM DUAL;
    License
    9XXX999
    The following statement returns a license number with the characters removed and the digits remaining:
    SELECT TRANSLATE('2KRW229',
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '0123456789')
    "Translate example"
    FROM DUAL;
    Translate example
    2229
    Also, LIKE '%<string>%' is going to be rather expensive simply because it has to compare the entire string and because it forces full table scans, rather than using indexes. You could speed this sort of query up by using interMedia Text (Oracle Text now in 9i). If you can eliminate one of the '%' options, you could also improve things.
    My guess is that your stored procedure is inefficient and that's causing the problem-- 5k rows per table should be pretty trivial.
    If you post your query over on the PL/SQL forum, there are better performance tuners than I that might have more hints for you. To get really good advice, though, you'lllikely have to get at least the execution plan for this statement and may need to do some profiling to identify the problem areas.
    Justin

  • Issue with Anlytical Functions,Ref Cusor and Bulk Collect

    Hi All
    pls go through the following code
    declare
    type salt is table of emp.sal%type index by binary_integer;
    st salt;
    type refc is ref cursor;
    rc refc;
    begin
    open rc for 'select max(sal) over (Partition by deptno) as Sal from emp';
    fetch rc bulk collect into st;
    close rc;
    for i in st.first..st.last loop
    dbms_output.put_LINE(st(i));
    end loop;
    end;
    When execute above code following error come :
    declare
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-06512: at line 8
    since Anlytical functions are not supported at pl/sql,i used the ref cursor,but these record are not allowed to collect in pl/sql table.
    pls can one send a work around.
    to insert recs into pl/sql table from anlytical function.
    Thanks for Reading the Request
    Raj Ganga
    mail : [email protected]

    Just ran it exactly as it is. It works.
    I am on 9i which version are you using..
    SQL> declare
    2 type salt is table of emp.sal%type index by binary_integer;
    3 st salt;
    4 type refc is ref cursor;
    5 rc refc;
    6 begin
    7 open rc for 'select max(sal) over (Partition by deptno) as Sal from emp';
    8 fetch rc bulk collect into st;
    9 close rc;
    10 for i in st.first..st.last loop
    11 dbms_output.put_LINE(st(i));
    12 end loop;
    13 end;
    14 /
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on
    SQL> /
    5000
    5000
    5000
    3000
    3000
    3000
    3000
    3000
    2850
    2850
    2850
    2850
    2850
    2850
    PL/SQL procedure successfully completed.

  • Execute command on remote linux and return output?

    Guys,
    I'm new to Java and still working hard on my way thru.
    I used a client software "putty" to logon to a linux machine. as the window is exactly like what it is in linux. in "/proc" I typed in "grep cpu stat" which returned 2 lines result of the cpu status on the screen.
    now, I have to do the same thing in Java. To execute a line of command "grep cpu stat" on the remote linux. then return the 2 lines result to my code and store them in string variebles. Can anyone please help me with this and show me some sample code of doing this Please.
    Thanks, and thanks big time
    , Jimbo

    Hi,
    look at this code, maybe it will help you...
    //this is only method
    public int exec(String[] command, OutputStream outStream) {
         Process p;
         int exitValue = -1;
         ByteArrayOutputStream tmpErr = new ByteArrayOutputStream(OUTPUT_BUFFER_SIZE);
         try {
              p = Runtime.getRuntime().exec(command);
              BufferedInputStream out = new BufferedInputStream(p.getOutputStream());
              ThreadStreamPumper pumper = new ThreadStreamPumper(out, tmp);               pumper.start();
              p.waitFor();
              exitValue = p.exitValue();
              pumper.join();
              out.close();
              p.destroy();
              tmp.close();
              tmp.writeTo(outStream);
         } catch (IOException ioe) {
              return -3;
         } catch (InterruptedException ie) {
              return -4;
         boolean isOkay = exitValue == 0;
         if (tmp.size() > 0) {
              return -5;
         return exitValue;
    //this is class
    *  class for continually pumping the input stream during Process's
    *  runtime.
    class ThreadStreamPumper extends Thread {
         private BufferedInputStream stream;
         private boolean endOfStream = false;
         private boolean stopSignal = false;
         private int SLEEP_TIME = 5;
         private OutputStream out;
          *  Creates new <code>ThreadStreamPumper</code>
          *@param  is   From where to pump datas
          *@param  out  Where to send datas
         public ThreadStreamPumper(BufferedInputStream is, OutputStream out) {
              this.stream = is;
              this.out = out;
          *  Gets datas from <code>in</code> and sends them to <code>out</code>.
          *@exception  IOException  When some IO error occurs
         public void pumpStream()
               throws IOException {
              byte[] buf = new byte[BUFFER_SIZE];
              if (!endOfStream) {
                   int bytesRead = stream.read(buf, 0, BUFFER_SIZE);
                   if (bytesRead > 0) {
                        out.write(buf, 0, bytesRead);
                   } else if (bytesRead == -1) {
                        endOfStream = true;
          *  Main processing method for the <code>ThreadStreamPumper</code>
         public void run() {
              try {
                   //while (!endOfStream || !stopSignal) {
                   while (!endOfStream) {
                        pumpStream();
                        sleep(SLEEP_TIME);
              } catch (InterruptedException ie) {
              } catch (IOException ioe) {

  • Calling Web services from ADF and JSF Jdeveloper 10.1.3.1

    Hi I need some examples/documentation about building a ADF application (user interface JSP pages) using only web services calls, instead of EJB or any other entities.
    For example, one web service would give details for a customers (parameters ID, Name,etc), another web service return all orders for a specific customer (parameter customer ID), and so.
    Somne advice, tutorial??
    Thanks!
    John.

    Thanks... I already saw this demo, very good, but uses web service input parameter in one page and result in another,
    But in my case I have to do next:
    1.- In one page 1 the result of web service method 1, (customer list) with option to select one of them and view his orders (page 2).
    2.- Page 2. list of customer's orders (result of web service method 2). This method should be called from page 1, with parameter = customer id selected.
    I have Web service data control, buit page 1 and page 2 (OK), but I dont know how to link and pass customer id parameter to invoke web service method 2...
    Any idea, help?
    Thanks.

  • Expense reporting, get values from column and return only unique values somewhere else

    i would like check a column for the values it contains (expense categorizations) and then return a list of only the unique values somewhere else in a vertical list. So "gasoline" may be listed 12 times in the reference list but in my result listing i would expect it to only show up once. If there is a way to do this then I would also like to know how empty cells are handled.
    I will then be applying a SUMIF to the returned list to get totals for all the unique categorization a have specified.
    Thank you for your time.

    Deleting the first row made your $F$2 become $F$1.
    Explaining how a formula works is not so easy to do. I'll try, but the best way is to read up on the formulas and piece it all together.  There's nothing fancy or tricky going on here.
    The "active ingredient" in the formula is this piece: OFFSET('Table 1-2'::$F$1,SMALL('Table 1-2'::G,ROW()−1)−1,0)
    ROW() returns the row number of the cell that has the formula in it. It is an easy way to get an ever increasing number for the formula. The other way would be to have another column with 1,2,3,4, etc. in it.  So, ROW() will return the number 1 if the formula is in row 1, will return the number 2 in row 2, etc.
    SMALL(range, n) returns the nth smallest number from the given range of numbers.  So, for the formula  in row 2, SMALL('Table 1-2'::G, ROW()−1) becomes SMALL('Table 1-2'::G, 1) which will return the 1st smallest number from the G column of Table 1-2.  In the 3rd row it would return the 2nd smallest number. Etc.  And remember that those numbers it is returning are the row numbers of your unique values in Table 1-2.
    OFFSET(base, row offset, column offset) is a way of  referencing a cell.  For instance, OFFSET($F$1,1,0) would be one row down from cell F1. OFFSET($F$1,2,3) would be two rows down and three columns to the right of cell F1.  The SMALL formula has given you the row number for a unique value in your Table 1-2.  To reference the correct row, the row offset from F1 needs to be one less than that number (an offset of 0 = cell F1. An offset of 1 = cell F2, etc.). The column offset is zero.

  • Calling BSP from report and return control back ?

    Hi All,
          My requirement is as follows :-
    1. I am calling a BSP from report using CL_GUI_HTML_VIEWER->show_url. The BSP page is displayed successfully.
    2. Then, I perform some operations and want to return some data back to the main program (from where it was called - Report) and continue execution from there
    How do I accomplish the second requirement (Control doesnt come back once I close the BSP) ?
    Regards,
    Ashish

    how to generate events from html code in the html control back to your ABAP check out this demo program
    SAPHTML_EVENTS_DEMO
    say for example, in your case you are showing the BSP in GUI HTML control and on clicking a link you want to pass some data from your link to ABAP program and the ABAP should receive the value and process it and may be comeback to same BSP or go some to some other screen/transaction.
    steps to follow:
    after creating the html control
    register event for call back and call the BSP url.
    create object hviewer
                 exporting
                   parent = mycont.
        myevent-eventid = hviewer->m_id_sapevent.
        myevent-appl_event = 'x'.
        append myevent to myevent_tab.
        call method hviewer->set_registered_events
          exporting
            events = myevent_tab.
        create object evt_receiver.
        set handler evt_receiver->on_sapevent
                    for hviewer.
        hviewer->enable_sapsso(
          exporting
            enabled    = 'X'
          exceptions
            cntl_error = 1
            others     = 2
        if sy-subrc <> 0.
        endif.
        call method hviewer->show_url
          exporting
            url = wf_url.
    in your BSP the link should look like below
    A HREF=SAPEVENT:TAGS?value to be passed to your ABAP> link text </a
    when you click this link in bsp then you can then capture the value "TAGS" to know which link was clicked and the value passed after the ?
    link is just one option, you can also send whole form data.
    this type of link and form will only work when your BSP is invoked within HTML contro. if its invoked from standalone browser these wont work. so you amy want to dynamically show/hide "sapevent" links based on where it runs.
    Hope this is clear. if not do getback.
    Regards
    Raja
    Edited by: Durairaj Athavan Raja on Sep 9, 2008 1:04 PM

  • Execute two functions from one Save button

    Hi,
    I am using JDeveloper 10.1.3.0.4 and JHeadstart 10.1.3.0.91.
    Can anybody help me for the following:
    In one editable jspx page I have a save button.
    I want to do the following:
    If I click the Save button, it will save the record and also it will call another stored procedure. I know how to call a stored procedure by clicking a button. But I want to do it from a save button after saving.
    I want my save button will do two things - 1) save the record, 2) call the stored procedure.
    I would appreciate if anybody could help me.
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    It would have been nice if JSF framework would have allowed us to chain the actionListner or specify multiple actionListner, but as of now, that not possible.
    Another option would be to bind the save button to call an AM method.
    By default the save button's ActionListener is bound to the Commit operation.
    - You can create a custom method in your AMImpl.java say void myMethod()
    Which basically first does a commit and then make a pl/sql call.
    - Expose it to the clients via Edit Application module dialog box.
    - Add a method bindings in your PageDef pointing to this.
    - Set the actionListener of you button pointing to this new method binding.
    it will be something like '#{bindings.myMethod.execute}'
    regards - rutwik

  • Troubles with opening attachments when user have restristed priviledge to run executable code only from ProgramFiles and Windows folders.

    I try to restrict users from executing any potentialy dangerous files. So according to Windows policies I set. Users can run any application from Program Files, Program Files (x86), Windows and all users' desktop folder. Users have no permission to write anything in this folders. When user duble clicks for example *.doc document on his desktop - document opens with MS Word just fine. But when user try to open this document from e-mail attachment directly (selecting open with MS Word, instead of saving) - he sees an error - "This action is restricted by local policy. Ask your system administrator." (not exact text).
    So I want, users able to open attachments from Thunderbird automatically, but not able to run any application or link, except Program Files, Program Files (x86), Windows and all users' desktop folder. How can I get this result?
    Thanks in advance.
    Serious Diman.
    P.S. Sorry for my bad english. It's not my native language.

    Thanks for answering.
    I found out what was happening.
    This strange "bug" affects several computers with Windows 7 Ultimate in my case.
    When you create SRP (software restriction policies) it creates two default rules for running programs: windows folder and Program Files folder. Manually I add "C:\Program Files (x86)" in unrestricted locations. BUT Windows and Program Files folder linked in default rules not directly, but through registry keys. And this part seems tricky. You CAN run executables from Program Files. You CAN run executables from Program Files (x86). But if Thunderbird or Firefox try to run MSword, or excel or writer for opening *.doc or *.odt or some other downloaded file - running from Program Files blocked by SRP.
    So to resolve this problem you just need to replace rules for undirect paths like %HKLM/software/microsoft/windows ... etc% with direct ones, such as "C:/Windows" and "C:/Program Files/". After this all works fine. Attachments and downloaded files opens automatically without problems.

  • How to edit a file from Organizer and return it to Organizer?

    In PSE5, in Organizer, I want to fix a photo. I right-click it and "go to quick fix" or"go to full edit". Editor opens up, I edit the photo, and want to return to Organizer. How to do that? If I try to save, I have to go through several dialogs, including warning that I'm about to replace an existing file, and default option to save a version; which all looks like I'm creating another instance of the file. Or, if I want to fix multiple files, I select them all in Organizer and go to quick fix; once I have finished, I don't see how I can commit all changes back to Organizer (which is showing "edit in progress" on them meanwhile) - I have to save each individual file, going every time through those several dialogs. Am I missing something obvious?

    Not missing anything, that's how it works. If you want to replace the
    file, go ahead, but most people keep a separate version, so you have
    your original, and then the one they changed. That way, if you don't
    like what you did, you can always go back to the original. You should
    get something like: IMG_001.jpg (let's say that's your original file),
    and then IMG_001-edited-1.jpg as the next one in the version set. This
    is how Elements works. Most editing does change pixels, so you actually
    have a new file. (I know that some editors/organizers do support
    non-destructive editing, but you are very limited in what things you can
    do.)
    -Trish

Maybe you are looking for