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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:16:35+00:00 2026-05-31T17:16:35+00:00

I tried to insert a set of rows as soon as a table is

  • 0

I tried to insert a set of rows as soon as a table is created using the following query in Java as followed:

DECLARE tbl_exist  PLS_INTEGER; 
BEGIN 
select count(*) into tbl_exist  from user_tables where table_name = 'REPRO_PRINTING_JOB_STATE'; 
if tbl_exist = 0 then 
    execute immediate 'create table REPRO_PRINTING_JOB_STATE ( 
    ID varchar2(2) not null primary key, 
    NAME varchar(255) not null )'; 
    execute immediate 'insert into REPRO_PRINTING_JOB_STATE (ID, NAME) values ('QU','IN THE QUEUE')'; 
    execute immediate 'insert into REPRO_PRINTING_JOB_STATE (ID, NAME) values ('IN','INCIDENT')'; 
    execute immediate 'insert into REPRO_PRINTING_JOB_STATE (ID, NAME) values ('CM','COMPLETED')'; 
    execute immediate 'insert into REPRO_PRINTING_JOB_STATE (ID, NAME) values ('PR','PROCESSING')'; 
    execute immediate 'insert into REPRO_PRINTING_JOB_STATE (ID, NAME) values ('CN','CANCELLED')'; 
end if; 
END;

It failed. Was this because the use of “execute immediate” statement?

  • 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-31T17:16:36+00:00Added an answer on May 31, 2026 at 5:16 pm

    Based on your first iteration of the question, it probably fails because your first insert is into a totally different table:

    execute immediate 'insert into PRINTING_JOB_STATE (ID, NAME) values ... '
    execute immediate 'insert into REPRO_PRINTING_JOB_STATE (ID, NAME) values .... '
    

    In other words, you’re using PRINTING_JOB_STATE instead of REPRO_PRINTING_JOB_STATE.


    However, now that you’ve confirmed that was just a simple typo on your part, you need to check your use of the single quotes in the insert statements. The fact that your dynamic string is surrounded by ' characters means that using ' inside the string (around things like QU) will be problematic.

    You’ll probably need to escape the quotes by using duplicated quotes, such as with:

    execute immediate 'insert into XYZZY (ID, NAME) values (''QU'', ''QUEUED'')';
    

    That’s two single quotes on either side of the QU and QUEUED, not a double quote.

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

Sidebar

Related Questions

I created MVC ASP.Net Web application and tried insert Thai language data to SQL
I have a query like this: use DataIncremental go DECLARE @row_terminator CHAR; SET @row_terminator
I am using the SqlBulkCopy object to insert a couple million generated rows into
I am using an update function, where I insert some 40,000 rows to a
I am inserting say 500 rows using INSERT IGNORE, if the row already exists
I just tried to insert two rows with the current datetime and then calculated
I'm going crazy today. I just tried to insert a new record and it
How to insert html code inside an array in PHP? I tried searching on
I have a method which does a simple mysql insert, when I tried to
Tried following the instructions here: How to use Google app engine with my own

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.