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

Home -> Community -> Usenet -> c.d.o.server -> Re: Unable to declare a cursor

Re: Unable to declare a cursor

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Thu, 30 Jun 2005 21:05:38 +0200
Message-ID: <da1fpn$a1d$02$1@news.t-online.com>


gordon.t.wu_at_gmail.com schrieb:
> Hi, I'm getting a "PLS-00402: alias required in SELECT list of cursor
> to avoid duplicate column names" error when every single one of the
> field in the SELECT clause have been aliased.
>
> CURSOR
> TREATMENT_CUR is
>
> SELECT t.treatment_procedure_id as treatment_procedure_id,
> r.record_id as record_id,
> tr.previous_flag as previous_flag,
> c.primary_site as primary_site,
> r.record_id as record_id,
> r.major_record_subtype as major_record_subtype,
> r.rx_hosp_screen_bx_proc1 as rx_hosp_screen_bx_proc1,
> r.rx_hosp_screen_bx_proc2 as rx_hosp_screen_bx_proc2,
> r.rx_hosp_screen_bx_proc3 as rx_hosp_screen_bx_proc3,
> r.rx_hosp_screen_bx_proc4 as rx_hosp_screen_bx_proc4
> FROM treatment_procedure t JOIN
> treatment_procedure_registry tr ON (t.treatment_procedure_id =
> tr.treatment_procedure_id)
> JOIN
> course cr ON (t.course_id = cr.course_id)
> JOIN
> ctc c ON (c.ctc_id = cr.ctc_id)
> LEFT OUTER JOIN
> record r on (t.record_id = r.record_id)
> WHERE c.date_of_diagnosis_yyyy >= 1998;
>
> Can someone please tell me what did I do wrong to cause the error?
> I'm running Oracle 10g on SLES 9 (service pack 1), if this is relevent
>

You have twice the r.record_id ( with the same alias ) in your select list, so ,i assume, if you reference that column, the error occurs.

Best regards

Maxim Received on Thu Jun 30 2005 - 14:05:38 CDT

Original text of this message

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