Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: cursor problem



Frank wrote:
> 
> mcstock wrote:
> 
> > read the error messages carefully -- you'll discover the problem on line 15;
> > the error should be self-explanatory
> >

> 
> I only see the missing comma on line 10 (or beginning of line 12)
> --
> Regards, Frank van Bortel

There are a number of typos and other errors (eg: is it really
dbms_output.put.line).  The one mcs refers to in particular:

from the code:
15            and branch_id = branchnum;

from the message:
15/15    PL/SQL: ORA-00918: column ambiguously defined

elsewhere in the code:
13      where branches.branch_id = book_copies.branch_id

Care to comment which branch_id line 15 refers to?

---------------------------
Almost seems like homework.  And almost seems like someone really
doesn't understand it.  

I'm curious though - why a procedure instead of:

select  'BRANCHID IS: '|| branch_id || chr(*) ||   
        'BRANCH NAME IS: '|| branch_name ||chr(*) ||
        'BRANCH ADDRESS IS: '|| address ||chr(*) ||
        'BRANCH BOOK INFO: ' ||chr(*) ||
        'BOOKID: '|| book_id ||
        ' BOOK TITLE: '|| title||  
        'no_of_copies '|| no_of_copies
  from branches, books, book_copies
 where branches.branch_id = book_copies.branch_id
   and book_copies.book_id = books.book_id
   and branch_id = :branchnum;

(of course replacing the chr(*) with the appropriate cr/lf).  

(If the assignment was to do this in a procedure, I'd probably be
looking for another school - the idea of teaching someone to even
consider a procedure instead of a straight select for this is
staggering.)



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.