Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PLS-00402 Alias required for Select list of cursor to avoid dup col names

710073Aug 16 2009 — edited Aug 17 2009
Hi Frens,

I encountered the above error and fail to solve.Can someone help me please? I cant seem to trace.

PROCEDURE FTEST_ST_YLD_PROC
(
pScheduleoption IN varchar2,
pCustomercode IN varchar2,
pActivity IN varchar2,
pSTEP IN varchar2,
pWW varchar2,
ppackage IN varchar2,
pCursor IN OUT CRPT_CURTYPE.T_RPTCUR )
IS

vStartDate varchar2(15) default null;
vEndDate varchar2(15) default null;
vWW number default 0;
vCustomercode VarChar2(5);
vPackage VarChar2(30);
vActivity Varchar2(40);
vStep Varchar2(40);

wfr varchar2(20);

Cursor XYZ IS
SELECT leadcount,package,device,testdevice,customercode,originalcustomerlotnumber,customerlotnumber,trackinqty,lotid,bintype,binphysicalqty,testpasssamplenumber,
description,WW,bintype,binnumber,binlotid,t.activity,t.step,month,lastupdate,UNACCOUNTVARIANCE,binlotid,yieldvalue
FROM ftest_testtxn@shdb t, fwcatns_testbintxn@shdb b
where t.lotobject = b.lotobject
and t.step = b.step
and t.operationtype = b.operationtype
and t.lottxncounter = b.lottxncounter
and t.activity = vActivity
and t.customercode =vCustomerCode
and t.step = vStep
and t.package = vPackage
and ((t.lastupdate > vStartDate and t.lastupdate <= vEndDate) or t.ww = vWW);


BEGIN

--CustomerCode
If pCustomercode = '*' OR pCustomercode Is Null Then
vCustomerCode := '%';
Else
vCustomerCode := pCustomercode;
End If;

--Package
If ppackage = '*' OR ppackage Is Null Then
vPackage := '%';
Else
vPackage := ppackage;
End If;

--Actvity
If pActivity = '%' OR pActivity Is Null Then
vActivity := '%';
Else
vActivity := pActivity;
End If;

--Step
If pSTEP = '*' OR pSTEP Is Null Then
vStep := '%';
Else
vStep := pSTEP;
End If;

--Date Range
If pScheduleoption = 'Monthly' then
vStartDate := utl_cal.firstdayofperiod(to_char(SYSDATE,'YYYYMMDD'));
vEndDate := utl_cal.lastdayofperiod(to_char(SYSDATE,'YYYYMMDD'));
elsif pScheduleoption = 'Weekly' then
vWW := utl_cal.workweek(to_char(SYSDATE,'YYYYMMDD'));
vStartDate := firstdayofww(vWW,utl_cal.firstdayofperiod(to_char(SYSDATE,'YYYYMMDD')));
vEndDate := lastdayofww(vStartDate);
elsif pScheduleoption = 'Manual' then
vWW := pWW;
End If;


For Rec in XYZ Loop

select distinct to_char(d.originalcustomerlotnumber) into wfr
from fwcatns_diesinventory d, ftest_testtxn t
where d.lotobject = t.lotobject
and d.customerlotnumber = Lotcur.customerlotnumber;


If wfr is null Then
wfr := Lotcur.originalcustomerlotnumber;
ElsIf length(trim(wfr)) <= 100 Then
wfr := wfr||','||Lotcur.originalcustomerlotnumber;
Else
Exit;
End If;

End Loop;


OPEN PCURSOR FOR
SELECT * FROM ftest_testtxn t, fwcatns_testbintxn b
where t.lotobject = b.lotobject
and t.step = b.step
and t.operationtype = b.operationtype
and t.lottxncounter = b.lottxncounter;

End ;
This post has been answered by Twinkle on Aug 17 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2009
Added on Aug 16 2009
2 comments
1,982 views