Creating a procedure to return a select
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Creating a procedure to return a select

  1. #1
    Join Date
    Feb 2001
    Location
    Belgium, Sint-Truiden
    Posts
    82
    All,

    we're trying to create a procedure which does a select (via a cursor?) and returns the results of this query to a Java program.
    Can any help us with this?
    The biggest problem is to make the procedure with the correct types, ...

    Thx,

    Rik

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Feb 2001
    Posts
    184
    Hi,

    Better to Use a Package.
    Declare any Variable as Ref Cursor and then Open that Ref Cusror for any Select Statement.

    Create or Replace Package Mypack
    is
    TYPE EmpCurType is REF Cursor;
    Procedure Empname (EmpCur IN OUT EmpCurType,
    Id IN Number);
    End;


    Create or Replace Package body Mypack
    is
    Procedure Empname (EmpCur IN OUT EmpCurType,
    Id IN Number)
    is
    Begin
    Open EmpCur for Select Ename, Job, Sal from emp
    Where Empno = Id;
    End;
    End;

    Hope this will Give you the Idea that you are LOoking for.

    Thanks.. Qaisar




  4. #4
    Join Date
    Feb 2001
    Location
    Belgium, Sint-Truiden
    Posts
    82
    Thx a lot,

    looks great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width