Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:20:31+00:00 2026-05-30T10:20:31+00:00

This is my first run through with PL SQL so I might be making

  • 0

This is my first run through with PL SQL so I might be making some sort of silly error.
I am trying to write a procedure in Oracle Express Edition 11g. I am running into an error that has to do with my WITH clause in the procedure body.

Whenever I try and run it I see two errors.

Error report:
ORA-06550: line 14, column 50:
PL/SQL: ORA-00918: column ambiguously defined
ORA-06550: line 12, column 7:
PL/SQL: SQL Statement ignored
ORA-06550: line 29, column 3:
PLS-00306: wrong number or types of arguments in call to 'FIND_HIGH_AVG'
ORA-06550: line 29, column 3:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

Code for the procedure is found below.

DECLARE 
  myTerm courses.term%type;
  myLine courses.lineno%type;

procedure find_high_avg (term IN courses.term%type, 
                        line IN courses.lineno%type,
                        s_fname OUT students.fname%type,
                        s_lname OUT students.lname%type,
                        s_sid OUT students.side%type,
                        s_avg OUT number) is 
  begin 
      WITH grades as (select * from components co --line 12 here
            join scores sc on co.term = sc.term and co.lineno = sc.lineno and CO.COMPNAME = SC.COMPNAME
            where sc.lineno = line and sc.term = term) --line 14 here
      select * 
      into s_fname, s_lname, s_sid, s_avg 
      from (
          select s.fname, s.lname, s.sid, round(sum(points/maxpoints * weight),0) as AV
          from grades, students
          join students s on grades.sid = s.sid
          group by s.sid, s.fname, s.lname
          order by AV)
      where rownum = 1;   
  end; 

BEGIN
  myTerm:='F12';
  myLine:='1031';
  find_high_avg(myTerm, myLine); --line 29 here
END;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:20:33+00:00Added an answer on May 30, 2026 at 10:20 am

    The error at line 10 occurs because parameters to stored procedures do not take a length. The procedure declaration should be something like

    procedure find_high_avg (term IN courses.term%type, 
                            line IN courses.lineno%type,
                            s_fname OUT students.fname%type,
                            s_lname OUT students.lname%type,
                            s_sid OUT students.side%type,
                            average OUT number) 
    is
    

    The error at line 14 is likely because the parameters to your procedure have the same name as columns in your table. In a SQL statement’s scope resolution rules, column names take precedence over local PL/SQL variables. So when you code something like

    sc.term = term
    

    Oracle tries to resolve the unqualified TERM using a column in one of the tables. If both tables have a column named TERM, that generates an ambiguous column reference– Oracle doesn’t know which of the two tables to use. Of course, in reality, you don’t want it to use the column from either table, you want it to use the parameter. The most common approach to this problem is to add a prefix to your parameter names to ensure that they do not collide with the column names. Something like

    procedure find_high_avg (p_term IN courses.term%type, 
                            p_line IN courses.lineno%type,
                            s_fname OUT students.fname%type,
                            s_lname OUT students.lname%type,
                            s_sid OUT students.side%type,
                            p_average OUT number) 
    is
    

    The error on line 29 occurs because the procedure takes 6 parameters– 2 IN and 4 OUT. In order to call it, therefore, you would need to use 6 parameters. Something like

    DECLARE 
      myTerm courses.term%type;
      myLine courses.lineno%type;
    
      l_fname students.fname%type;
      l_lname students.lname%type;
      l_sid   students.side%type;
      l_avg   number;
    BEGIN
      myTerm:='F12';
      myLine:='1031';
      find_high_avg(myTerm, myLine,l_fname,l_lname, l_sid, l_avg); 
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load some java stored procedures into an Oracle 10g database through
This is my first crack at a method that is run periodically during the
when I run this code for the first time <?php session_start(); echo SID; ?>
Ok, I've run across my first StackOverflowError since joining this site, I figured this
I'm trying to look through an array of records (staff members), in this loop,
I am trying to run this example http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDataSourceExample.java?view=markup but somehow I am not able
This is my first MVC/Linq to SQL Application. I'm using the out of the
We are trying to set up a cursor to run through records generated from
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
Saw this piece of code in a Ruby on Rails book. This first one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.