Results 1 to 5 of 5

Thread: [RESOLVED] pl/sql stored procedure

  1. #1

    Thread Starter
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Resolved [RESOLVED] pl/sql stored procedure

    My crash course in Oracle's PL/SQL and I was able to create a stored procedure already that runs fine, but this one it's complaining about the Join line in the query, can anyone spot the issue:
    Code:
    CREATE OR REPLACE PROCEDURE DISP_MARINA_SLIP_OWNER (I_SLIP_ID IN MARINA_SLIP.SLIP_ID%TYPE) AS
    I_MARINA_NUM MARINA_SLIP.MARINA_NUM%TYPE;
    I_SLIP_ID MARINA_SLIP.SLIP_ID%TYPE;
    I_BOAT_NAME MARINA_SLIP.BOAT_NAME%TYPE;
    I_OWNER_NUM MARINA_SLIP.OWNER_NUM%TYPE;
    I_FIRST_NAME OWNER.FIRST_NAME%TYPE;
    I_LAST_NAME OWNER.LAST_NAME%TYPE;
    
    BEGIN
    INTO I_FIRST_NAME, I_LAST_NAME, I_MARINA_NUM, I_SLIP_NUM, I_BOAT_NAME, I_OWNER_NUM
    SELECT o.FIRST_NAME, o.LAST_NAME, m.MARINA_NUM, m.SLIP_NUM, m.BOAT_NAME, m.OWNER_NUM
    FROM OWNER o
      INNER JOIN MARINA_SLIP m
        ON o.OWNER_NUM = m.OWNER_NUM
    WHERE m.SLIP_ID = I_SLIP_ID;
    
    DBMS_OUTPUT.PUT_LINE(I_MARINA_NUM);
    DBMS_OUTPUT.PUT_LINE(I_SLIP_ID);
    DBMS_OUTPUT.PUT_LINE(I_BOAT_NAME);
    DBMS_OUTPUT.PUT_LINE(I_OWNER_NUM);
    DBMS_OUTPUT.PUT_LINE(I_FIRST_NAME);
    DBMS_OUTPUT.PUT_LINE(I_LAST_NAME);
    END;
    /
    Last edited by JuggaloBrotha; Mar 31st, 2016 at 07:13 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: pl/sql stored procedure

    INNER JOIN MARINA_SLIP

    needs to be

    INNER JOIN MARINA_SLIP m

    since you alias with m. later on - right?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: pl/sql stored procedure

    I'd neglected that when I copied it in, my original script had that alias and isn't the problem.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: pl/sql stored procedure

    What is it complaining about exactly?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: pl/sql stored procedure

    Issue ended up being I was using a variable with the same name as a column, I changed that variable to a different name and it works fine.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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