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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:01:20+00:00 2026-06-18T19:01:20+00:00

I am using Netbeans, writing in Java and using Derby. I have a table

  • 0

I am using Netbeans, writing in Java and using Derby.

I have a table within APP called PERSON. Within PERSON I have a column called PID with the following properties:

Name: PID
Nulls allowed: [ ]
Data type: NUMERIC
Column size: 4
Decimal digits: 0
Position: 1
Part of a primary key: [/]
Part of an index: [/]

I used the meta data isAutoIncrement function to check if it was already auto incrementing and it is not!

I have since tried using the following SQL commands to alter it:

I believe this may not have been for Derby:

ALTER TABLE APP.PERSON ALTER PID NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY 
(START WITH 1, INCREMENT BY 1); 

Upon checking the Oracle website, I found the correct syntax:

ALTER TABLE APP.PERSON ALTER PID SET INCREMENT BY 1;

I even tried leading zeros:

ALTER TABLE APP.PERSON ALTER PID SET INCREMENT BY 0001;

None of which have worked, the error I get on the last two are:

ALTER TABLE '"APP"."PERSON"' specified attributes for column 'PID' that are 
not compatible with the existing column.

Any ideas of the correct syntax?

  • 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-18T19:01:21+00:00Added an answer on June 18, 2026 at 7:01 pm

    Here’s what I generally do to accomplish this:

    1. Create a new table, with the desired schema, including the generated primary key
    2. Issue a INSERT INTO newtable SELECT columns FROM oldtable to populate the new table’s data from the old table
    3. Rename the old table to some temporary name, like table_soon_to_be_deleted
    4. Rename the new table to the desired table name
    5. Do some testing to make sure that my behavior is as expected
    6. Drop the old table that I renamed in step (4).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an app in Java and swing using Netbeans, and I need property
(using netbeans and java) I have the following 1 text field named input 1
I'm writing a Java Desktop App using NetBeans 6.5 and a Swing Patterns that
I have recently started using Netbeans with following stack Liferay, icefaces with jBoss. Is
I'm building a little app using Java and Swing in NetBeans. Using NetBeans design
I am writing a simple GUI using netbeans and Java SE, i cannot seem
I am currently writing a java REST Web Service using Netbeans and Glassfish. The
I am using GNU/Linux (Ubuntu + Gnome). I have been using netbeans on windows
I'm using NetBeans 7.2.1 and I'm new to Java (but I program in C#
I am writing C++ app which should be compiled both using MS C++ on

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.