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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:09:12+00:00 2026-06-02T11:09:12+00:00

How do I create or replace a procedure in JDBC? I created the procedure

  • 0

How do I create or replace a procedure in JDBC?
I created the procedure in oracle, but I cannot replace the procedure from Java.

I have the following, but it does not work:

Statement stmt0 = conn.createStatement();
String query0 =
"CREATE OR REPLACE PROCEDURE my_proc " +
//blah blah blah
//blah blah blah
//blah blah blah
"END; " +
". " +
"run; ";
stmt0.execute(query0); 

From online tutorials, I see that i’m supposed to use something like:
cstmt = conn.prepareCall (SQL);
But I haven’t been able to make it work.

If you want to see more of my code, I will provide.

  • 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-02T11:09:13+00:00Added an answer on June 2, 2026 at 11:09 am

    First of all, you can do this.

    You want to prepare and execute from jdbc, to begin with.

    Second, you need to cut off your last line with the “. ” and “run; ” which look like they are straight from SQL*Plus.

    Note you have not put any newlines in your Java string, but that won’t matter. You seem to have added trailing spaces which is necessary.

    I suggest logging or system.out.println of the string before you execute.

    Don’t have a DBMS right now, but it should be something like

    String sqlproc = 
        "CREATE OR REPLACE PROCEDURE FRED IS \n" +
        "BEGIN NULL; END FRED;";
    
    System.out.println ("proc code: " + sqlproc);
    Statement stmt = conn.prepareStatement (sqlproc);
    stmt.execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Java stored procedure: CREATE OR REPLACE AND RESOLVE JAVA SOURCE
Actually i have created following procedure,which is working fine. CREATE or REPLACE PROCEDURE GET_NOS(
I have this stored procedure for Oracle: create or replace procedure bns_saa_message_get() <--- PROBLEM
I have stored-procedure in Oracle database like this: create or replace PROCEDURE EDYTUJ_PRACOWNIKA (PR_IMIE
i have a simple oracle stored procedure proc1 as follows: CREATE OR REPLACE PROCEDURE
I have the following procedure: CREATE OR REPLACE PROCEDURE My_Procedure AS CURSOR proced IS
We have a function written in pl/sql(oracle) as below: CREATE OR REPLACE PROCEDURE folder_cycle_check
Here I have a stored procedure in Oracle: CREATE OR REPLACE PROCEDURE StP_COMPS IS
I have created an oracle procedure to reschedule job that do not complete in
I have this Oracle procedure: CREATE OR REPLACE PROCEDURE xmas IS CURSOR curUser IS

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.