?
Solved

Oracle Portal - Error WWV-17050 - Failed to parse..

Posted on 2006-04-13
1
Medium Priority
?
994 Views
Last Modified: 2008-01-09
First let me say that I am not very experienced with PL-SQL and that is probably where my error is.  I am getting this error inside of Oracle portal.  I do have a schema called famis7i.world where I have successfully established a database link.  With other simples SQL statements I am able to run reports and get the data I want.  In this particular PL-SQL code I don’t know where the problem is.  The portlet I wan to add is a “report from SQL”  The code for the report is as fallowed:  PS: Please refer to the rest of my posting after the SQL code!

select 'Q'||(to_char(add_months(sysdate,6),'Q') - 1) "QUATER",
bsc_training_hours(decode( (to_char(add_months(sysdate,6),'Q') - 1), '1','07/01/'||to_char(sysdate,'RR'), '2','10/01/'||to_char(sysdate,'RR'),'3','01/01/'||(to_char(sysdate,'RR')+1),'4','04/01/'||(to_char(sysdate,'RR')+1)),
decode( (to_char(add_months(sysdate,6),'Q') - 1), '1','10/01/'||to_char(sysdate,'RR'), '2','01/01/'||to_char(sysdate,'RR'),'3','04/01/'||(to_char(sysdate,'RR')+1),'4','07/01/'||(to_char(sysdate,'RR')+1))) "TRAINING_HOURS_FOR_QUARTER",
         bsc_training_hours_year(decode( (to_char(add_months(sysdate,6),'Q') - 1), '1','07/01/'||to_char(sysdate,'RR'), '2','10/01/'||to_char(sysdate,'RR'),'3','01/01/'||(to_char(sysdate,'RR')+1),'4','04/01/'||(to_char(sysdate,'RR')+1)),
decode( (to_char(add_months(sysdate,6),'Q') - 1), '1','10/01/'||to_char(sysdate,'RR'), '2','01/01/'||to_char(sysdate,'RR'),'3','04/01/'||(to_char(sysdate,'RR')+1),'4','07/01/'||(to_char(sysdate,'RR')+1))) "TRAINING_HOURS_PER_YEAR",
         fm_emps('1') "FM_EMPS",
         round((bsc_training_hours_year(decode( (to_char(add_months(sysdate,6),'Q') - 1), '1','07/01/'||to_char(sysdate,'RR'), '2','10/01/'||to_char(sysdate,'RR'),'3','01/01/'||(to_char(sysdate,'RR')+1),'4','04/01/'||(to_char(sysdate,'RR')+1)),
decode( (to_char(add_months(sysdate,6),'Q') - 1), '1','10/01/'||to_char(sysdate,'RR'), '2','01/01/'||to_char(sysdate,'RR'),'3','04/01/'||(to_char(sysdate,'RR')+1),'4','07/01/'||(to_char(sysdate,'RR')+1))) / fm_emps('1')),2) "AVG_PER_EMP"
from dual
     

I can tell this is calling:  (bsc_training_hours_year) and (bsc_training_hours) which are functions inside of a system schema.  So, I know this function must exist.  When I try to create (BSC_TRAINING_HOURS_YEAR) I get the fallowing error.  I am posting the code first then the error!

(p_start IN VARCHAR2, p_end IN VARCHAR2) RETURN NUMBER IS

begin
  declare
  vtrain number;
begin

  select  sum(hours)
    into vtrain
  from famis_labor@famis7i.world
  where wo_number = 'SWO001252'
  and trunc(work_date) >= to_date(p_end, 'MM/DD/RR') -365
  and trunc(work_date) <= to_date(p_end, 'MM/DD/RR')
    and employee in (select employee from famis_emp@famis7i.world where crew in ('ENGR','ENERGY','REFR','PAINT','CARP','LOCK','PLUM','SIGNAGE','AUTO','ELEC','METAL','GDSFM','GDSPARK','GDSHSE','EQUIP OPER','IRR SPEC','LEAD GRDS','RECYCLE','MOVE', 'CUST')
                   )
  order by 1;
return vtrain;
exception when others then
 vtrain := '0';
 return vtrain;
end;



end;

ERROR:

Line No. 3 : PLS-00103: Encountered the symbol "(" when expecting one of the following:

. @ % ; is authid as cluster order using external character
deterministic parallel_enable pipelined aggregate
(WWV-17050)
Line No. 5 : PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:

language
(WWV-17050)
Line No. 27 : PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

begin function package pragma procedure form
(WWV-17050)
ORA-24344: success with compilation error (WWV-11230)
Failed to parse as PORTAL - create or replace Function SYSTEM.BSC_TRAINING_HOURS_YEAR
return VARCHAR2
(p_start IN VARCHAR2, p_end IN VARCHAR2) RETURN NUMBER IS

begin
declare
vtrain number;
begin

select sum(hours)
into vtrain
from famis_labor@famis7i.world
where wo_number = 'SWO001252'
and trunc(work_date) >= to_date(p_end, 'MM/DD/RR') -365
and trunc(work_date) <= to_date(p_end, 'MM/DD/RR')
and employee in (select employee from famis_emp@famis7i.world where crew in ('ENGR','ENERGY','REFR','PAINT','CARP','LOCK','PLUM','SIGNAGE','AUTO','ELEC','METAL','GDSFM','GDSPARK','GDSHSE','EQUIP OPER','IRR SPEC','LEAD GRDS','RECYCLE','MOVE', 'CUST')
)
order by 1;
return vtrain;
exception when others then
vtrain := '0';
return vtrain;
end;



end; (WWV-08300)


Please help!!!

Thank you.
0
Comment
Question by:tadeu_lbc
1 Comment
 
LVL 4

Accepted Solution

by:
radja7 earned 2000 total points
ID: 16450629
Try this:

CREATE OR REPLACE FUNCTION bsc_training_hours_year
(p_start IN VARCHAR2, p_end IN VARCHAR2) RETURN NUMBER
IS
  vtrain number;
BEGIN
  SELECT sum(hours)  INTO vtrain
  FROM famis_labor@famis7i.world
  WHERE wo_number = 'SWO001252'
  ANDtrunc(work_date) >= to_date(p_end, 'MM/DD/RR') -365
  ANDtrunc(work_date) <= to_date(p_end, 'MM/DD/RR')
  ANDemployee in (
   SELECT employee FROM famis_emp@famis7i.world WHERE crew IN ('ENGR','ENERGY','REFR','PAINT','CARP','LOCK','PLUM','SIGNAGE','AUTO','ELEC','METAL','GDSFM','GDSPARK','GDSHSE','EQUIP OPER','IRR SPEC','LEAD GRDS','RECYCLE','MOVE', 'CUST')
  );
RETURN vtrain;
EXCEPTION WHEN others THEN
 vtrain := '0';
 RETURN vtrain;
end bsc_training_hours_year;
/

good luck!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question