Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

SQL Plus syntax for adding a field to a table

  • 28-05-2007 03:57PM
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    How do I add a field to a table in sql plus on oracle?
    whats the correct syntax can Ive an example?

    Ive tried

    alter table tablename add(fieldname varchar2(25));

    It said table or view doesn't exist so am puzzled cos the tablename I used does exist.


Comments

  • Registered Users, Registered Users 2 Posts: 169 ✭✭DonnieBrasco


    sounds like a security issue

    try providing the schema name with the table name

    Alter SchemaName.TableName ...


  • Registered Users, Registered Users 2 Posts: 23,202 ✭✭✭✭Tom Dunne


    Yeah, are you sure you have permissions, because the syntax is correct.


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Its possible that the table you're referencing is owned by another user, and that you're avoiding having to supply the schema-name because of a public synonym.

    I think that in a case like ALTER TABLE, public synonyms won't be used so if its owned by another user, then you need to use schemaname.tablename as DonnieBrakso suggested.


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    Yep there was a different command I had to enter in order to edit the table cheers guys.


  • Closed Accounts Posts: 2,616 ✭✭✭8k2q1gfcz9s5d4


    are you in the correct database? that always gets me!


  • Advertisement
Advertisement