Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:59:04+00:00 2026-06-09T15:59:04+00:00

I’m working on a school work and I have an error in my code.

  • 0

I’m working on a school work and I have an error in my code.
I have created a PLSQL package:

create or replace 
PACKAGE GestionProjets AS

  TYPE Signaletique IS TABLE OF EMPLOYES%ROWTYPE INDEX BY BINARY_INTEGER; 
  TYPE TableNomDep IS TABLE OF VARCHAR2(40);

  PROCEDURE AjouterProjets(ProjetRecord IN PROJETS%ROWTYPE);
  PROCEDURE SupprimerProjet(DelNumPro IN PROJETS.numpro%TYPE);
  --PROCEDURE ModifierProjet(newRecord IN PROJETS%ROWTYPE, oldRecord IN PROJETS%ROWTYPE);
  FUNCTION ListerEmployes(dep1 IN DEPARTEMENTS.Nomdep%TYPE, dep2 IN DEPARTEMENTS.Nomdep%TYPE) RETURN Signaletique;

END GestionProjets;

That’s the body of the function where I have an error:

  FUNCTION ListerEmployes(dep1 IN DEPARTEMENTS.Nomdep%TYPE, dep2 IN DEPARTEMENTS.Nomdep%TYPE) RETURN Signaletique AS

    nomDeps TableNomDep;
    SigTable Signaletique;
    EXWrongDep1 EXCEPTION;
    EXWrongDep2 EXCEPTION;

  BEGIN

    SELECT Nomdep 
    BULK COLLECT INTO nomDeps
    FROM DEPARTEMENTS;

    -- test if dep 1 est un parametre valide
    IF NOT nomDeps.exists(dep1) THEN
      RAISE EXWrongDep1;
    END IF;

    -- test if dep 2 est un parametre valide
    IF NOT nomDeps.exists(dep2) THEN
      RAISE EXWrongDep2;
    END IF;




    EXCEPTION
      WHEN EXWrongDep1 THEN
        RAISE_APPLICATION_ERROR(-20008, 'MAUVAIS PARAMETRE: ' || dep1 || ' N EXISTE PAS!');
      WHEN EXWrongDep2 THEN
        RAISE_APPLICATION_ERROR(-20008, 'MAUVAIS PARAMETRE: ' || dep2 || ' N EXISTE PAS!');
            WHEN OTHERS THEN
                RAISE_APPLICATION_ERROR (-20007, 'ERREUR INCONNU: ' ||  SQLCODE || ' - ' || SQLERRM);

  END ListerEmployes;

When I try to execute the function, i get this error message:

DECLARE
  tabel gestionprojets.Signaletique;
BEGIN
  tabel := gestionprojets.listeremployes('sdsd','sdsd');
END;


ORA-20007: ERREUR INCONNU: -6502 - ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "EDGE.GESTIONPROJETS", line 108
ORA-06512: at line 4

I don’t understand why I get this error message. The type of the Nomdep column is VARCHAR2(40).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:59:05+00:00Added an answer on June 9, 2026 at 3:59 pm

    I suspect the problem is that the table type is indexed by BINARY_INTEGER. When the .EXISTS calls are executed they’re passed either dep1 or dep2 as the index for the table, and thus PL/SQL tries to convert the VARCHAR2(40) parameter to a BINARY_INTEGER. Since these input parameters are both non-numeric character strings (‘sdsd’) the conversion fails.

    This code might run faster if, instead of reading the entire DEPARTEMENTS table into memory each time ListerEmployes is called, it was rewritten as

    FUNCTION ListerEmployes(dep1 IN DEPARTEMENTS.Nomdep%TYPE, dep2 IN DEPARTEMENTS.Nomdep%TYPE) RETURN Signaletique
    AS
      strNomdep  DEPARTEMENTS.Nomdp%TYPE;
    BEGIN
      -- test if dep 1 est un parametre valide
    
      BEGIN
        SELECT NOMDEP
          INTO strNomdep
          FROM DEPARTEMENTS
          WHERE NOMDEP = dep1;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          RAISE_APPLICATION_ERROR(-20008, 'MAUVAIS PARAMETRE: ' || dep1 || ' N EXISTE PAS!'); 
      END;
    
      -- test if dep 2 est un parametre valide
    
      BEGIN
        SELECT NOMDEP
          INTO strNomdep
          FROM DEPARTEMENTS
          WHERE NOMDEP = dep2;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          RAISE_APPLICATION_ERROR(-20008, 'MAUVAIS PARAMETRE: ' || dep2 || ' N EXISTE PAS!'); 
      END;
      EXCEPTION 
        WHEN OTHERS THEN 
          RAISE_APPLICATION_ERROR (-20007, 'ERREUR INCONNU: ' ||  SQLCODE || ' - ' || SQLERRM);    
    END ListerEmployes;
    

    Share and enjoy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.