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

  • Home
  • SEARCH
  • 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 3600314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:28:46+00:00 2026-05-18T20:28:46+00:00

In our SVN-Code Repository, I came across a package specification that -after removing a

  • 0

In our SVN-Code Repository, I came across a package specification that -after
removing a few lines- boils down to

create or replace package tq84 as
    return varchar2(10);
end tq84;
/

It seems to me that such a specification doesn’t make lot of sense and therefore
should not compile at all. But maybe, I don’t see the obvious, so: is this really a bug?

For completness’ sake:

me @ xxx.yyy.zz > select * from v$version;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production

Edit: it has been suggested that in specification as given above return is not the keyword but a (package-)variable. This seems not to be the case however, since the following compiles equally fine:

create or replace package tq84 as

    return varchar2(10);
    return number;
    return date;

end tq84;
/

and clearly, the compiler should tell me that I declare the same variable multiple times.

EDIT 2: JOTN is right, of course, and return IS a variable, and furthermore, the
compiler doesn’t tell upfront, if a variable with the same name is declared twice or more, instead, it’s the runtime environment, that does.

So, with that in mind, it’s possible to compile something like

create or replace package return as
  subtype return is varchar2(10);
end return;
/

create or replace package tq84 as

    constant constant 

    return . return := 'return';

    function function 

    return   return . return;

end tq84;
/

which looks strange, at least at first sight.

So then, I guess, it’s not a compiler bug because return is allowed as a variable name, but then, it’s disputable if the compiler should at least give a warning if a variable with the same name is declared multiple times.

  • 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-18T20:28:47+00:00Added an answer on May 18, 2026 at 8:28 pm

    Apparently it allows you to use the name “return” as a variable. In that case it’s declaring a package variable. I would have figured that would fail because it’s a keyword, but I tried it and it worked.

    Try this code:

    create or replace package tq84 as 
      return varchar2(10); 
      somevar varchar2(5); 
      somevar varchar2(5); 
    end tq84; 
    / 
    
    set serveroutput on 
    BEGIN 
      tq84.return:='Test'; 
      dbms_output.put_line(tq84.return); 
    END; 
    / 
    

    That shows return as a variable and it allows the same variable of another name to be declared more than once.

    Now if you try to access somevar, then you get this:

    PLS-00371: at most one declaration for 'TQ84.SOMEVAR' is permitted 
    

    So apparently it delays that check for some reason.

    I just found out how you can detect these problems at compile time. Add this:

    alter session set plsql_warnings = 'enable:all'; 
    

    That code above compiles with these warnings:

    LINE/COL ERROR 
    -------- ----------------------------------------------------------------- 
    1/1      PLW-05018: unit TQ84 omitted optional AUTHID clause; default 
             value DEFINER used 
    
    2/3      PLW-06010: keyword "RETURN" used as a defined name 
    4/3      PLW-05001: previous use of 'SOMEVAR' (at line 3) conflicts with 
             this use 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our SVN-Code Repository, I came across a package specification that -after removing a
In my company we are using one SVN repository to hold our C++ code.
I want to use SvnAnt to checkout the latest code from our svn repository,
I am using git-svn to develop code that is hosted on a SVN+SSH repository.
I recently came across a piece of code, that I thought was very funny.
We use SVN for our source-code revision control and are experimenting using it for
In my SVN folder someone deleted our project source code. Using SVN history we
I've set up our SVN repository like the Subversion book suggests, and this is
I have imported our SVN repository into Mercurial and now we have entries for
I am using git-svn for our svn repository. However, the repo is huge, so

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.