Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to fix these bugs!!!

Re: How to fix these bugs!!!

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1997/03/05
Message-ID: <331ced8a.672867@nntp.mediasoft.net>#1/1

You will have to not use select * but

select ?.co_url, ?.co_name, ?.year from from firms f ,Co_bg c ,FileUrl u where f.co_name='A' and f.co_id=c.co_id and f.co_id=u.co_id order by f.co_name;

where you need to figure out whether the ? is f, c, or u. The problem is you have dup column names in f, c, and c (eg: f.co_id=c.co_id implies co_id is in more then one table). Hence, you would need to alias them to be unique (to dereference them in the cursor)....

To alias you would:

select a.co_id a_co_id, b.co_id b_co_id from A a, B b where......

On Tue, 4 Mar 1997 21:10:14 +0800, Wingyu <im_hwyaa_at_stu.ust.hk> wrote:

>
>Hello all,
>
>I am now doing a project and in which I need to use Oracle to
>provide a service for the users to search a company from a list of
>companies. In order to do this, firstly, I want to allow the users to
>search this by choosing the first character of a company name, e.g. "A"
>But there are bugs in my oracle program and I don't know how to fix
>them. Could you give some suggestions to me?
>
>Thanks!
>
>Connie
>
>--------------------------------------------------------------------------
>The following is the message after compile:
>
>
>LINE/COL ERROR
>
>-------- -----------------------------------------------------------------
>14/2 PLS-00402: alias required in SELECT list of cursor to avoid
> duplicate column names
>
>14/2 PL/SQL: Statement ignored
>---------------------------------------------------------------------------
>
>The following is my with-bug program:
>
>-- interface
>create or replace package newchi is
>
>procedure fyp_scna;
>end ;
>/
>show errors
>
>create or replace package body newchi is
>
>procedure fyp_scna is
> cursor all_object is select * from firms f ,Co_bg c ,FileUrl u where
>f.co_name='A' and f.co_id=c.co_id and f.co_id=u.co_id order by f.co_name;
>
>begin
> htp.bodyopen('http://imsu11.ust.hk:9000/ar/img/t2.gif');
> htp.p('The Companies with "A" as the first character:');
> htp.nl;
> htp.tableOpen('yes');
> htp.tableRowOpen;
> htp.tableData(htf.strong('Company Name'));
> htp.tableData(htf.strong('Year'));
> htp.tableRowClose;
> for each_object in all_object
> loop
> htp.tableRowOpen;
> htp.tableData(htf.anchor(each_object.co_url,each_object.co_name));
> htp.tableData(each_object.year);
> htp.tableRowOpen;
> end loop;
> htp.tableClose;
> end; -- end of fyp_scna
> end newchi;
>/
>
>

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Wed Mar 05 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US