Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Oracle / Oracle Server / June 2005

Tip: Looking for answers? Try searching our database.

Unable to declare a cursor

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gordon.t.wu@gmail.com - 30 Jun 2005 19:31 GMT
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
Mike T - 30 Jun 2005 19:56 GMT
record_id is there twice.

  >SELECT  t.treatment_procedure_id as treatment_procedure_id,
1  >r.record_id as record_id,
  >tr.previous_flag as previous_flag,
  >c.primary_site as primary_site,
2  >r.record_id as record_id,

>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
[quoted text clipped - 26 lines]
>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
gordon.t.wu@gmail.com - 30 Jun 2005 20:04 GMT
OMG, I can't believe I'm such an ...
Maxim Demenko - 30 Jun 2005 20:05 GMT
gordon.t.wu@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
[quoted text clipped - 26 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.