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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:18:23+00:00 2026-06-07T01:18:23+00:00

In PL/SQL, the code below will fail. It doesn’t allow the definition of size

  • 0

In PL/SQL, the code below will fail. It doesn’t allow the definition of size for the varchar2 parameter. Do you know why? How do I fix it?

create or replace function logMessage(msg varchar2(2000))
return number as
begin
    null;    
    return 1;
end logMessage;
/

error message is

1/33 PLS-00103: Encountered the symbol “(” when expecting
one of the following:

:= . ) , @ % default character The symbol “:=” was substituted for
“(” to continue.

  • 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-07T01:18:25+00:00Added an answer on June 7, 2026 at 1:18 am

    You fix it by removing the size constraint. It’s not needed:

    create or replace function logMessage (msg in varchar2)
    return number is
    begin
        null;    
        return 1;
    end logMessage;
    /
    

    I assume your function is slightly more complicated than this?

    The full syntax for the create function statement from the documentation is:

    CREATE [OR REPLACE] FUNCTION [Owner.]FunctionName 
         [(arguments [IN|OUT|IN OUT][NOCOPY] DataType [DEFAULT expr][,...])]
         RETURN DataType [InvokerRightsClause] [DETERMINISTIC]
         {IS|AS} 
    

    There’s a lot of information around the specifics if you’re interested but you may find TECH on the Net more useful.


    In answer to your first question of why I don’t know and can’t find an answer. But to quote APC:

    This is annoying but it’s the way PL/SQL works so we have to live with
    it.

    Put simply, you should know at run-time how long something is going to be and be able, therefore, to deal with it. There are a few options you can consider though:

    If you know what length you want message to be you can define a variable, the default value of which is a substr of the parameter:

    create or replace function logmessage ( msg in varchar2 ) return number is
    
       l_msg varchar2(2000) := substr(msg,1,2000);
    
    begin
       return 1;
    end;
    

    Alternatively, you can check the length in the function itself:

    create or replace function logmessage ( msg in varchar2 ) return number is
    
    begin
    
       if length(msg) > 2000 then
          return 0;
       end if;
    
       return 1;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SQL Developer to debug code like below, the output result will
The code below works (it will eventually pull records from a database via SQL),
Greetings, The VBA code below will create an Excel QueryTable object and display it
I have the code below: string SQL = select * from + TableName; using
I am using the code below t programmatically restore a SQL database using VB.Net
I need to convert a sql statement to a linq query. The code below
Using the SQL in the below code: public function saveOrder() { $id = $this->getUserId();
This is my exact SQL code, but it's very slow and I know it's
I need a php code and sql code that will let someone upload an
I've got the following T-SQL code below that's working from inside of SQL Server

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.