Calling Function in Stored Procedure

Hi all,
I've created table below,
CREATE TABLE TEST
  ID                  NUMBER(3)    NOT NULL,
  selectcode          VARCHAR2(10),
  value_use           VARCHAR2(10),
  bin_no              NUMBER(10),
  markup              VARCHAR2(40),
  descr               VARCHAR2(100),
  value_imp           VARCHAR2(90)
create sequence idseq;
insert into test values (idseq.nextval,'rel','C1',1,'master','test1');
insert into test values (idseq.nextval,'rel','C1',1,'masterdir','test2');
insert into test values (idseq.nextval,'rel','C1',2,'master','test3');
insert into test values (idseq.nextval,'rel','C2',2,'masterdir','test4');
insert into test values (idseq.nextval,'rel','C2',2,'master','test5');
insert into test values (idseq.nextval,'rel1','C2',1,'master','test6');
insert into test values (idseq.nextval,'rel1','C2',1,'masterdir','test7');
select * from test;
ID     SELECTCODE     VALUE_USE      BIN_NO     MARKUP                  DESCR
1         rel                C1              1     master                  test1
2         rel                C1              1     masterdir          test2
3         rel            C1              2     master                  test3
4         rel                C2            2     masterdir          test4
5         rel                C2              2     master                  test5
6         rel1        C2              1     master                   test6
7         rel1           C2              1     masterdir            test6There is an existing function called valcon which returns data for value_imp based on value_use and markup in the table.
SQL>select valcon ('C1','master',' ','VALUE',' ') output from dual;
OUTPUT
Value In County
I created a stored procedure, to insert values to this table using this function.. But I'm not sure how to pass the value inside the function..
CREATE OR REPLACE PROCEDURE test_sp
  ( in_selectcode    IN varchar2,
    in_valueuse      IN varchar2
AS
cursor val_cur is
    select *
    from test
    where ....;
TYPE val_typ IS TABLE OF val_cur%ROWTYPE;
val_arr  val_typ;
begin
open cursor..
fetch cursor into val_arr;
FOR ..
  LOOP
     insert into test (id, selectcode, value_use, selectval,value_imp)
     select  id_seq.nextval, in_selectcode, 'C1',  Nvl2(Trim(in_selectcode),'Y','N'),
     valcon ('val_arr.value_use','val_arr.markup',' ','VALUE',' ')
     from dual;
end loop;
close cursor;
end;
end test_sp
/ Since i'm using an array, can you please tell me how I can pass 'val_arr.value_use' as a string in the function? I researched a lot to find this, but I couldnt find how I can do this.
Thank you

I've used an update query to update test.bin_no in a sequence for the same selectcode and value_use. But I'm trying to see if I can do this within the insert query so I dont have to duplicate the work with one insert and one update.
The procedure below works with update query:
CREATE TABLE TEST
  ID                  NUMBER(3)    NOT NULL,
  selectcode          VARCHAR2(10),
  value_use           VARCHAR2(10),
  bin_no              NUMBER(10),
  markup              VARCHAR2(40),
  descr               VARCHAR2(100),
  value_imp           VARCHAR2(90)
create sequence idseq;
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C1',1,'Y');
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C1',1,'Y');
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C1',2,'Y');
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C2',2,'Y');
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C2',2,'Y');
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel1','C2',1,'Y');
insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel1','C2',1,'Y');
select * from test;
ID     SELECTCODE     VALUE_USE      BIN_NO     VALUE_IMP     
1         rel                C1              1     Y           
2         rel                C1              2     Y         
3         rel            C1              2     Y          
4         rel                C2            2     Y  
5         rel                C2              2     Y                
6         rel1        C2              1     Y            
7         rel1           C2              1     Y      
CREATE OR REPLACE PROCEDURE test_sp (in_selectcode   IN VARCHAR2,
                                     in_valueuse     IN VARCHAR2
                                    ) AS
  msg   VARCHAR2 (4000);
BEGIN
  INSERT INTO test (id, selectcode, value_use, bin_no, selectval, value_imp
    SELECT   id_seq.NEXTVAL,
             in_selectcode,
             'C1',
             bin_no,
             NVL2 (TRIM (in_selectcode), 'Y', 'N'),
             valcon (value_use, markup, ' ', 'VALUE', ' ')
    FROM     kn_job
    WHERE    scode= in_selectcode;
     update test t
     set t.bin_no = (select t1.r from
              (select rowid, ROW_NUMBER() OVER(PARTITION BY in_selectcode, in_valueuse ORDER BY id asc) r from test) t1
              where t.rowid=t1.rowid);
end test_sp
select * from test;
ID     SELECTCODE     VALUE_USE      BIN_NO     VALUE_IMP     
1         rel                C1              1     Y           
2         rel                C1              2     Y         
3         rel            C1              3     Y          
4         rel                C2            1     Y  
5         rel                C2              2     Y                
6         rel1        C2              1     Y            
7         rel1           C2              2     Y       But is it possible to do this without an update query? Updating bin_no in a sequence for selectcode,value_use?
Thanks

Similar Messages

  • Need to call funtion in stored procedure to run one customized report

    Hi,
    I need to call one function in stored procedure for our customized report. Can anyone please help me in calling the function in stored procedure and provide the syntax for the same.
    Thanks,
    Kalpana.

    Either open an existing report. You'l see so many examples.
    or
    http://www.google.co.in/#hl=en&source=hp&biw=1024&bih=586&q=call+function+in+stored+procedure+sql&aq=1&aqi=g2g-m2&aql=&oq=Call+function+in+stored&gs_rfai=&fp=dbefe777997d3915

  • Call to Oracle stored procedure that returns ref cursor doesn't work

    I'm trying to use an OData service operation with Entity Framework to call an Oracle stored procedure that takes an number as an input parameter and returns a ref cursor. The client is javascript so I'm using the rest console to test my endpoints. I have been able to successful call a regular Oracle stored procedure that takes a number parameter but doesn't return anything so I think I have the different component interactions correct. When I try calling the proc that has an ref cursor for the output I get the following an error "Invalid number or type of parameters". Here are my specifics:
    App.config
    <oracle.dataaccess.client>
    <settings>
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.0" value="implicitRefCursor metadata='ColumnName=WINDFARM_ID;BaseColumnName=WINDFARM_ID;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Number;ProviderType=Int32'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.1" value="implicitRefCursor metadata='ColumnName=STARTTIME;BaseColumnName=STARTTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.2" value="implicitRefCursor metadata='ColumnName=ENDTIME;BaseColumnName=ENDTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.3" value="implicitRefCursor metadata='ColumnName=TURBINE_NUMBER;BaseColumnName=TURBINE_NUMBER;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.4" value="implicitRefCursor metadata='ColumnName=NOTES;BaseColumnName=NOTES;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.5" value="implicitRefCursor metadata='ColumnName=TECHNICIAN_NAME;BaseColumnName=TECHNICIAN_NAME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    </settings>
    OData Service Operation:
    public class OracleODataService : DataService<OracleEntities>
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
    // Examples:
    config.SetEntitySetAccessRule("*", EntitySetRights.All);
    config.SetServiceOperationAccessRule("GetWorkOrdersByWindfarmId", ServiceOperationRights.All);
    config.SetServiceOperationAccessRule("CreateWorkOrder", ServiceOperationRights.All);
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    [WebGet]
    public IQueryable<GetWorkOrdersByWindfarmId_Result> GetWorkOrdersByWindfarmId(int WindfarmId)
    return this.CurrentDataSource.GetWorkOrdersByWindfarmId(WindfarmId).AsQueryable();
    [WebGet]
    public void CreateWorkOrder(int WindfarmId)
    this.CurrentDataSource.CreateWorkOrder(WindfarmId);
    Here is the stored procedure:
    procedure GetWorkOrdersByWindFarmId(WINDFARMID IN NUMBER,
    P_RESULTS OUT REF_CUR) is
    begin
    OPEN P_RESULTS FOR
    select WINDFARM_ID,
    STARTTIME,
    ENDTIME,
    TURBINE_NUMBER,
    NOTES,
    TECHNICIAN_NAME
    from WORKORDERS
    where WINDFARM_ID = WINDFARMID;
    end GetWorkOrdersByWindFarmId;
    I defined a function import for the stored procedure using the directions I found online by creating a new complex type. I don't know if I should be defining the input parameter, WindfarmId, in my app.config? If I should what would that format look like? I also don't know if I'm invoking the stored procedure correctly in my service operation? I'm testing everything through the rest console because the client consuming this information is written in javascript and expecting a json format. Any help is appreciated!
    Edited by: 1001323 on Apr 20, 2013 8:04 AM
    Edited by: jennyh on Apr 22, 2013 9:00 AM

    Making the change you suggested still resulted in the same Oracle.DataAccess.Client.OracleException {"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETWORKORDERSBYWINDFARMID'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"}     System.Exception {Oracle.DataAccess.Client.OracleException}
    I keep thinking it has to do with my oracle.dataaccess.client settings in App.Config because I don't actually put the WindfarmId and an input parameter. I tried a few different ways to do this but can't find the correct format.

  • Error when call sql server stored procedure

    hello everybody,
    I'm working with MII 14 and I want call a SqlServer stored procedure provided from my customer.
    I configured a FixedQuery like this:
    [dbo].[spElencoEntrateUscite_AV] @delta = 0, @daquando='130101', @CompanyID='000002', @Elenco = @MyCursor OUTPUT
    but when i test the query i have back the error:
    com.microsoft.sqlserver.jdbc.SQLServerException: Must declare the scalar variable "@MyCursor".
    I tried also to set the query like this:
    [dbo].[spElencoEntrateUscite_AV]
    and pass Parameters:
    0
    130101
    000002
    OUTPUT
    but i have this error:
    com.microsoft.sqlserver.jdbc.SQLServerException: Procedure or function 'spElencoEntrateUscite_AV' expects parameter '@Elenco', which was not supplied.
    Any suggestion?
    thanks in advance
    Alex

    hello Kuldeep!
    yes i solved.
    I used fixed query in MII and declared the cursor:
    example:
    DECLARE @MyCursor CURSOR
    EXEC [dbo].[spElencoEntrateUscite_AV] @delta = 0,@daquando='[Param.1]', @CompanyID='[Param.2]', @Elenco = @MyCursor OUTPUT
    I hope this may help u
    Alessandro

  • Out of memory error when calling a java stored procedure multiple times

    Trying to run a PL/SQL loop calling a java stored procedure, I get the following error:
    "ORA-04030: out of process memory when trying to allocate 262188 byte callheap,ioc_allocate free)"
    (with some other error lines).
    The stored procedure does two major things:
    1) Open a socket to communicate with a server, of which it queries some data.
    2) Use JDBC (with the default DB connection it has, as a stored procedure) to write the results to a table.
    All socket connections, statements, etc. are properly closed and all memory should be garbage collected between each call.
    Can anyone offer an explanation or additional checks to make? I'm quite sure the code isn't causing the problem, since I've tried running it as a stand alone application (outside of Oracle) and didn't have any problems.
    Thanks.

    Hi,
    Verify that the database parameters are set correctly.
    EA

  • SQLException: Cursor is closed while calling a java stored procedure

    Hi,
    I got the following error when trying to read from a cursor of a java stored procedure:
    java.sql.SQLException: Cursor is closed
    The java procedure is stored in the database and wrapped by a sql call. Then another java class executes the sql call.
    The stored procedure looks like this:
    import java.io.Reader; import java.security.MessageDigest; import java.sql.*; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleConnection; public class test { static Connection conn = null; static String username = null; static String password = null; static Integer userid  = null; public static void main(String args[]) throws Exception {     username = "keller";     password = "945435";     login(username, password); }       public static String login(String in_username, String in_password) {     String access = null;     String password = null;         try {             DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());  // Non OracleVM             System.out.print("Verbindung wird initialisiert... ");             conn =         //DriverManager.getConnection("jdbc:default:connection:");           //conn.setAutoCommit(false);             DriverManager.getConnection("jdbc:oracle:thin:@[...]:1521:[...]","[...]","[...]");             System.out.println("OK");                         System.out.print("Logindaten werden ueberprueft... ");             String sql = "SELECT matrikelnr, password FROM student WHERE name = ?";             PreparedStatement pstmt = conn.prepareStatement(sql);             pstmt.setString(1, in_username);             ResultSet rset = pstmt.executeQuery();             while (rset.next())             {             userid = rset.getInt(1);                 password = rset.getString(2);             }             access = "student";                         pstmt = conn.prepareStatement(sql);             if (password == null) {             sql = "SELECT dozentnr, password FROM dozent WHERE name = ?";                 pstmt = conn.prepareStatement(sql);                 pstmt.setString(1, in_username);                 rset = pstmt.executeQuery();                 while (rset.next())                 {             userid = rset.getInt(1);                     password = rset.getString(2);                                     }                 pstmt = conn.prepareStatement(sql);                 if (password == null) {                   throw new SQLException("User nicht gefunden!");                 }                 access = "dozent";             }             //rset.close(); // Resultset schließen             //pstmt.close(); // Statement schließen                         // MD5 Hash vergleichen             MessageDigest md5 = MessageDigest.getInstance("MD5");             md5.reset();             md5.update(in_password.getBytes());             byte[] result = md5.digest();             StringBuffer hexString = new StringBuffer();             for (int i=0; i<result.length; i++) {               if(result[i] <= 15 && result[i] >= 0){                 hexString.append("0");               }               hexString.append(Integer.toHexString(0xFF & result));
    if (password != null) {
    if (password.equals(hexString.toString())) {
    System.out.println("OK");
    } else {
    throw new Exception("Falsches Passwort!");
    catch(SQLException e) {
    System.err.println("SQL Fehler!");
    System.err.println(e.getMessage());
    catch(Exception e) {
    System.err.println("Fehler!");
    System.err.println(e.getMessage());
    return access;
    public static void getLeistungsschein(int matrikelnr, ResultSet[] rout)
    ResultSet rs = null;
    try
    System.out.print("Berechtigung ueberpruefen... ");
    if (userid != matrikelnr)
    throw new Exception("Zugriff verweigert, keine Berechtigung!");
    int mnr = matrikelnr;
    ((OracleConnection)conn).setCreateStatementAsRefCursor(true);
    PreparedStatement ps = conn.prepareStatement("select bezeichnung, note from klausur inner join leistungsschein on klausur.KLAUSURNR=leistungsschein.KLAUSURNR where matrikelnr= ?");
    ps.setInt(1, mnr);
    rs = (ResultSet)ps.executeQuery();
    rout[0]= rs;
    catch(SQLException e) {
    System.err.println("Fehler!");
    System.err.println(e.getMessage());
    catch(Exception e) {
    System.err.println("Fehler!");
    System.err.println(e.getMessage());
    The sql call:
    create or replace
    procedure pgetleistungsschein(matrikelnr in number, cur OUT refcurpkg.refcur_t) is
    language java name 'Klausurverwaltung.getLeistungsschein(int, java.sql.ResultSet[])';
    And finally the wrapper is called by another java programm, see this:
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.List;
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OracleResultSet;
    import oracle.jdbc.OracleTypes;
    public class cursortest {
    public static void main(String[] args) {
    try{
    //-- Oracle Treiber laden
    Class.forName( "oracle.jdbc.driver.OracleDriver" );
    Connection c = DriverManager.getConnection( "jdbc:oracle:thin:@sligo.fh-trier.de:1521:ubuntu", "dbsem_java","javajava");
    CallableStatement stmt = null;
    ResultSet rs1 = null;
    int matrnr = 945098;
    // Call PLSQL Stored Procedure
    stmt = (CallableStatement)c.prepareCall("{ call ? := getklausuren(?) }");
    stmt.setInt(2, matrnr);
    // 2nd parameter is OUT paremeter
    stmt.registerOutParameter(1, OracleTypes.CURSOR);
    // Execute the callable statement
    stmt.execute();
    //Cursor in ResultSet einlesen
    rs1 = ((OracleCallableStatement)stmt).getCursor(1);
    ResultSetMetaData rsmd = rs1.getMetaData();
    int anzSpalten = rsmd.getColumnCount();
    List<String[]> zeilen = new ArrayList<String[]>();
    while(rs1.next())
    String[] zeile = new String[anzSpalten];
    for (int i=1; i<=anzSpalten; i++)
    zeile[i-1]=rs1.getString(i);
    zeilen.add(zeile);
    String[][] array_angeb_klaus = (String[][])zeilen.toArray(new String[zeilen.size()][anzSpalten]);
    //**** ENDE
    rs1.close();
    stmt.close();
    //c.close();
    catch (SQLException e){
    System.out.println(e);
    catch (ClassNotFoundException f){
    System.out.println(f);

    On top of what jschell says, this just looks wrong in terms of how Oracle's internal Java works as well.
    [Have a look here |http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/refcur/index.html] (unless things have changed significantly over the past few years for Oracle Java).
    Is the db you are querying a different one to the one this Java is stored in?

  • Error Calling a simple stored procedure

    Hello. I'm using the code below to call a simple stored procedure which returns a number. Why does it throw the exception (Also below)?
    Thank you,
    Alek
    =======================
    Code:
    import java.sql.*;
    public class Connect
    public static void main (String[] args)
    Connection conn = null;
    //CallableStatement stmtMySQL = null;
    long local_callkey = 0;
    try
    Class.forName("com.mysql.jdbc.Driver");
    String userName = "abc";
    String password = "def";
    String url = "jdbc:mysql://mysqlserver/sxma";
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();
    conn = DriverManager.getConnection (url, userName, password);
    System.out.println ("Database connection established");
    String theMySQLCall = "{?=call sxma.sp_getnumber()}";
    CallableStatement stmtMySQL = conn.prepareCall(theMySQLCall);
    stmtMySQL.registerOutParameter(1, Types.INTEGER);
    stmtMySQL.execute();
    int res = stmtMySQL.getInt(1);
    if(res!=0)
    throw new Exception("MySQL Query exception return code: " + String.valueOf(res) + ")");
    else
    local_callkey = stmtMySQL.getLong(1);
    System.out.println("Local key is: " + local_callkey);
    catch (Exception e)
    System.err.println ("Cannot connect to database server!");
    e.printStackTrace();
    finally
    if (conn != null)
    try
    conn.close ();
    System.out.println ("Database connection terminated");
    catch (Exception e) { /* ignore close errors */ }
    ================
    Exception:
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.charAt(String.java:444)
         at com.mysql.jdbc.StringUtils.indexOfIgnoreCaseRespectQuotes(StringUtils.java:951)
         at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1277)
         at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3640)
         at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:506)
         at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:401)
         at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4072)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4146)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4120)
         at Connect.main(Connect.java:20)
    Thank you for your help

    Well, there's certainly something about that line that it doesn't like.
    I'm not really familiar enough with MySQL to remote-debug this one for you, but it seems to be dying while trying to reconcile that call to its metadata for the sproc. Check the sproc declaration -does it return a single out value? Or does it have a single out value in the parameter list (not the same thing, I think) ? And so on.
    Also, with the amended call that I provided is the failing stack trace identical, or slightly different? If different, could you post that too please?
    Finally, do you have a known good sproc call that you can sanity check against? Perhaps take one of the examples from the MySQL site and check that that will work with their reference code?

  • Function in stored procedure

    Hello,
    I'm using RPAD function in stored  procedure 4 times in one query and then inserting to another table. from dm_exec_sql_text table I see that every time that procedure approach to Rpad function it's open and closing in the and so it's open and closing
    function 4 times per one row, If I have 1000 rows to insert the function will open and close 4000 times and it's very slow.
    My question if there is some way to change this functionality of open / close function every time ?
    Thank You
    Daniel

    Yes, avoid using UDF  , means especially a scalar udf... See how you can re-write a scalar udf  as table valued udf.
    http://sqlblog.com/blogs/alexander_kuznetsov/archive/2008/05/23/reuse-your-code-with-cross-apply.aspx
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to call a sql stored procedure in java...... HELP

    Hi I am making an application for taking backup in sql automatically so i have created a dts package which is called by a stored procedure. Now the problem is that how to call that stored procedure in a Java program so that after running my java program i get my database backup.
    Please please solve my problem.
    thanks in advance.
    If possible please send the code.
    Message was edited by:
    Andy_Davis
    Message was edited by:
    Andy_Davis

    Hi... I am trying to create a dts package which is called by a stored procedure... How can i do this? IF possible can you please send me the code as well..
    Thanks a ton...
    Susan_Davis

  • How to call pl/sql stored procedure in JDBC query dialogbox

    Hi,
    how to call pl/sql stored procedure in JDBC query dialogbox(reports 9i) .
    Cheers,
    Raghu

    please refer : Re: problem If you have more doubts, please ask in that question.

  • How to call PL/SQL stored procedure using ODBC?

    Could anyone tell me how can I call PL/SQL stored procedure using
    ODBC? Are there any sample codes?
    Thanx!
    null

    You are correct on all counts, they all should work.
    Oracle Product Development Team wrote:
    : Hi,
    : I don't know the exact syntax in ODBC, but reasoning by analogy
    : with other API's, I'd bet one of the following works
    : (for a call to: procedure my_proc(n1 number, n2 number);):
    : "{ my_proc(1,2); }"
    : "{ call my_proc(1,2); }"
    : "{ begin my_proc(1,2); end }"
    : "begin my_proc(1,2); end;"
    : "begin my_proc(1,2); end"
    : Hope this helps. - Pierre
    : jiangbuf (guest) wrote:
    : : Could anyone tell me how can I call PL/SQL stored procedure
    : using
    : : ODBC? Are there any sample codes?
    : : Thanx!
    : Oracle Technology Network
    : http://technet.oracle.com
    null

  • How to call PL-SQL/stored procedure in Creator

    Anybody can tell how to call PL-SQL/Stored procedures inside creator...

    Hi!!!
    You can see this topic http://forum.sun.com/jive/thread.jspa?threadID=106046
    There is how to call oracle stored procedures. Also I put a lot of links in these topic doing reference stored procedures. I have one that it tells specially how to call oracle stored procedures from java, is in spanish but you can understand the code.;-)
    http://yoprogramador.vampisol.com/index.php?title=pl_sql_oracle_desde_java&more=1&c=1&tb=1&pb=1
    Byeee

  • Execution Times of Stored Procedures Called from Other Stored Procedures

    If I execute sys.dm_exec_procedure_stats, it will produce execution times of my stored procedures executed recently.
    However, stored procedures called from other stored procedures do not show up.
    Is there code that can return the execution times of stored procedures even though they are called from other stored procedures.

    Look at the example. It is counting nested execution.
    CREATE PROC z1SP AS SELECT * FROM Production.Product;
    GO
    CREATE PROC z2SP AS SELECT * FROM Production.Product WHERE Color is not null; EXEC z1SP;
    GO
    SELECT object_name(2002822197), object_name(2034822311);
    --z1SP z2SP
    EXEC z1SP; EXEC z2SP;
    GO 10
    SELECT * from sys.dm_exec_procedure_stats
    database_id object_id type type_desc cached_time last_execution_time execution_count
    16 2002822197 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.170 2014-12-16 13:02:46.717 20
    16 2034822311 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.460 2014-12-16 13:02:46.687 10
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Calling a Oracle Stored Procedure which will take a while to complete

    Hey.
    I'm calling a Oracle stored procedure which goes of and do a whole lot of things and therefore takes a fair while to complete.
    Currently I am doing this:
    String sql = "begin concorde.start_transfer(); end;";
    HibernateUtil.getSessionFactory().openStatelessSession().connection().prepareCall(sql).execute();
    ....Where HibernateUtil is just a mean to get to the SessionFactory. The connection I get is the same one as a JDBC, I think.
    I would want to regain control of the application as soon as the procedure is called and continue with the rest of the logic.
    How do I do that? Do I have to initiate it from a different thread?
    Thanks

    If it was me I wouldn't have a stored proc that took a while to complete. Instead I would submit a job to job queue. In terms of implementation I would call a proc that writes a record to a table. Then a process in the database polls that table and runs jobs it finds there. Then reports results somewhere.
    Sometime later you collect the results.
    But without that then the solution in java is obvious - create a thread.

  • Getting exception whil calling an oracle stored procedure from java program

    Dear All,
    I encounter this error in my application when I call only the stored procedure but the view is executing fine from the application and my environment is as follow:
    Java 1.4
    oracle 10g
    oracle jdbc driver:9.2.0.8.0
    websphere portal 6.0.0.1
    this error is occur from time to time randomly, when it happens, the only workaround is to restart the server..Does anyone have any idea about this error?
    Unable to execute stored Procedure in Method
    java.lang.NullPointerException
    at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java(Compiled Code))
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1140)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java(Compiled Code))
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java(Compiled Code))
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3606)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5267)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecute(WSJdbcPreparedStatement.java:632)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.execute(WSJdbcPreparedStatement.java:427)
    And sometime I am getting this exception
    Unable to execute stored Procedure in Method
    java.lang.ArrayIndexOutOfBoundsException: 27787320
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java(Compiled Code))
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1134)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java(Compiled Code))
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java(Compiled Code))
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3606)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5267)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecute(WSJdbcPreparedStatement.java:632)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.execute(WSJdbcPreparedStatement.java:427)
    Thanks
    Jay

    spacetorrent escribi&oacute;:
    for (int x=0; x <result.size(); x++){
    System.out.println(result.get(x));
    I can't do this, because result object is a Map, and I need write the Key of the Value to obtain.
    So I can do:
    result.get("res");And I odtain a *$Proxy3* Object

Maybe you are looking for

  • FSV for Customer Line Items.

    Hi All, We can set the Field Status for GL Accounts in OBC4. Now i want to set the Field Status for Customer Line Items. Can anybody suggest me where can we set the FSV for Customers & Vendors. With Warm Regards. Shekar.

  • Prettier way to do RMI?

    I don't like the RMI registry. I think it makes RMI ugly because: 1. Anybody using my application has to start it independently of my application. 2. It requires extra mucking about with the classpath to get my application to work. 3. From my code's

  • Computer Name Reverting to Old Name

    I have a Mac Mini running Server and use it for Profile Manager, File Sharing, Time Machine, VPN, DNS, and Open Directory. There are about 20 machines setup on this domain and I ran into an issue with a MacBook I wiped and am trying to use for a diff

  • Purely cosmetic - how to 'stretch' the block of color in a region

    This is not what I should be learning about right now, but..... what should I search for to learn about controlling the width of color used in a region - right now, the region widths vary, depending on the needs of the contents. It's too jumpy for me

  • Excell as a column

    hi,tnks in advance.... i have this scenario... I have my star schema.I have a column in my product_dimension,let;s say product.It contains all the products,at about 300.000 items.It connects ok with my fact table. i want this, if i want to choose , l