Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009
    Posts
    14

    Unanswered: Wrapping a select statement in pl/sql procedure

    Hello, Im new to pl/sql

    I am trying to wrap a pl/sql procedure around this sql select statement so I get the same output, but so I can supply the some of the where parameters as variables:

    SELECT go.sequence, ft.version, ft.released_title, ft.final_duration
    FROM FinishedTrack ft, GroupedOn go, Album a
    WHERE ft.originates_from = go.originates_from
    AND go.album_id = a.album_id
    AND a.is_distributed_as = 'c'
    AND a.title = 'My Feet'
    ORDER BY go.sequence;

    I have this so far, but I have erors I cannot fix And I still need to get it to display the output aswell.

    CREATE OR REPLACE PROCEDURE list_track
    (type_in CHAR,
    title_in VARCHAR)
    AS
    v_sequence NUMBER;
    v_version NUMBER;
    v_released_title VARCHAR(40);
    v_final_duration VARCHAR(40);
    BEGIN

    SELECT GroupedOn.sequence,
    FinishedTrack.version,
    FinishedTrack.released_title,
    FinishedTrack.final_duration
    INTO v_sequence, v_version, v_released_title, v_final_duration
    FROM FinishedTrack, GroupedOn, Album
    WHERE FinishedTrack.originates_from = GroupedOn.originates_from
    AND GroupedOn.album_id = Album.album_id
    AND Album.is_distributed_as = 'c'
    AND Album.title = 'My Feet'

    END list_track;
    /

    I would be extremly grateful with any help. Im not sure about having multiple coloumns and tables in the select into statements in procedures.

  2. #2
    Join Date
    Feb 2005
    Posts
    57
    At first glance there should be a ';' after 'My Feet'.
    You don't say what errors you are getting - please post.

    OK - Ignore this - I just saw you SECOND post on same subject!!
    Last edited by outrider; 05-18-09 at 06:25.

Posting Permissions

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