Advertisement

03.09.2004 at 12:46PM PST, ID: 20912935
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

HELP cant solve -6502 ORA-06502: PL/SQL: numeric or value error

Asked by Maritimer in Oracle 3rd Party Tools

Tags: ,

The stored proc for the most part seems to work however when it get a certain p_emp value I get then error 6502 ORA-06502: PL/SQL: numeric or value error. The p_emp does exist so there are no problems there all the data I am pulling is varchar2. I only have one number declared which is used for a counter. How ever for certain people the system just dies I have if I run the Select statemnets manually they work and give the full results. When I excute the Proc the same emp will cause it to fail.



PROCEDURE Emp_services_Equip_Email(P_emp varchar2, P_FM varchar2) IS
      
      vitem                          varchar2(1000);
      vprimarynumber varchar2(1000);
      vserialnumber  varchar2(1000);
      vemail                          varchar2(1000);
      vfullname                   varchar2(1000);
      vsubject       varchar2(1000);
      vBody                           varchar2(4000);
      vempno                     varchar2(1000);
      vorgid                          varchar2(1000);
      num_recs       number;
      
      qty                                     varchar2(1000);
      amt                                varchar2(1000);
      x varchar2(1000);
      y varchar2(1000);

      
BEGIN
      
      vSubject := '';
      vBody := '';
      Num_recs := 0;                  
      
      if p_emp is not null then
            
            Declare
                  
                  Cursor A1 is select I.org_id, I.inventory_id,I.primary_number,I.item_type,fy_mth,U.QTY_CHAR
                  from inventory I, (select u2.inventory_id, u2.fy_mth, u2.qty_char from usage_summary4 u2 where fy_mth = P_FM and employee_id = P_emp) U
                  where assigned_to = P_emp
                  and I.inventory_id = u.inventory_id (+)  
                  order by item_type;
                  
                  A1_tmp A1%rowtype;
                  
            begin
                  
                  Num_recs := 1; -- Only sending out one email
                             
                  select full_name, email into vfullname,vemail from employees where employee_id = p_emp and email is not null;      
                  
                  vsubject := vfullname || ' ' || p_emp || ' Assigned Services and Equipment';
                  
                  
                  vBody := 'HI ' || vfullname || ' (Oracle Number)' || chr(13) ||   chr(10)  ||  chr(13) ||   chr(10) ||
                  'Below is a list if Items assigned to you.' || chr(13) ||   chr(10)  ||  chr(13) ||   chr(10) ||
                  'If you have any questions please contact the Help Desk at Ext: 5600' || chr(13) ||   chr(10)  ||  chr(13) ||      chr(10);
                  z := 'A2';
                  vBody := vBody || 'Admin          Item                     Identifier                   Fy Mth     Qty' || chr(13) ||   chr(10)  ||  chr(13) ||   chr(10);
                  
                  for A1_tmp in A1 loop
                        
                  
                        vBody := VBody || RPAD(a1_tmp.org_id,15) || RPAD(a1_tmp.item_type,25) || RPAD(a1_tmp.primary_number,30); --|| RPAD(a1_tmp.fy_mth,12) || RPAD(a1_tmp.qty_char,10) ||chr(13);
                  
                  end loop;
                              
            
            end;
            
      --      SEND_MAIL.mail('test@tes.com',vemail,vsubject, vBody);
            SEND_MAIL.mail('test@tes.com,'test@tes.com',vsubject, vBody);
      
      else
            
            --Send to all employees      
            
            Declare      
      
                  Cursor B1 is Select employee_id from employees where email is not null and employee_id <> '11084' order by employee_id;

                  B1_tmp B1%rowtype;
      
            begin
                  
                  for B1_tmp in B1 loop      
                        
                        --reset variables for next email
                        vSubject := '';
                        vBody := '';
                        Num_recs := Num_recs + 1;
                  
                  
                        Declare
                  
                              Cursor C1 is select I.org_id, I.inventory_id,I.primary_number,I.item_type,fy_mth,U.QTY_CHAR
                              from inventory I, (select u2.inventory_id, u2.fy_mth, u2.qty_char from usage_summary4 u2 where fy_mth = P_FM) U
                              where assigned_to = B1_tmp.employee_id
                              and I.inventory_id = u.inventory_id (+)  
                              order by item_type;
                  
                              C1_tmp C1%rowtype;
                  
                        begin
                              y := B1_tmp.employee_id;
                             
                              select full_name, email into vfullname,vemail from employees where employee_id = B1_tmp.employee_id;      
                  
                              vsubject := vfullname || ' ' || B1_tmp.employee_id || ' Assigned Services and Equipment';
                  
                  
                              vBody := 'HI ' || vfullname || ' (Oracle Number ' || B1_tmp.employee_id || ')' || chr(13) ||   chr(10)  ||  chr(13) ||   chr(10) ||
                              'Below is a list if Items assigned to you.' || chr(13) ||   chr(10)  ||  chr(13) ||   chr(10) ||
                              'If you have any questions please contact the Help Desk at Ext: 5600' || chr(13) ||   chr(10)  ||  chr(13) ||      chr(10);
                  
                              vBody := vBody || 'Admin1          Item                     Identifier                   Fy Mth     Qty' || chr(13) ||   chr(10)  ||  chr(13) ||   chr(10);
                  
                              for C1_tmp in C1 loop

                                          vBody := VBody || RPAD(c1_tmp.org_id,15) || RPAD(c1_tmp.item_type,25) || RPAD(c1_tmp.primary_number,30) || RPAD(c1_tmp.fy_mth,12) || RPAD(c1_tmp.qty_char,10) ||chr(13);
                  
                              end loop;
                              
                        --      SEND_MAIL.mail('test@tes.com',vemail,vsubject, vBody);
                        SEND_MAIL.mail('test@tes.com','test@tes.com',vsubject, vBody);
                              
                              
                        end;
                        
                                          
                  end loop;
                  
                        
                  null;
            
            end;
                        
      end if;
--      BG_LOG_ENTRY (31, 'OK', '', to_char(Num_recs) || ' email(s) were sent.' , '', '', '', '');
      
      exception
            when others then
      x := Num_recs || ' ' || vfullname || ' ' || ' ' || y || ' ' || SQLCODE || ' ' || SQLERRM;
            insert into temp_email (att1) values(x);
      commit;      
      
        
END;Start Free Trial
[+][-]03.09.2004 at 04:22PM PST, ID: 10556358

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle 3rd Party Tools
Tags: 6502, error
Sign Up Now!
Solution Provided By: gmyers
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.09.2004 at 08:06PM PST, ID: 10557766

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32