473,396 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

registering a function in discoverer

151 100+
Hi All,

I have a function that return some static value, based on the grade of a person. It takes the person id as the input.

This is my code
Expand|Select|Wrap|Line Numbers
  1. create or replace function fnc_get_employee_emoluments (person_id number) return NUMBER as
  2.     employee_grade varchar2(30);
  3.     first_position number; -- first occurrence of '.' in the grade
  4.     last_position number; -- second occurrence of '.' in the grade 
  5.     string_length number;
  6.     emoluments number := 0;
  7. begin
  8.         SELECT PG.NAME 
  9. FROM HR.PER_ALL_ASSIGNMENTS_F PAAF, hr.PER_GRADES PG
  10. where PAAF.PERSON_ID = 1665 
  11. and PAAF.GRADE_ID = PG.GRADE_ID
  12. and PAAF.effective_end_date =
  13.     (select max(PAAF1.effective_end_date)
  14.      from hr.per_all_assignments_f PAAF1
  15.      where PAAF1.PERSON_ID = PAAF.person_id);
  16. first_position := instr(employee_grade,'.',1,1);
  17. last_position := instr(employee_grade,'.',1,2);
  18. string_length := last_position - (first_position + 1);
  19. employee_grade := substr(employee_grade,first_position + 1,string_length);
  20. IF upper(employee_grade) = 'IZ1' THEN
  21.     emoluments := 668;
  22. ELSIF upper(employee_grade) = 'IZ2' THEN
  23.     emoluments := 881;
  24. ELSIF upper(employee_grade) = 'IZ3' THEN
  25.     emoluments := 1404;
  26. ELSIF upper(employee_grade) = 'IZ4' THEN
  27.     emoluments := 1950;
  28. ELSIF upper(employee_grade) = 'IZ5' THEN
  29.     emoluments := 1434 + 954;
  30.     ELSIF upper(employee_grade) = 'IIZ2' THEN
  31.     emoluments := 1230 + 1230 + 898;
  32. ELSIF upper(employee_grade) = 'IIZ3' THEN
  33.     emoluments := 1076 + 1186 + 1186 + 1109;
  34. ELSIF upper(employee_grade) = 'IIZ4' THEN
  35.     emoluments := 1215 + 1491 + 1491 + 1368;
  36. ELSIF upper(employee_grade) = 'IS3' THEN
  37.     emoluments := 300 + 641;
  38. ELSIF upper(employee_grade) = 'IS4' THEN
  39.     emoluments := 300 + 695;
  40.     ELSE
  41.     emoluments := 0;
  42. END IF;
  43. return emoluments;
  44. end fnc_get_employee_emoluments;
  45.  
Now i compiled this and this runs fine ( returns the correct value), when run in toad.

I registered this in discoverer, and i am using this in calculation item.
It always returns 0. What could be the reason.

I have verified the person id that i am passing in my report. The function return correct value in toad for the same person id but not in my report.

Steps I used to register this function.

1) clicked on register pl/sql function in admin version
2) Clicked on import and searched for this in the available list of functions
3) after adding this, and the parameters, saved the content

In desktop , used the calculation item to retrieve this function.


vamsi
Jul 23 '09 #1
0 2592

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ana RM | last post by:
Hi!! I am connecting Oracle Discoverer to Informix. The connection is OK. I can create an EUL in the Administrator, and make calcules, everything. My problem is that I cannnot connect to the...
0
by: Ana RM | last post by:
Hi everybody, I have a problem in Discoverer. The point is that I donīt want to refresh data each time I open a workbook. I want to mantain old reports. If I open a report without connecting...
0
by: Paul Winter | last post by:
I'm new to both Oracle and Discoverer. Could someone point me in the direction of where to set the inactivity timeout for Discoverer Plus? Thanks Paul
1
by: Monica Roman | last post by:
Hello, Disclaimer: I'm a TOTAL rookie. I just went through unistalling Oracle to be able to install Discoverer, which was succesful. (Our in-house Oracle support person said that if I did the...
0
by: 882900 | last post by:
hello people of the free world..... I'm upgrading my Oracle DB from 7 to 9.2 and I used to run discoverer 3 but now I dont know what discoverer version to use for the 9.2 any advice is more than...
1
by: Ana RM | last post by:
Mark.Powell@eds.com (Mark D Powell) wrote in message news:<2687bb95.0308010642.1fc4ff1f@posting.google.com>... Hi Mark, Thanks por answer me. I do not think it is important thw warehouse...
1
by: Ole Hansen | last post by:
Hi ! I am trying to learn how to use Oracle Discoverer. I have worked with databases, like Oracle for several years, but i am new to Discoverer. Does anybody know a place to download an...
0
by: vamsioracle | last post by:
Hi all I have installed oracle discoverer 4.1.37 on my machine and i have database 9i. Now i try to login in discoverer, it says tns no listner. I copied and replaced the tns.ora from ora92 which...
0
by: vamsioracle | last post by:
Hi All I have a discoverer report already registeted in apps (employee leave balances). Now my client wants to rename the same report as " employee personal leave balances. Now i logged in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.