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 5842521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:01:43+00:00 2026-05-22T12:01:43+00:00

So I am trying to use overloading but I am having some troubles. My

  • 0

So I am trying to use overloading but I am having some troubles. My package has 4 procedures with the same name but different type of arguments (VARCHAR2, NUMBER, BOOLEAN, DATE). The package header and package body are at the end of my question.

I am trying to use the package procedure like this:

OPEN bookCountCur;
FETCH bookCountCur INTO how_many;
testutil.reporteq('add procedure, book record count',
  expected_value => '1', actual_value => how_many);
CLOSE bookCountCur;

OPEN copiesCountCur;
FETCH copiesCountCur INTO how_many;
testutil.reporteq('add procedure, book copy record count',
  expected_value => '1', actual_value => how_many);
CLOSE copiesCountCur;

And I am getting this compilation error:

Error(83,5): PLS-00307: too many declarations of 'REPORTEQ' match this call

What does it mean?


Package header:

CREATE OR REPLACE 
PACKAGE TESTUTIL AS 

  /* TODO enter package declarations (types, exceptions, methods etc) here */ 

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN VARCHAR2, actual_value IN VARCHAR2);

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN NUMBER, actual_value IN NUMBER);

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN BOOLEAN, actual_value IN BOOLEAN);

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN DATE, actual_value IN DATE);

END TESTUTIL;

And the package body:

CREATE OR REPLACE
PACKAGE BODY TESTUTIL AS

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN VARCHAR2, actual_value IN VARCHAR2) AS
  BEGIN
    DBMS_OUTPUT.PUT(description || ': ');

    IF expected_value = actual_value 
    OR expected_value IS NULL AND actual_value IS NULL
    THEN
      DBMS_OUTPUT.PUT_LINE('PASSED');
    ELSE
      DBMS_OUTPUT.PUT_LINE('FAILED. Expected ' || expected_value || '; got ' || actual_value);
    END IF;
  END reporteq;

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN NUMBER, actual_value IN NUMBER) AS 
  BEGIN
    DBMS_OUTPUT.PUT(description || ': ');

    IF expected_value = actual_value 
    OR expected_value IS NULL AND actual_value IS NULL
    THEN
      DBMS_OUTPUT.PUT_LINE('PASSED');
    ELSE
      DBMS_OUTPUT.PUT_LINE('FAILED. Expected ' || expected_value || '; got ' || actual_value);
    END IF;
  END reporteq;

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN BOOLEAN, actual_value IN BOOLEAN) 
  AS
    expected_value_tostr VARCHAR2(5);
    actual_value_tostr VARCHAR2(5); 
  BEGIN
    DBMS_OUTPUT.PUT(description || ': ');

    IF expected_value = actual_value 
    OR expected_value IS NULL AND actual_value IS NULL
    THEN
      DBMS_OUTPUT.PUT_LINE('PASSED');
    ELSE
      /* Transform TRUE/FALSE to 'TRUE'/'FALSE' */
      IF TRUE = expected_value
      THEN
        expected_value_tostr := 'TRUE';
      ELSE
        expected_value_tostr := 'FALSE';
      END IF;
      IF TRUE = actual_value
      THEN
        actual_value_tostr := 'TRUE';
      ELSE
        actual_value_tostr := 'FALSE';
      END IF;
      DBMS_OUTPUT.PUT_LINE('FAILED. Expected ' || expected_value_tostr || '; got ' || actual_value_tostr);
    END IF;
  END reporteq;

  PROCEDURE reporteq(description IN VARCHAR2
  , expected_value IN DATE, actual_value IN DATE) AS
  BEGIN
    DBMS_OUTPUT.PUT(description || ': ');

    IF expected_value = actual_value 
    OR expected_value IS NULL AND actual_value IS NULL
    THEN
      DBMS_OUTPUT.PUT_LINE('PASSED');
    ELSE
      DBMS_OUTPUT.PUT_LINE('FAILED. Expected ' || TO_CHAR(expected_value, 'YYYY/MM/DD') 
      || '; got ' || TO_CHAR(actual_value, 'YYYY/MM/DD'));
    END IF;
  END reporteq;

END TESTUTIL;
  • 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-05-22T12:01:44+00:00Added an answer on May 22, 2026 at 12:01 pm

    What type is your PL/SQL variable how_many? It needs to be a VARCHAR2, else expected_value needs to be a NUMBER. Try this:

    testutil.reporteq('add procedure, book record count',
      expected_value => '1', actual_value => TO_CHAR(how_many));
    

    The problem is (assuming how_many is a numeric type) is that you don’t have a spec that matches a VARCHAR2 and a NUMBER parameter list. You’ve got VARCHAR2/VARCHAR2, NUMBER/NUMBER, VARCHAR2/BOOLEAN, and DATE/DATE.

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

Sidebar

Related Questions

I'm trying to use operator overloading to define the basic operations (+,-,*,/) for my
Trying to use a guid as a resource id in a rest url but
I am trying to learn and understand name mangling in C++. Here are some
I'm having an interesting but difficult problem with my JavaScript code. Basically, I'm trying
I'm trying to use the min_element for array of structures, but I simply can't
I've been trying to get rid of warnings in some older code (must use
This is probably stupid simple, but for some reason I'm having trouble getting it
I'm trying to understand how to use Wireshark right now, but the official manual
Im having trouble overloading operator<< for use with the mapped value in my map:
I am trying to use PHP mod_rewrite to alter some URLs. As a test,

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.