I had to create the package and body separately. Here is an example:

create or replace
package otn_ref_cursor as
  -- used to illustrate passing a ref cursor
  -- as a return value from a function
  -- or as an output parameter from a procedure
  procedure get_emp_info(emp_name IN varchar2,p_rc out sys_refcursor);

end;
///////////
create or replace package body otn_ref_cursor as
procedure get_emp_info(emp_name IN VARCHAR2, p_rc out sys_refcursor) is
  begin
    -- open the cursor using the passed in ref cursor
    -- sys_refcursor is a built in type
    open p_rc for
    select employee_id,
             first_name,
             last_name
             hire_date
    from     employees
    where    last_name Like upper(emp_name)||'%';
    end;
end;


Hope this helps.



On Thu, Oct 15, 2009 at 1:59 AM, niraj <parihar.nirajsi...@gmail.com> wrote:

>
> Could you please send me the solution through which u'd solved your
> problem
>
> On Sep 26, 10:41 pm, Richard Ford <richardfor...@gmail.com> wrote:
> > Thanks for your help. I was able to solve the problem.
> >
> > On Thu, Sep 24, 2009 at 8:34 PM, Michael Moore <michaeljmo...@gmail.com
> >wrote:
> >
> >
> >
> > > I'm not sure I solved your problem since I was unable to replicate the
> > > problem.
> > > Mike
> >
> > > On Thu, Sep 24, 2009 at 5:16 PM, Richard Ford <richardfor...@gmail.com
> >wrote:
> >
> > >> Thank you. I am a newbie to Oracle ,coming from a SQL server
> background.
> >
> > >> Regards,
> > >> Richard
> >
> > >> On Sep 24, 2009, at 6:00 PM, Michael Moore <michaeljmo...@gmail.com>
> > >> wrote:
> >
> > >> can you post the entire package spec as well as the body?
> > >> also try this:
> >
> > >> CREATE OR REPLACE PACKAGE BODY select_job_history
> > >> AS
> > >>    TYPE t_cursor IS REF CURSOR;
> >
> > >>    PROCEDURE getjobhistorybyemployeeid(
> > >>       p_employee_id    IN       NUMBER,
> > >>       cur_jobhistory   OUT      t_cursor )
> > >>    IS
> > >>    BEGIN
> > >>       OPEN cur_jobhistory FOR
> > >>          SELECT *
> > >>            FROM employees
> > >>           WHERE employee_id = p_employee_id;
> > >>    END getjobhistorybyemployeeid;
> > >> END select_job_history;
> > >> /
> >
>  > >> On Thu, Sep 24, 2009 at 2:59 PM, R.F. < <richardfor...@gmail.com>
> > >> richardfor...@gmail.com> wrote:
> >
> > >>> Hello,
> > >>> Can someone help me get this to compile. I get the ERROR at line 9:
> > >>> PLS-00103: Encountered the symbol "BEGIN" when expecting one of the
> > >>> following:
> >
> > >>>   language
> > >>> 7. )
> > >>> 8. IS
> > >>> 9. BEGIN
> > >>> 10.     OPEN cur_JobHistory FOR
> > >>> 11.     SELECT * FROM employees
> >
> > >>> CREATE OR REPLACE PACKAGE BODY SELECT_JOB_HISTORY AS TYPE T_CURSOR IS
> > >>> REF CURSOR ;
> > >>> PROCEDURE GetJobHistoryByEmployeeId
> > >>> (
> > >>>    p_employee_id IN NUMBER,
> > >>>    cur_JobHistory OUT T_CURSOR
> > >>> )
> > >>> IS
> > >>>  BEGIN
> > >>>      OPEN cur_JobHistory FOR
> > >>>      SELECT * FROM employees
> > >>>          WHERE employee_id = p_employee_id;
> > >>>  END GetJobHistoryByEmployeeId;
> > >>> END SELECT_JOB_HISTORY;
> >
> > >>> Thanks in advance.
> >
> > --
> > Regards,
> >
> > Richard Ford
>
> >
>


-- 
Regards,

Richard Ford

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to