How to call store procedure from an oci program

Hello,
I work on Oracle 8.1.7 under AIX.
I must call from an OCI C++ program a store procedure that have an result set as param out.
I'm not sure how can I call the procedure/function. I want to execute this statement and fetch the results.:
" CALL Department.get_all (:1) " is this OK?
" Call department.GetAll() into :1 "
I have seen some example from an PL/SQL block but that's not ok for me.
what i have done:
i have created an package
create or replace package department as
type cursor_type is ref cursor;
procedure get_emp( i_deptno in number, rs out cursor_type );
procedure get_all( rs out cursor_type );
function GetAll return cursor_type;
end department;
create or replace package body department as
procedure get_emp ( i_deptno in number, rs out cursor_type )
as
begin
open rs for
select empno, ename
from emp
where deptno = i_deptno;
end;
procedure get_all ( rs out cursor_type )
as
begin
open rs for
select empno, ename
from emp;
end;
function GetAll return cursor_type
as
l_cursor cursor_type;
begin
open l_cursor for select ename, empno from emp;
return l_cursor;
end;
end;

Hi,
I am new to OCI facing the same problem you have mentioned, If you have found out how to solve it , can you post the answer for the same.
Thanks
Mani

Similar Messages

  • How to call store procedure in query generator

    Hi All,
    How to call store procedure in query generator.
    Regards
    Rajkumar Gupta
    Edited by: Rajkumar Gupta on Dec 7, 2010 2:11 AM

    Hi,
    Please check the following threads.
    How to use Stored Procedure in sap business one
    How to add parameters to a stored procedure in B1 Query generator
    How to execute the procedure in sap b1
    Hope it helps,
    Vasu Natari.

  • How to call stored procedure from Pro*C

    How to call stored procedure from Pro*C ?
    my system spec is SuSE Linux 9.1, gcc version : 3.3.3, oracle : 10g
    my Pro*C code is the following..
    EXEC SQL EXECUTE
    begin
    test_procedure();
    end;
    END-EXEC;
    the test_procedure() has a simple update statement. and it works well in SQL Plus consol. but in Pro*C, there is a precompile error.
    will anybody help me what is the problem ??

    I'm in the process of moving C files (with embedded SQL, .PC files) from Unix to Linux. One program I was trying to compile had this piece of code that called an Oracle function (a standalone), which compiled on Unix, but gives errors on Linux:
    EXEC SQL EXECUTE
    BEGIN
    :r_stat := TESTSPEC.WEATHER_CHECK();
    END;
    END-EXEC;
    A call similar to this is in another .PC file which compiled on Linux with no problem. Here is what the ".lis" file had:
    Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Error at line 193, column 5 in file weather_check.pc
    193 BEGIN
    193 ....1
    193 PCC-S-02346, PL/SQL found semantic errors
    Error at line 194, column 8 in file weather_check.pc
    194 :r_stat := TESTSPEC.WEATHER_CHECK();
    194 .......1
    194 PLS-S-00000, Statement ignored
    Error at line 194, column 18 in file weather_check.pc
    194 :r_stat := TESTSPEC.WEATHER_CHECK();
    194 .................1
    194 PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
    Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    System default option values taken from: /oracle_client/product/v10r2/precomp/ad
    min/pcscfg.cfg
    Error at line 194, column 18 in file weather_check.pc
    :r_stat := TESTSPEC.WEATHER_CHECK();
    .................1
    PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
    Error at line 194, column 8 in file weather_check.pc
    :r_stat := TESTSPEC.WEATHER_CHECK();
    .......1
    PLS-S-00000, Statement ignored
    Semantic error at line 193, column 5, file weather_check.pc:
    BEGIN
    ....1
    PCC-S-02346, PL/SQL found semantic errors

  • Call store procedure from pre-mapping

    Hi,
    I am currently working on OWB client version 10.2.0.4.36.My requirement is to call store procdure from pre-mapping tranformation.How to achieve this & how to pass parameters to the store procedure?
    Please let me know.
    Thanks,
    Siva

    Thanks for the quick reply.I am doing the same way as suggested.But am getting warning,when I validate it and is expecting to synchronize it.What warning you got exactly and i think you have not deployed the procedure.
    The reason for this procedure is to select max value from one of the table and then drop & recreate the sequence with max value + 1.
    Inside the procedure,am doing this all dynamically.which means am passing Columnname,tablename & sequencename to this procedure.
    Do you think is this good approach or any other advisable approach?Can you explain you requirement then only we can suggest the better way .
    Cheers
    Nawneet

  • How to call one procedure from another procedure

    Hi all,
    Could anyone give me clue how to call a procedure contains out parameters
    from another procedure.
    I had following procedures.
    1)
    create or replace procedure INS_PUR_ORDER
    p_poamt in number,
    p_podate in date,
    p_poid out number
    is
    begin
    select pkseq.nextval into p_poid from dual;
    insert into pur_order(poamt,podate,poid)
    values (p_poamt,p_podate,p_poid);
    end;
    2)
    create or replace procedure INS_PUR_ORDER_DETAIL
    p_pounits in number,
    p_poddate in date,
    p_poid in number)
    is
    begin
    Insert into pur_order_detail(podid,pounits,poddate,poid)
    values(pdseq.nextval,p_pounits,p_poddate,p_poid);
    end;
    I need to write a 3rd procedure which calls above two procedures.
    like
    call first procedure ,basing on the return value
    i.e if p_poid != 0 then
    we need to call second procedure
    in the loop.
    thanks in advance.
    rampa.

    Not sure what are you doing, you can not assign cursor to another cursor, may be you are looking for this?
    SQL> create or replace procedure proc1 ( result out sys_refcursor)
      2  is
      3  
      4  begin
      5     open result for
      6       select 'HELLO WORLD' from dual ;
      7  end proc1 ;
      8  /
    Procedure created.
    Elapsed: 00:00:00.01
    SQL> create or replace procedure proc2
      2  is
      3     l_cursor sys_refcursor ;
      4  begin
      5     l_cursor := proc1 ;
      6   
      7  
      8     open l_cursor;
      9     fetch l_cursor into l_text;
    10     dbms_output.put_line(l_text);
    11     close l_cursor;
    12  
    13  
    14  end proc2 ;
    15  /
    Warning: Procedure created with compilation errors.
    Elapsed: 00:00:00.01
    SQL> show error;
    Errors for PROCEDURE PROC2:
    LINE/COL ERROR
    5/4      PL/SQL: Statement ignored
    5/16     PLS-00306: wrong number or types of arguments
             in call to 'PROC1'
    6/4      PLS-00201: identifier 'L_TEXT' must be
             declared
    6/4      PL/SQL: Statement ignored
    8/4      PLS-00382: expression is of wrong type
    8/4      PL/SQL: SQL Statement ignored
    9/4      PL/SQL: SQL Statement ignored
    9/24     PLS-00201: identifier 'L_TEXT' must be
             declared
    10/4     PL/SQL: Statement ignored
    10/25    PLS-00201: identifier 'L_TEXT' must be
             declared
    ---- this is the correct waySQL>ed
      1  create or replace procedure proc2
      2  is
      3     l_cursor sys_refcursor ;
      4     l_text varchar2(100);
      5  begin
    ---- procedure call
      6     proc1(l_cursor); 
    7    -- open l_cursor;
      8     fetch l_cursor into l_text;
      9     dbms_output.put_line(l_text);
    10     close l_cursor;
    11* end proc2 ;
    SQL> /
    Procedure created.
    Elapsed: 00:00:00.01
    SQL> set serveroutput on
    SQL> execute proc2;
    HELLO WORLD
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL>

  • How to call a procedure from  Shell Script

    Friends,
    How can i call a procedure from a shell script ? If any one know the answer , let me know immediately .
    Thanks in advance .
    Chakks

    We connect using SQLPlus commands on the Unix server:-
    Our code block is below:- We've got DBMS_OUTPUT in the procedure, hence the spooling. You don't need all this, but you do need the sqlplus directory, etc... in your profile.
    sqlplus -s <<EOF > ${CREATE_LOG_FLE}
    $UserName/$Password@$SID
    SET SERVEROUTPUT ON SIZE 1000000;
    spool ${CREATE_LOG_FLE}
    EXECUTE $STORED_PROC(${Months}, ${DeleteRecords});
    EOF
    Hope that helps

  • How to call a procedure from within another procedure?

    What's the syntax to call a procedure from within a procedure.
    I have a procedure z(user_id IN number, ....)
    then
    procedure a (user_id IN number, ....)
    procedure b (user_id IN number, ....)
    procedure c (user_id IN number, ....)
    I want to call procedure a, b, c from inside procedure z.
    How would I do that?

    Same way :
    SCOTT@db102 SQL> create or replace procedure a (p1 in varchar2) is
      2  begin
      3     dbms_output.put_line (p1);
      4* end;
    SCOTT@db102 SQL> /
    Procedure created.
    SCOTT@db102 SQL> create or replace procedure z (par1 in number) is
      2  begin
      3     if par1 != 0 then
      4             a ('This is proc a');
      5     end if;
      6* end;
    SCOTT@db102 SQL> /
    Procedure created.
    SCOTT@db102 SQL> set serveroutput on
    SCOTT@db102 SQL> exec z (1);
    This is proc a
    PL/SQL procedure successfully completed.
    SCOTT@db102 SQL>                                                    

  • How to call stored procedures from EF 6.1.3

    Hi
    I need to create many reports and I wanna use SPs, with parameters, the question is how to use it from ntity Framework CodeFirst ? I am using EF 6.1.3
    I 've found examples using EF but not EF CF, any sample please ?
    thanks in advance
    Salu2 Sergio T

    You create a type to return and pass it as a type...
    Like this:
    http://stackoverflow.com/questions/20901419/how-to-call-stored-procedure-in-entity-framework-6-code-first
    context.Database.SqlQuery<YourEntityType>("storedProcedureName",params);
    ps
    That was pretty easy to google, by the way.
    And... it's not really wpf.
    Shrug.
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • How to call a procedure from url

    hello,
    I'd like to call a procedure from the url. <br>
    I've tryed several ways to call that procedure, but none of it worked. <br><br>
    so can someone please tell me the correct syntax of such a call?<br>
    thanks in advance.

    Hi ,
    I have implemented this in one of my apps in the following way:
    - Created a database procedure (called download_file that accepts a parameter). This procedure opens a document stored in the database.
    - In a report region, in the Column Link attributes, I set the Link Text to "Download", set Target to "URL" and set URL to "#OWNER#.download_file?p_file=#MYFIELD#"
    Hope this helps.

  • How to call stored procedure from postgresql to jsp

    i'm using a jdeveloper.. and i'm a newbie of jsp.. i just wanna know how to call a stored procedure in jsp?... This is my function in postgres and i don't know how to call it in jsp...
    SELECT * from SP_1('2006-01-11') as ( company_code char(5), branch_category char(5), branch_code char(15), day_sales numeric(19,2), month_to_date numeric(19,2), no_of_transaction int8, month_to_date_py numeric(19,2), year_to_date numeric(19,2), year_to_date_py numeric(19,2), remarks text, time_reported text );

    hi again.. i'm using jsp in jdeveloper, i just wanna know how to declare double in jsp because my module is report and i need to get the average daily sales = 4500/ no. of transaction = 3. This is my code.. Where will i put the code in declaring the double and the average daily sales? Thanks in advance..
    <%@ page contentType="text/html;charset=windows-1252" import="java.sql.*,Connect.CRMCon"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    </head>
    <body>
    <%
    String ave = request.getParameter("ave_daily_sales");
    double cashsales = Double.parseDouble(ave);
    %>
    <%
    logparameters data = new logparameters();
    data.txtbox = request.getParameter("txtbox");
    %>
    <table cellspacing="3" cellpadding="2" border="1" width="100%">
    <tr>
    <td width="5%" bgcolor="#cccccc" height="29">
    <DIV align="center">Company Code</DIV>
    </td>
    <td width="4%" bgcolor="#cccccc" height="29">
    <DIV align="center">Branch Category</DIV>
    </td>
    <td width="6%" bgcolor="#cccccc" height="29">
    <DIV align="center">Branch Code</DIV>
    </td>
    <td width="8%" bgcolor="#cccccc" height="29">
    <DIV align="center">Day Sales</DIV>
    </td>
    <td width="9%" bgcolor="#cccccc" height="29">
    <DIV align="center">Month to Date</DIV>
    </td>
    <td width="5%" bgcolor="#cccccc" height="29">
    <DIV align="center">No.of Transaction</DIV>
    </td>
    <td width="9%" bgcolor="#cccccc" height="29">
    <DIV align="center">Month to Date(PY)</DIV>
    </td>
    <td width="9%" bgcolor="#cccccc" height="29">
    <DIV align="center">Ave.Daily Sales to Date</DIV>
    </td>
    <td width="9%" bgcolor="#cccccc" height="29">
    <DIV align="center">Year to Date</DIV>
    </td>
    <td width="9%" bgcolor="#cccccc" height="29">
    <DIV align="center">Year to Date(PY)</DIV>
    </td>
    <td width="9%" bgcolor="#cccccc" height="29">
    <DIV align="center">Remarks</DIV>
    </td>
    <td width="5%" bgcolor="#cccccc" height="29">
    <DIV align="center">Time Reported</DIV>
    </td>
    </tr>
    <%
    try
    CRMCon ccon = new CRMCon();
    Connection con = ccon.getConnection();
    String sql = "select * from sp_1('"+data.txtbox+"')";
    // String sql = "SELECT * from SP_1('"+ request.getParameter("data.txtbox")+"')" ;
    sql += " as (company_code char(5), branch_category char(5) ," ;
    sql += "branch_code char(15) , day_sales numeric(19,2)," ;
    sql += "month_to_date numeric(19,2), no_of_transaction int8," ;
    sql += "month_to_date_py numeric(19,2), year_to_date numeric(19,2)," ;
    sql += "year_to_date_py numeric(19,2), remarks text, time_reported text) " ;
    //out.println(sql);
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery(sql);
    while (rs.next())
    %>
    <tr>
    <td width="13%"> <%= rs.getString("company_code") %> </td>
    <td width="63%"> <%= rs.getString("branch_category") %> </td>
    <td width="24%"> <%= rs.getString("branch_code") %> </td>
    <td width="24%"> <%= rs.getString("day_sales") %> </td>
    <td width="24%"> <%= rs.getString("month_to_date") %> </td>
    <td width="24%"> <%= rs.getString("no_of_transaction") %> </td>
    <td width="24%"> <%= rs.getString("month_to_date_py") %> </td>
    <td width="24%"> <%= rs.getString("year_to_date") %> </td>
    <td width="24%"> <%= rs.getString("year_to_date_py") %> </td>
    <td width="24%"> <%= rs.getString("remarks") %> </td>
    <td width="24%"> <%= rs.getString("time_reported") %> </td>
    </tr>
    <%
    catch (Exception ex)
    out.println("Error:"+ex.getMessage());
    %>
    </table>
    </body>
    </html>
    <%!
    class logparameters
    public String txtbox;
    %>

  • How to call stored procedures from java program?

    I have tried to run a program that calls a stored procedure on MySQL
    server version 5.0.17 by using connector/j 5.0, but it always fails on the
    statement: con.preparecall() ,
    have looked on the internet and found out that people can all mysql
    stored procedure all right in their programs, really dont know what's
    wrong with this small peiece of code:
    import java.sql.*;
    public class TestDB {
          // procedure being called is:
         CREATE PROCEDURE `dbsaystorm`.`getsite` ()
         BEGIN
            select  name  from tblsite;
         END
         public static void main(String[] args) {
              try  {
                  //Class.forName("org.gjt.mm.mysql.Driver");
                  Class.forName("com.mysql.jdbc.Driver");
                  Connection con = DriverManager.getConnection("jdbc:mysql://localhost/dbname",
                            "user", "pwd");
           * executing SQL statement here gives perfect correct results:
            // PreparedStatement ps = con.prepareStatement("select name from tblsite");      
            // ResultSet rs =ps.executeQuery();
                  // but in stored procedure way...
                  //it fails here on this prepare call statement:             
                  CallableStatement proc = con.prepareCall("call getsite()");
                  ResultSet rs =proc.executeQuery();                      
                  if (rs == null) return;                                      
                  while (rs.next()){                 
                      System.out.println("site name is: "+ rs.getString(1));                                
                  rs.close();
              } catch (SQLException e) {e.printStackTrace();}
               catch (Exception e) {e.printStackTrace();}         
    }it always gives this exception:
    java.lang.NullPointerException
         at com.mysql.jdbc.StringUtils.indexOfIgnoreCaseRespectQuotes(StringUtils.java:959)
         at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1280)
         at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3668)
         at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:638)
         at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:453)
         at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4365)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4439)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4413)
         at saystorm.server.data.database.TestDB.main(TestDB.java:29)
    where have I gone wrong?
    when I commented out the statement that makes the procedure call and call preparedstatement to execute SQL select statement, it gave perfectly correct result.
    it looks like there is no problem with java prog accessing MYSQL server database, but the it seems that it's just java can't call stored procedure stored on the mysql server version 5.
    can it or can't it? if it can, how is that accomplished?

    It is a bug in the driver because it shouldn't be
    returning that exception (null pointer) even if you
    are doing something wrong.
    Are you using the latest version of the driver?
    The stored procedure runs when you run it from the
    gui/command line using a MySQL tool - correct?
    As suggested you should be using the brackets. What
    is the data type of the 'name' field?
    You could try returning another value like one of the
    following
    select 1, name from tblsite;
    select name, 1 from tblsite;
    That might get around the bug
    Additionally try just the following...
    select 'test' from tblsite;yes, the driver used is in connector/j 5.0--the lastest one, and the
    procedure can run correctedly at either command line or GUI mode
    with no problem whatsoever, the returned data type is string type,
    I have not got the chance to test it again with those values you
    suggested, as I have abandoned the laptop I used to write that code
    initately. There have been some other really weird cases happened on
    that computer. I guess that must be something wrong with the JVM
    installed on it, it was upgraded from jre5.0.04 to 06, and to 09.
    something within hte JVM must have been messed up(the only reasonable
    explanation). Because the same code runs correctly on my new laptop,
    using the same environment: jvm 5.0_09, mysql 5.0.18, connector/J 5.0.
    that old laptop really was a nightmare.

  • Need urgent help - how to call a procedure from sql returning a rowset

    Hello,
    I need to send a SQL Query from a VB application to let it execute on the oracle DB. This query needs to call a procedure/function, which returns a resultsets, so that i can to a (Where x in ( <call procedure> )). Would result in Where x in (50,100,3094).
    Is this possible in oracle, and how?
    Thanks.
    Daniel Meyer

    Hi Daniel,
    I had a similiar problem yesterday.
    Thanks to the nice people in this forum I was able to figured that out.
    So here is a PL/SQL Oracle 9i code for your reference.
    You can create and test it using the SQL Plus console.
    I used this stored procedure in my VB .NET and worked fine!
    I am enclosing the VB code in this reply as well.
    One last note: in order to test it in the VS .NET, don't forget to download the Oracle ODP driver for .NET
    Good luck!
    Amintas
    create or replace package pkg_emp
    AS
    type rc_emp is ref cursor;
    end;
    create or replace
    procedure SP_GetEmpData(v_empno IN emp.empno%Type,
    v_ename IN emp.ename%Type,
    emp_cur OUT pkg_emp.rc_emp)
    is
    begin
    if v_empno is not null and v_ename is null then
    OPEN emp_cur for
    select empno,ename,sal
    from emp
    where empno=v_empno;
    elsif v_ename is not null and v_empno is null then
    OPEN emp_cur for
    select empno,ename,sal
    from emp
    where ename like v_ename ||'%';
    end if;
    end;
    /* Testing the stored procedure */
    /*#1 */
    var myresultset refcursor;
    execute SP_GetEmpData(7900,null,:myresultset);
    print myresultset;
    /*#2 */
    var myresultset refcursor;
    execute SP_GetEmpData(null,'A',:myresultset);
    print myresultset;
    -x-x-x-x-x-x-x-x-x VB .NET CODE x-x-x-x-x-x-x-xx-x-
    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcurar.Click
    Dim dr As Oracle.DataAccess.Client.OracleDataReader
    Try
    If txtEmpNo.Text <> "" Then
    dr = GetData(CInt(Val(txtEmpNo.Text)), "")
    Else
    dr = GetData(0, UCase(txtEname.Text))
    End If
    txtEmpNo.Text = ""
    txtEname.Text = ""
    Catch ex As Exception
    Response.Write(ex)
    End Try
    drgTest.DataSource = dr
    drgTest.DataBind()
    End Sub
    Private Function GetData(ByVal v_empno As Integer, ByVal v_ename As String) As Oracle.DataAccess.Client.OracleDataReader
    Dim cn As New Oracle.DataAccess.Client.OracleConnection(ConfigurationSettings.AppSettings("ConnectionString"))
    Dim cmd As New Oracle.DataAccess.Client.OracleCommand
    Dim dr As Oracle.DataAccess.Client.OracleDataReader
    cmd.Connection = cn
    cmd.CommandType = CommandType.StoredProcedure
    cmd.CommandText = "SP_GetEmpData"
    cmd.Parameters.Add("v_empno", Oracle.DataAccess.Client.OracleDbType.Int32).Value = IIf(v_empno = 0, System.DBNull.Value, v_empno)
    cmd.Parameters.Add("v_ename", Oracle.DataAccess.Client.OracleDbType.Varchar2, 40).Value = IIf(v_ename = "", System.DBNull.Value, v_ename)
    cmd.Parameters.Add("rc_emp", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output
    Try
    cn.Open()
    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
    Catch ex As Exception
    Throw ex
    Exit Function
    End Try
    Return dr
    End Function

  • How to call a procedure from database executing commandButton...

    Hello.
    I´m using Jdev 10.1.3.2, I´d like to know how can I execute a procedure from database when I click a command button..??
    is that possible?
    thanks again.

    Yes, it's possible.
    Since you don't say anything about technologies you are using, I will assume ADF Business Components and JSF.
    You can write a service method in your application module - see Section 25.5 of the ADF Developer's Guide for Forms/4GL Developers
    Then, you can drag-and-drop the service method from the data control palette on to your JSF page and select ADF Command Button when you drop.
    You will, in all likelyhood, find numerous examples when you search the forum as well.
    John

  • How to call stored procedure from javascript? (about Google Suggest, AJAX)

    Hi I want to implement a text field so that it behaves like [Google Suggest|http://www.google.com/webhp?complete=1&hl=en] .
    I read this post .
    Now I've setup everything according to that document. But it just doesn't work. And I don't know why.
    I think problems may fall into the following three categories:
    1. Does the text field and the page invoke the proper javascript?
    2. Does the javascript successfully call the stored procedure?
    3. Can the stored procedure correctly return the formatted result?
    I am affirmative for 1 and 3, but I'm not sure about 2. Because I don't know how to tell if a stored procedure has been called? Is there a PL/SQL statement that I can query in SQL*Plus?
    Also, I would to know how to debug AJAX in APEX. It involves many things.
    Last, I used APEX 3.2 and Oracle XE. I cannot find either dads.conf or marvel.conf file. Is "/apex/" the virtual directory for APEX?
    Thanks a lot!

    Hello,
    I recently also ran into problems with this and I will post my solution here:
    1) if you need to pass parameters to your procedure, create it using "Flexible Parameter Passing". Then parse the parameters out of the array and put them in local variables inside your PL/SQL procedure.
    Example:
    CREATE OR REPLACE PROCEDURE MATTHIASH.incsearch(name_array IN owa.vc_arr,
         value_array IN owa.vc_arr) as
      l_List1 varchar2(4000);
      l_List2 varchar2(4000);
      l_query varchar2(255);
      l_separator varchar2(10) default '';
      qu varchar2(4000) default '';
      hl varchar2(4000) default '';
    BEGIN
      FOR i IN 1 .. name_array.COUNT 
      LOOP
           IF name_array(i) = 'qu' THEN
                qu := value_array(i);
           ELSIF name_array(i) = 'hl' THEN
                hl := value_array(i);
           END IF;
      END LOOP;
      l_query := qu||'%';
      FOR x IN (
      select object_name, object_id from user_objects
      where upper(object_name) like upper(l_query) and upper(object_type) = upper(hl) order by 1 asc)
      LOOP
        l_list1 := l_List1 || l_separator || '"' || x.object_name || '"';
        l_list2 := l_List2 || l_separator || '"' || x.object_id || '"';
        l_separator := ',';
      END LOOP;
      owa_util.mime_header('text/html', false);
      owa_util.http_header_close;
      --htp.p('sendRPCDone(frameElement, "'|| qu ||'", new Array(' || l_List1 || '), new Array(' || l_List2 || '), new Array(""));');
      htp.p('sendRPCDone(frameElement, "' || qu || '", new Array(' || l_List1 || '), new Array(' || l_List2 || '), new Array(""));');
    END;
    /2) grant EXECUTE rights to APEX_PUBLIC_USER (the user APEX uses to connect to the database) on the procedure
    grant execute on incsearch to apex_public_user;3) upload the ac.js file as static file to your application
    4) put the following javascript code in the HTML Header of your APEX page:
    <script src="#WORKSPACE_IMAGES#ac.js" type="text/javascript"></script>
    <script language="JavaScript" type="text/javascript">
    function iac()
    InstallAC(document.wwv_flow,document.getElementById('P1_X'),"","!MATTHIASH.incsearch","&P1_OBJECT_TYPE.");
    </script>In my example, P1_X is a text field and P1_OBJECT_TYPE is a dropdown list with all user object types.
    Good luck,
    Matthias Hoys

  • How to Call a Procedure from SQL ?

    Hi All,
    I've a procedure defined like the below taking IN/OUT parameters as table type.
    PROCEDURE "SAP_HANA_DEMO"."usersCreateMethod" (IN row "SAP_HANA_DEMO"."User.Details",
    OUT error "SAP_HANA_DEMO"."EPM.Procedures.tt_errors")
    Now, how do i call it from SQL ?
    I'm trying to call it like
    CALL "SAP_HANA_DEMO"."usersCreateMethod"('my_global_table','?');
    It says
    Could not execute 'CALL "SAP_HANA_DEMO"."sap.hana.democontent.epm.Procedures::usersCreateMethod"('my_global_table','?')'
    SAP DBTech JDBC: [1288]: expression cannot be used as an assignment target: '?': line 1 col 97 (at pos 96)
    Thanks & Regards
    Sakthivel

    Hi ,
    You should call like this
    Define a variable of your table type.
    Define ErrorMessage SAP_HANA_DEMO"."EPM.Procedures.tt_errors"
    CALL "SAP_HANA_DEMO"."usersCreateMethod"('my_global_table',ErrorMessage);
    Regards,
    Krishna Tangudu

Maybe you are looking for