Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2015
    Posts
    1

    Unanswered: getting error procedure created with compilation error

    Hello Friends,

    I am trying to create a stored procedure to truncate table partition using input parameter but I am getting error stored procedure created with compilation, when using show errors I am getting error as :
    I am getting procedure created with compilation error but showing no errors on using show error.
    LINE/COL ERROR
    - --
    2/23 PLS-00103: Encountered the symbol "(" when expecting one of the
    following:
    := . ) , @ % default character
    The symbol ":=" was substituted for "(" to continue.

    3/27 PLS-00103: Encountered the symbol "(" when expecting one of the
    following:
    := . ) , @ % default character
    The symbol ":=" was substituted for "(" to continue.

    Providing code of my stored procedure:

    Create or replace procedure truncate_partition[
    p_table_nm in varchar2(100),
    p_partition_nm in varchar2(100)]

    Is
    v_statement varchar2(500);
    Begin
    v_statement:='alter table'||p_table_nm||'truncate partition'||p_partition_nm;

    execute immediate v_statement;
    end truncate_partition;
    /

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    At a minimum the statement would benefit from having some additional spaces like below

    v_statement:='alter table '||p_table_nm||' truncate partition '||p_partition_nm;

    The standard advice when (ab)using EXECUTE IMMEDIATE is to compose the SQL statement in a single VARCHAR2 variable
    Then print the variable before passing it to EXECUTE IMMEDIATE.
    COPY the statement & PASTE into sqlplus to validate its correctness.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Create or replace procedure truncate_partition[ p_table_nm in varchar2(100), p_partition_nm in varchar2(100)]

    square brackets are NOT valid syntax
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Feb 2005
    Posts
    57
    also, when declaring parameters, you don't need to specify the length.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •