Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    1

    Unanswered: PL/SQL Stored Procedure

    Hi,
    I am basically migrating from TSQL to PL/SQL, there we can have a simple select command inside SP... but if i do the same in Oracle 9i it throws error:
    Something like...
    create or replace procedure myproc()
    is
    begin
    select * from trial;
    end myproc;

    Thanks

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    > it throws error:
    Error? what error? I don't see any error?
    Rhetorical question -
    > select * from trial;
    INTO where is the result set placed?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Try this:
    Code:
    create or replace procedure myproc(p_resultset out sys_refcursor)
    is
    begin
    open p_resultset for
    select * from trial;
    end myproc;
    /

  4. #4
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    Or try:

    FOR rec IN (select * from trial) LOOP
    -- do whatever...
    END LOOP;
    JoeB
    save disk space, use smaller fonts

Posting Permissions

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