Procedure with Return statement

Hi,
Below is my code. Am trying to return a value without a out parameter in the procedure. Is out parameter is mandatory to return a value in a procedure. Please help.
CREATE OR REPLACE
PROCEDURE P123(
    PID NUMBER)
AS
  VCOUNT NUMBER;
BEGIN
  SELECT COUNT(*) INTO VCOUNT FROM EMP WHERE EMPNO=PID;
  IF (VCOUNT=1) THEN
    RETURN 1;
  ELSE
    RETURN 0;
  END IF;
END;Thanks

Hi,
When a procedure encounters a RETURN statement, it Returns the control, back to the calling program. In the below example, P1 is calling P2. When P2 encounters a RETURN statement, control is passed back to P1 procedure and "Out of p2 procedure" message is printed as per below example.
Note: No further execution happens in P2 procedure when return is encountered.
create or replace procedure P1
as
Begin
p2;
dbms_output.put_line('Out of the p2 procudure");
end;
create or replace procedure P2
as
begin
dbms_output.put_line('calculation 1");.......
return;
dbms_output.put_line('calculation 2");
end;
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Report with stored proc running multiple stored procedures with insert statement

    Hi,
    I wonder if this is possible in SSRS ... I use the 2012 version (Data Tools).
    I have a report that triggers a stored procedure. See below.
    Within this SP there are 2 insert statements getting data from 2 other SP's.
    When I make a dataset referring to the main SP below, SSRS does not show me any fields at all.
    Is this because it's a SP with insert statements and nested SP's?
    At the end of the SP I make a select so it should see all the fields.
    The parameters @month and @costcenter are multivalue params. I use a special function to convert the multivalues, selected in the report, into a string to pass it correctly to the query (comma separated).
    USE [TestDB]
    GO
    /****** Object:  StoredProcedure [dbo].[_Pink_SP_StandingsRegisterDataset]    Script Date: 15-4-2014 13:31:30 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[_Pink_SP_StandingsRegisterDataset]
    @year INT,
    @month NVARCHAR(50),
    @costcenter NVARCHAR(500),
    @GLaccount NVARCHAR(9)
    AS
    BEGIN
    /* Remove existing content*/
    DELETE FROM _Pink_TB_StandingsRegister
    /* Add records part 1 */
    INSERT INTO _Pink_TB_StandingsRegister
    EXEC _Pink_SP_StandingsRegister @year, @month, @costcenter, @GLaccount
    /* Add records part 2 */
    INSERT INTO _Pink_TB_StandingsRegister
    Type,
    Row,
    Year,
    Month,
    YearDatetable,
    MonthDatetable
    EXEC _Pink_SP_StandingsRegisterDatetable @year
    /* Select all records */
    SELECT *
    FROM _Pink_TB_StandingsRegister
    END
    GO

    Hi bijntjede2e,
    After testing a similar scenario in my own environment, it works well in Reporting Services. In my test, the stored procedure returns all the fields from _Pink_TB_StandingsRegister table in the dataset. Then I select some values from year, month, costcenter
    and Glaccount parameters, it inserts some values in the _Pink_TB_StandingsRegister table. So we can use this stored procedure as the dataset in the report.
    In order to solve the problem more efficiently, I need to clarify some information.
    Are you pass multiple values parameter to one stored procedure correctly? We can refer to the following thread:
    http://social.technet.microsoft.com/Forums/en-US/dbdfa101-cccc-4e9f-aa50-566dc5ebcc27/ssrs-2008-r2-report-dataset-call-a-stored-procedure?forum=sqlrep
    What results are you get when executing the stored procedure in SQL Server Management Studio? Is it works well? We should double those stored procedures.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Help with return statements

    Can someone explain to me what a return statement does exactly and how I would use it to return a value in the follwoing type of program.
    Its a array making program that allows up to 25 values with the value 0 stopping the method. I need to be able to display the how many usable values the user input (anywhere from 1-25).
    To do this I need to use a return statement, correct? if so, how do utilize it correctly if it is nesasary I will post the code itself.

    Heres what I have for the code...
    To simplify amounbt of typing(I wrote program in telnet) The beginning is a set of options using switch statement. 4 choices, 1)new data. 2) list the data 3) change the data and 4) exit.
    For the new data I need to have the user input up to 25 values or stop at any time by entering 0. the values also cannot be greater than 12000 or less than -12000. it should also return the number of usable values in the array. The return statement is what I am having trouble with.
    Code...
    static int NewData(double a[]) //This part is not changeable
    {   int 1;
    for(i=0; i<25; i++)
    {  System.out.print("Enter Element"+(i +1)+ "- ");
    a=MyInput.readDouble();
    if (a[i]>12000 || a[i]<-12000)
    {System.out.println("the last value is not valid");
                                 break;}
    if (a[i]==0)
    break;
    } return i;
    As of right now the method functions as is but two things need to be changed or added. If possible the program should now break if the user inputs an element greater than 12000 or less than -12000, it should just reset to the integer they were on. Also, how do I get the return value to display something? have i used it correctly to show the number of usable values ithe user entered?

  • Adding more columns on a stored procedure with return rows

    Not a very easy subject heading to define, but I'll explain more now:
         PROCEDURE sp_Load_Quote (p_cursorQuote IN OUT cursorPromo, p_QuoteID IN varchar) IS
         thissql varchar(1000);
         templateType varchar(50) default '';
         templateID number default -1;
         BEGIN
               select pa.TEMPLATEID, pt.tool into templateID, templateType
               from  ppt_answer pa, ppt_template pt
               where pa.quoteid = ''' || p_QuoteID || '''
               AND pa.templateid = pt.templateid
               and rownum = 1;          
               thissql :=     'SELECT q.*, sq.SESSIONID, qp.QUOTEID as PartQuoteID, qp.VPEC_CODE, qp.PEC_CODE, qp.Quantity as PartQuantity, qp.description as PartDescription, qp.ptype, qp.MSRP, qp.WPP, qp.NPP, qp.isPackage, cu.symbol as currency, '|| templatetype ||' as templateType, '|| templateID ||' as templateID ';
               thissql :=     thissql || 'FROM Quote q, tblsavedquote sq, tblsavedquoteparts qp, thecurrency cu ';
                thissql :=     thissql || 'where q.QuoteID = qp.QuoteID (+) ';
                thissql :=     thissql || 'and sq.QuoteID = q.QuoteID ';
               thissql :=     thissql || 'and q.QuoteID = ''' || p_QuoteID || ''' ';
               thissql :=     thissql || 'and q.currencyid = cu.currencyid ';
               open p_cursorQuote FOR thissql;
               begin
                      Execute immediate thissql;
               end;
         END sp_Load_Quote;The error I get is
    "Exception - SMBDataAccess.clsQuote.loadFromDB - ORA-01403: no data found ORA-06512: at "MARKETING_ADMIN.PKG_SMBTOOL", line 438 ORA-06512: at line 1"
    It could be to do with the first select statement where I put the two values into 2 variables ( templatetype and templateID )
    I am unsure

    Any idea what the problem is? In regards of your error message, a query return no row...
    If you want avoid such thing, you need to manage exceptions like below for example :
    BEGIN
    BEGIN
               select pa.TEMPLATEID, pt.tool into templateID, templateType
               from  ppt_answer pa, ppt_template pt
               where pa.quoteid = p_QuoteID --remove quotes here, no need
               AND pa.templateid = pt.templateid
               and rownum = 1;          
    EXCEPTIONS WHEN OTHERS THEN dbms_output.put_line(sqlerrm);
    END;
               thissql :=...Nicolas.

  • Problem in Stored Procedure with DBMS_OUTPUT statement

    Hi All,
    I am facing a problem in the stored procedure.
    In the stored procedure I am picking records from the table and displaying them in the screen using dbms_output.put_line statement. This works fine if my query fetches few records but in case of many records(84000 records) then the oracle application gets hanged.

    1) How (if at all) does this relate to SQLJ/JDBC? I assume there is some relationship because of the forum you're posting to, so I'm trying to understand whether that relationship is germane to the problem you are having.
    2) Why are you writing 86,000 rows of output to the dbms_output buffer? Why wouldn't your stored procedure return a REF CURSOR to your Java application and just have the Java application iterate through those rows?
    Justin

  • Call procedure with return cursor

    Dear All,
    there is a cast with my job. i have procedure like below:
    CREATE OR REPLACE PROCEDURE ISISALL.P_TEST (PARAM1 IN VARCHAR2,RETURN_TABLE OUT SYS_REFCURSOR) IS
    BEGIN
    OPEN RETURN_TABLE FOR
    SELECT FIELD2,FIELD3 FROM MYTABLE
    WHERE FIELD1=PARAM1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END P_TEST;
    my question, How to call the procedure ? i want insert table with source from the procedure (P_TEST)..

    >
    How to call the procedure ? i want insert table with source from the procedure (P_TEST)..
    >
    This code sample that you can test in the SCOTT schema should give you enough information
    CREATE OR REPLACE TYPE SCOTT.local_type IS OBJECT (
        empno   NUMBER(4),
        ename   VARCHAR2(10));
    CREATE OR REPLACE TYPE SCOTT.local_tab_type IS TABLE OF local_type;
    CREATE OR REPLACE PACKAGE SCOTT.test_refcursor_pkg
    AS
        TYPE my_ref_cursor IS REF CURSOR;
         -- add more cursors as OUT parameters
         PROCEDURE   test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor);
    END test_refcursor_pkg;
    CREATE OR REPLACE PACKAGE BODY SCOTT.test_refcursor_pkg
    AS
         PROCEDURE  test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor)
         AS
            l_recs local_tab_type;
         BEGIN
             -- Get the records to modify individually.
             SELECT local_type(empno, ename) BULK COLLECT INTO l_recs
             FROM EMP;
             -- Perform some complex calculation for each row.
             FOR i IN l_recs.FIRST .. l_recs.LAST
             LOOP
                 DBMS_OUTPUT.PUT_LINE(l_recs(i).ename);
             END LOOP;
             -- Put the modified records back into the ref cursor for output.  
             OPEN p_ref_cur_out FOR
             SELECT * from TABLE(l_recs);      
             -- open more ref cursors here before returning
         END test_proc;
    END;
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
      l_cursor  test_refcursor_pkg.my_ref_cursor;
      l_ename   emp.ename%TYPE;
      l_empno   emp.empno%TYPE;
    BEGIN
      test_refcursor_pkg.test_proc (l_cursor);
      LOOP
        FETCH l_cursor
        INTO  l_empno, l_ename;
        EXIT WHEN l_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
      END LOOP;
      CLOSE l_cursor;
    END;
    /Are you sure you wouldn't be better off using a PIPELINED function instead? Then you can just select from it as if it were a table and do whatever you want with the data
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
    select * from table(get_emp(20))

  • Problem with return statement...

    hey guys!
    i'm new to this forum so don't be angry if i post or do something wrong :) anyway, my problem:
    i have a litle method that checks if a file exist and if it exist i want it to return true.
    the real problem is that when a if&else statement checks if the method is true or false
    it dont care if the method has returned false it just thinks it's true.
    well it's kind of hard to explain so just take a look at the code, output and then u will understand :)
    import java.io.*;
    public class task1_11 {
    public static void main(String[] args) {
        System.out.println("does file exist?");
        boolean o= check();
        if(o=false){
               System.out.println("File didn't exist");
             System.out.println("discard sending info...");
        else if (o=true){
              System.out.println("ok");
             System.out.println("Sendning information...");
             ListMovies LM = new ListMovies();
             LM.loanMovie();
             LM.go();
        else{
    public static boolean check(){
            File fi = new File("D:\\out2.txt");
    if (fi.exists()){
    System.out.println("file exist");
    System.out.println("returning true");
    return true;
    else {
    System.out.println("file don't exist");
      System.out.println("returning false");
        return false;
    }when i run this code the output is:
    does file exist?+
    file don't exist+
    returning false+
    ok+
    Sendning information...+

    I guess it should be like this:
    import java.io.*;
    public class task1_11 {
    public static void main(String[] args) {
        System.out.println("does file exist?");
        boolean o= check();
    // '=' is for assignment, '==' is for comparison
        if(o==false){
               System.out.println("File didn't exist");
             System.out.println("discard sending info...");
        else if (o==true){
              System.out.println("ok");
             System.out.println("Sendning information...");
             ListMovies LM = new ListMovies();
             LM.loanMovie();
             LM.go();
        else{
    public static boolean check(){
            File fi = new File("D:\\out2.txt");
    if (fi.exists()){
    System.out.println("file exist");
    System.out.println("returning true");
    return true;
    else {
    System.out.println("file don't exist");
      System.out.println("returning false");
        return false;
    }

  • About:call procedure with returned resultset

    how can i do for that?
    thanks!

    CREATE OR REPLACE FUNCTION selectAllEmployments
    RETURN SYS_REFCURSOR
    AS
    st_cursor SYS_REFCURSOR;
    BEGIN
    OPEN st_cursor FOR
    SELECT EMPLOYEE, EMPLOYER,
    STARTDATE, ENDDATE,
    REGIONCODE, EID, VALUE, CURRENCY
    FROM EMPLOYMENT;
    RETURN st_cursor;
    END;
    To use this query in Hibernate you need to map it via a named query.
    <sql-query name="selectAllEmployees_SP" callable="true">
    <return alias="emp" class="Employment">
    <return-property name="employee" column="EMPLOYEE"/>
    <return-property name="employer" column="EMPLOYER"/>
    <return-property name="startDate" column="STARTDATE"/>
    <return-property name="endDate" column="ENDDATE"/>
    <return-property name="regionCode" column="REGIONCODE"/>
    <return-property name="id" column="EID"/>
    <return-property name="salary">
    <return-column name="VALUE"/>
    <return-column name="CURRENCY"/>
    </return-property>
    </return>
    { ? = call selectAllEmployments() }
    </sql-query>

  • Can we use return statement in procedure?

    Can we use return statement in procedure or we can use more than one return statement in procedure?

    HamidHelal wrote:
    NOReally? Did you at least test it? You can use RETURN in procedure or in anonymous PL/SQL block. The only restriction is you can't specify return value:
    SQL> begin
      2      dbms_output.put_line('Before return');
      3      return;
      4      dbms_output.put_line('After return');
      5  end;
      6  /
    Before return
    PL/SQL procedure successfully completed.
    SQL> create or replace
      2    procedure p1
      3      is
      4      begin
      5          dbms_output.put_line('Before return');
      6          return;
      7          dbms_output.put_line('After return');
      8  end;
      9  /
    Procedure created.
    SQL> exec p1;
    Before return
    PL/SQL procedure successfully completed.
    SQL> begin
      2      dbms_output.put_line('Before return');
      3      return 99;
      4          dbms_output.put_line('After return');
      5  end;
      6  /
        return 99;
    ERROR at line 3:
    ORA-06550: line 3, column 5:
    PLS-00372: In a procedure, RETURN statement cannot contain an expression
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> create or replace
      2    procedure p1
      3      is
      4      begin
      5          dbms_output.put_line('Before return');
      6          return 99;
      7          dbms_output.put_line('After return');
      8  end;
      9  /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE P1:
    LINE/COL ERROR
    5/9      PL/SQL: Statement ignored
    5/9      PLS-00372: In a procedure, RETURN statement cannot contain an
             expression
    SQL> SY.

  • Help with dynamic statement returning values into collection

    Hi All
    I am trying to use dynamic statement to return values into a collection using the returning clause. However, I get an ORA-00933 error. Here is a simple setup:
    create table t(
        pk number,
        id_batch varchar2(30),
        date_created date,
        constraint t_pk primary key ( pk )
    create or replace type num_ntt is table of number;
    create or replace type vc2_ntt is table of varchar2(30);
    create or replace
    package pkg
    as
      type rec is record(
          pk        num_ntt,    
          id_batch  vc2_ntt
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
    end pkg;
    create or replace
    package body pkg
    as
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
      is
      begin
          execute immediate '
          insert into t
          select level, ''x'' || level, sysdate
          from   dual
          connect by level <= :p_count
          returning pk, id_batch into :pk, :id_batch'
          using p_count returning bulk collect into p_rt.pk, p_rt.id_batch;
      end p;
    end pkg;
    declare
      r  pkg.rec;
    begin
      pkg.p( 5, r );
    end;
    /

    sanjeevchauhan wrote:
    but I am working with dynamic statement and returning multiple fields into a collection.And using an INSERT...SELECT statement combined with a RETURNING INTO clause still does not work. Whether it's dynamic SQL or not: it doesn't work. The link describes a workaround.
    By the way, I don't see why you are using dynamic SQL here. Static SQL will do just fine. And so you can literally copy Adrian's setup.
    Regards,
    Rob.

  • How to use stored procedure with many return results and variable with perl

    Hi everybody,
    i´m writtting now a Perl programm, wich use a oracle stored procedure with more than 1 result and 1 variable(I have to return 2 variable fpr each result). I don´t now how I can get it.I already search the web but I didn´t find.
    My example:
    PROCEDURE get_projects_and_sub_projects (
    v_project_id IN INTEGER,
    v_project_c_id OUT INTEGER,
    v_project_id_find OUT VARCHAR2
    IS
    BEGIN
    SELECT c_id, proj_id
    INTO
    v_project_c_id,
    v_project_id_find
    FROM t_projet
    WHERE t_projet .ksa_pro_art_kbz = 'KU'
    AND t_projet.proj_id LIKE v_project_id || '%';
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    v_project_c_id := NULL;
    v_project_id_find := NULL;
    WHEN OTHERS
    THEN
    kmessages.error (NULL,
    'get_projects_and_sub_projects',
    'Project-Name: ' || v_project_id,
    'Errornumber: '
    || SQLCODE
    || ' Error: '
    || SQLERRM,
    TRUE,
    TRUE
    raise_application_error (-20001,
    'Error '
    || SQLCODE
    || ' get_projects_and_sub_projects: '
    || SQLERRM,
    TRUE
    END get_projects_and_sub_projects;
    in Perl Program:
    sub get_projects_unterprojects_name($$){
    my ($db_handle, $proj_name_id) = @_; #$db_handle ist the DB Connection return value
    my $db_proj_c_id;
    my $db_proj_name;
    eval{ my $csr = $db_handle->prepare(q{
    BEGIN
    pro_doc_ber.get_projects_and_sub_projects(:proj_name_id, :db_proj_c_id, :db_proj_name);
    END;
    # parameter value
    $csr->bind_param(":proj_name_id", $proj_name_id);
    # return values
    $csr->bind_param_inout(":db_proj_c_id", \$db_proj_c_id, 11);
    $csr->bind_param_inout(":db_proj_name", \$db_proj_name, 20);
    $csr->execute(); };
    But this didn´t work. Could somebody give me some idea?
    Thank you
    Felx

    Some additional info would probably be helpful.
    What is your programming enviironment? Java?
    In any case I suspect that you will need to use the OCI to deal with specific Oracle types such as user defined object types -- thats not standard ANSI SQL.
    In Java I believe you need to use OPAQUE, there are some examples out there. I'm mostly a PL/SQL developer with some Java expereince so others here are more qualifed to answer your question more directly.

  • Sequence.nextval doubles the returned value with Execute Statement (F9)

    There appears to be a quirk with sequences in Raptor.
    Has anyone noticed that depending on how you execute this sql (SELECT MYSEQ.NEXTVAL FROM DUAL;) the value returned is either the correct nextval or double what you expected?
    For example, MYSEQ is a simple sequence which increments by 1. If you Execute Statement (F9) then the value returned jumps by 2 instead of 1. If you Run Script (F5) then the value returns jumps by 1, as expected.
    If MYSEQ is changed to increment by 2. The when you Execute Statement (F9) then the value returned jumps by 4 instead of 2. If you Run Script (F5) then the value returns jumps by 2, as expected. No matter what you put for the increment by Execute Statement (F9) always doubles it.
    It always seems to be double. Executing the same scenario in TOAD always returns the correct value (i.e. properly increments).
    Is the query being executed multiple times with Execute Statement? Why is this happening?

    While there is no guarantee from Oracle that sequences produce sequential numbers, this is obviously a case where SQL Developer is running the select statement twice.
    The issue is that queries can actually change information, rather than just retrieve data from the database.
    The following package is a test case:
    create or replace package test_query is
    function get_next_count return number;
    end;
    create or replace package body test_query is
    cnt number := 0;
    function get_next_count return number is
    begin
    cnt := cnt + 1;
    return cnt;
    end;
    end;
    select test_query.get_next_count from dual;
    This query, which should return 1, 2, 3, 4, etc actually returns 2, 4, 6, 8, etc, because SQL Developer is running the select twice.

  • Help with a return statement please!

    hey, just hoping somone can help me with this return statement
    i have to add a method called "specialReport" this method takes a year as it's parameter. if the parameter is not a year between 1930 and 1969 inclusive it displays an error message, "not a valid year"
    if the parameter is a valid year, then it compares the parameter with the year field. if they are the same, and is the movie has been rented at least five times, the method will display the message "a good year for movies" if the years are different or the movie has NOT been rented at least five times, the method displays the message "try a different year"
    btw, the Year field is : yearReleased
    all help is very much appreciated!

    public void specialReport(int year){
       //add functionality to process here
       return;
    }

  • How in ColdFusion with in variables get a Oracle stored procedure to return values?

    How in ColdFusion with in variables get a Oracle stored procedure to return values?
    We have tried several things, we can get  a stored procedure to return a result set if we are not passing in variables but we cannot get them when we are passing in variables.
    We know how to do it calling  MS SQL.
    Thanks for any help,
    Nathan Sr
    P.S. we have heard this may not be possible with the current Oracle Driver is there a different Oracle driver?

    I can only barely understand what you're asking here (not from a technical perspective, but from understanding your written English), but I suspect you're wanting to know how to pass back values other than recordsets from Oracle?
    You should be able to pass them back via a type=out proc param, shouldn't you?
    If you could reword your post so it's a bit more coherent, and possibly post some code, that might help.
    Adam

  • Help! Need oracle help with constructing stored procedure that return resultsets

    Suns tutorial path for returning resultsets from stored procedures indicates that the following should work...
    CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
    ResultSet rs = cs.executeQuery();
    Thats if you build your stored procedure something like this ...
    String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP_NAME, COFFEES.COF_NAME " + "from SUPPLIERS, COFFEES " + "where SUPPLIERS.SUP_ID = COFFEES.SUP_ID " + "order by SUP_NAME";
    We are using oracle 8.1.6. However I've been told that with oracle procedures when you return a result set from a called procedure you return a p_cursor variable. Somthing like this
    (p_cursor in out SHOW_SUPPLIERS.SHOCurTyp)
    is
    begin
    open p_cursor for
    select * from suppliers
    In which case the above mentioned sun code doesn't work.
    We want to use jdbc to call a stored procedure that returns a resultset that does not require us to import any proprietary oracle objects...
    Is there another way to write these stored procedures, rather than using this cursor construct? Are we missing something in the way we invoke them?

    Suns tutorial path for returning resultsets from stored procedures indicates that the following should work...
    CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
    ResultSet rs = cs.executeQuery();
    Thats if you build your stored procedure something like this ...
    String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP_NAME, COFFEES.COF_NAME " + "from SUPPLIERS, COFFEES " + "where SUPPLIERS.SUP_ID = COFFEES.SUP_ID " + "order by SUP_NAME";
    We are using oracle 8.1.6. However I've been told that with oracle procedures when you return a result set from a called procedure you return a p_cursor variable. Somthing like this
    (p_cursor in out SHOW_SUPPLIERS.SHOCurTyp)
    is
    begin
    open p_cursor for
    select * from suppliers
    In which case the above mentioned sun code doesn't work.
    We want to use jdbc to call a stored procedure that returns a resultset that does not require us to import any proprietary oracle objects...
    Is there another way to write these stored procedures, rather than using this cursor construct? Are we missing something in the way we invoke them?

Maybe you are looking for

  • Error while trying to register user to iFS 9.0.1

    Hi , We are getting following error while trying to register user with our custom application. When I checked the forums it says the unique constraint might be the problem but I don't see any unique constraint violation in my exception trace. We are

  • Design Standard CS 5.5 serial number not working for Photoshop

    I am trying to install the Design Standard CS 5.5 but am having trouble with Photoshop.  All of the programs installed and open correctly except for Photoshop.  When I try to launch it, the Adobe Application Manager comes up saying that the serial nu

  • XML structure of the request message

    Hi Experts, I am working on synchronous scenario .Net Appl ->SAP-XI -> SAP ECC The request from .Net Application will consists of 6 fields. A field : Mandatory B field : Mandatory C field : Mandatory  and should be able to read multiple line item D f

  • Info about deleted request ( log )

    Hi experts, i deleted the request over cube. I received info about request-id and "request number" in log. Can i obtain more info about this request, which was deleted ( e.g. InfoSource, DataSource) in any SAP table ? Thanks in advance Martin

  • Working with Nested Sequences

    I'm working with a 1 hour, 20 minute multi-cam (2 cameras) Sequence of a concert, with many edits. One of the music pieces was complicated, so I separated it out into a separate Sequence, and did the editing. Later, my occasional fcp tutor created a