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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:08:11+00:00 2026-06-11T01:08:11+00:00

I have a PL/SQL stored procedure inside which I want to run several updates,

  • 0

I have a PL/SQL stored procedure inside which I want to run several updates, then capture any exceptions and return them in an out parameter. For simplicitys sake in the code block below I am simply outputting the exception code and error message to the console. However, the code block below does not work (I am experiencing a “found / expecting” syntax error)

    CREATE OR REPLACE PROCEDURE DBP.TESTING_SP AS 
    DECLARE
    v_code  NUMBER;
    v_errm  VARCHAR2(64);
    BEGIN
    UPDATE PS_NE_PHONE_TBL SET NE_PHONE_TYPE = 'TEST' WHERE NEMPLID_TBL = 'N14924';

    EXCEPTION
    WHEN OTHERS THEN
    v_code := SQLCODE;
    v_errm := SUBSTR(SQLERRM, 1, 64);
    DBMS_OUTPUT.PUT_LINE (v_code || ' ' || v_errm);
    END TESTING_SP;
    /

What is the correct syntax for what I am trying to do?

I read on one forum

“When using the Create or Replace syntax, you can not use Declare. Declare is only for anonymous blocks that are not named. So either remove line 1 and create an anonymous block, or remove line 2 and create a named procedure.”

but I’m not sure how to create an anonymous block or create a named procedure to accomplish what I want to do (if that, indeed, is the ‘solution’). Could somebody lend a hand?

  • 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-11T01:08:13+00:00Added an answer on June 11, 2026 at 1:08 am

    Just remove the DECLARE statement.

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

Sidebar

Related Questions

I have a SQL Server stored procedure that is not returning any data when
I have a SQL server stored procedure which would accept date as input param
I have a stored procedure which is nested in several other stored procedure. Is
I have a weird requirement which I need to use inside my Stored Procedure
I have a T-SQL stored procedure with the signature CREATE PROCEDURE MyProc @recordCount INT
I have two PL/SQL Stored procedure each handling its own Transaction (Begin/Commit and Rollback
Suppose I have a PL/SQL stored procedure as follows: PROCEDURE do_something(foo VARCHAR2 DEFAULT NULL)
I have a huge pl/sql stored procedure, where we make some deletions as long
I have the following SQL Server stored procedure : BEGIN TRAN CREATE TABLE #TempTable
I have written a SQL Server stored procedure that includes a DateTime parameter. This

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.