what does the error “missing right parenthesis” in oracle sql means





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















I'm trying to run this code and it seems correct to me but I'm getting an error stating that there's a right parenthesis missing.



The code is the following:



CREATE TABLE CUSTOMER
(
CUSTOMER_ID INT NOT NULL,
NAME VARCHAR(30) NOT NULL,
DATE_OF_BIRTH DATE,
PHONE_NB CHAR(8) NOT NULL,
ADDRESS VARCHAR(50),
TOTAL_SPENDING FLOAT NOT NULL DEFAULT 0.0,

PRIMARY KEY(CUSTOMER_ID)
);


Can anyone help me in solving my problem?










share|improve this question




















  • 2





    I'm no Oracle expert, but I'm thinking that the DEFAULT 0.0 should come before the NOT NULL. These "Missing Right Parentheses" errors in the CREATE TABLE DDL in Oracle are almost always a syntax error like that.

    – JNevill
    Nov 23 '18 at 19:15













  • The standard string type is VARCHAR2, not VARCHAR or CHAR. Don't use CHAR unless you actually want values to be blank-padded (which, trust me, nobody does).

    – William Robertson
    Nov 24 '18 at 9:54




















-1















I'm trying to run this code and it seems correct to me but I'm getting an error stating that there's a right parenthesis missing.



The code is the following:



CREATE TABLE CUSTOMER
(
CUSTOMER_ID INT NOT NULL,
NAME VARCHAR(30) NOT NULL,
DATE_OF_BIRTH DATE,
PHONE_NB CHAR(8) NOT NULL,
ADDRESS VARCHAR(50),
TOTAL_SPENDING FLOAT NOT NULL DEFAULT 0.0,

PRIMARY KEY(CUSTOMER_ID)
);


Can anyone help me in solving my problem?










share|improve this question




















  • 2





    I'm no Oracle expert, but I'm thinking that the DEFAULT 0.0 should come before the NOT NULL. These "Missing Right Parentheses" errors in the CREATE TABLE DDL in Oracle are almost always a syntax error like that.

    – JNevill
    Nov 23 '18 at 19:15













  • The standard string type is VARCHAR2, not VARCHAR or CHAR. Don't use CHAR unless you actually want values to be blank-padded (which, trust me, nobody does).

    – William Robertson
    Nov 24 '18 at 9:54
















-1












-1








-1








I'm trying to run this code and it seems correct to me but I'm getting an error stating that there's a right parenthesis missing.



The code is the following:



CREATE TABLE CUSTOMER
(
CUSTOMER_ID INT NOT NULL,
NAME VARCHAR(30) NOT NULL,
DATE_OF_BIRTH DATE,
PHONE_NB CHAR(8) NOT NULL,
ADDRESS VARCHAR(50),
TOTAL_SPENDING FLOAT NOT NULL DEFAULT 0.0,

PRIMARY KEY(CUSTOMER_ID)
);


Can anyone help me in solving my problem?










share|improve this question
















I'm trying to run this code and it seems correct to me but I'm getting an error stating that there's a right parenthesis missing.



The code is the following:



CREATE TABLE CUSTOMER
(
CUSTOMER_ID INT NOT NULL,
NAME VARCHAR(30) NOT NULL,
DATE_OF_BIRTH DATE,
PHONE_NB CHAR(8) NOT NULL,
ADDRESS VARCHAR(50),
TOTAL_SPENDING FLOAT NOT NULL DEFAULT 0.0,

PRIMARY KEY(CUSTOMER_ID)
);


Can anyone help me in solving my problem?







sql oracle oracle11g oracle-sqldeveloper






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 21:06









marc_s

586k13011281272




586k13011281272










asked Nov 23 '18 at 19:05









Mohamad Bachar HassanMohamad Bachar Hassan

1




1








  • 2





    I'm no Oracle expert, but I'm thinking that the DEFAULT 0.0 should come before the NOT NULL. These "Missing Right Parentheses" errors in the CREATE TABLE DDL in Oracle are almost always a syntax error like that.

    – JNevill
    Nov 23 '18 at 19:15













  • The standard string type is VARCHAR2, not VARCHAR or CHAR. Don't use CHAR unless you actually want values to be blank-padded (which, trust me, nobody does).

    – William Robertson
    Nov 24 '18 at 9:54
















  • 2





    I'm no Oracle expert, but I'm thinking that the DEFAULT 0.0 should come before the NOT NULL. These "Missing Right Parentheses" errors in the CREATE TABLE DDL in Oracle are almost always a syntax error like that.

    – JNevill
    Nov 23 '18 at 19:15













  • The standard string type is VARCHAR2, not VARCHAR or CHAR. Don't use CHAR unless you actually want values to be blank-padded (which, trust me, nobody does).

    – William Robertson
    Nov 24 '18 at 9:54










2




2





I'm no Oracle expert, but I'm thinking that the DEFAULT 0.0 should come before the NOT NULL. These "Missing Right Parentheses" errors in the CREATE TABLE DDL in Oracle are almost always a syntax error like that.

– JNevill
Nov 23 '18 at 19:15







I'm no Oracle expert, but I'm thinking that the DEFAULT 0.0 should come before the NOT NULL. These "Missing Right Parentheses" errors in the CREATE TABLE DDL in Oracle are almost always a syntax error like that.

– JNevill
Nov 23 '18 at 19:15















The standard string type is VARCHAR2, not VARCHAR or CHAR. Don't use CHAR unless you actually want values to be blank-padded (which, trust me, nobody does).

– William Robertson
Nov 24 '18 at 9:54







The standard string type is VARCHAR2, not VARCHAR or CHAR. Don't use CHAR unless you actually want values to be blank-padded (which, trust me, nobody does).

– William Robertson
Nov 24 '18 at 9:54














2 Answers
2






active

oldest

votes


















2














Since you tagged SQL Developer...



...the tool tries to give you a heads-up there will be a problem before you even hit the Execute button



enter image description here



The default value for the column is confusing the parser because it's not expected at that point.



Move it to after the data type and you'll be good



CREATE TABLE customer (
customer_id INT NOT NULL,
name VARCHAR2(30) NOT NULL,
date_of_birth DATE,
phone_nb CHAR(8) NOT NULL,
address VARCHAR(50),
total_spending FLOAT DEFAULT 0.0 NOT NULL,
PRIMARY KEY ( customer_id )
);


PS In oracle, use VARCHAR2, not VARCHAR. While VARCHAR will 'work', it's reserved and could mean something different in a future release.






share|improve this answer



















  • 1





    Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

    – Littlefoot
    Nov 23 '18 at 19:29











  • @Littlefoot nice catch :)

    – thatjeffsmith
    Nov 23 '18 at 19:32






  • 2





    I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

    – Bob Jarvis
    Nov 23 '18 at 22:46











  • It doesn't hurt anything, probably

    – thatjeffsmith
    Nov 24 '18 at 0:12



















0














You are using wrong order of column definition clauses: the constraint (NOT NULL) should follow the default value.



This is the right way:



CREATE TABLE CUSTOMER
(
CUSTOMER_ID INT NOT NULL,
NAME VARCHAR(30) NOT NULL,
DATE_OF_BIRTH DATE,
PHONE_NB CHAR(8) NOT NULL,
ADDRESS VARCHAR(50),
TOTAL_SPENDING FLOAT DEFAULT 0.0 NOT NULL ,

PRIMARY KEY(CUSTOMER_ID)
);





share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451840%2fwhat-does-the-error-missing-right-parenthesis-in-oracle-sql-means%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Since you tagged SQL Developer...



    ...the tool tries to give you a heads-up there will be a problem before you even hit the Execute button



    enter image description here



    The default value for the column is confusing the parser because it's not expected at that point.



    Move it to after the data type and you'll be good



    CREATE TABLE customer (
    customer_id INT NOT NULL,
    name VARCHAR2(30) NOT NULL,
    date_of_birth DATE,
    phone_nb CHAR(8) NOT NULL,
    address VARCHAR(50),
    total_spending FLOAT DEFAULT 0.0 NOT NULL,
    PRIMARY KEY ( customer_id )
    );


    PS In oracle, use VARCHAR2, not VARCHAR. While VARCHAR will 'work', it's reserved and could mean something different in a future release.






    share|improve this answer



















    • 1





      Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

      – Littlefoot
      Nov 23 '18 at 19:29











    • @Littlefoot nice catch :)

      – thatjeffsmith
      Nov 23 '18 at 19:32






    • 2





      I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

      – Bob Jarvis
      Nov 23 '18 at 22:46











    • It doesn't hurt anything, probably

      – thatjeffsmith
      Nov 24 '18 at 0:12
















    2














    Since you tagged SQL Developer...



    ...the tool tries to give you a heads-up there will be a problem before you even hit the Execute button



    enter image description here



    The default value for the column is confusing the parser because it's not expected at that point.



    Move it to after the data type and you'll be good



    CREATE TABLE customer (
    customer_id INT NOT NULL,
    name VARCHAR2(30) NOT NULL,
    date_of_birth DATE,
    phone_nb CHAR(8) NOT NULL,
    address VARCHAR(50),
    total_spending FLOAT DEFAULT 0.0 NOT NULL,
    PRIMARY KEY ( customer_id )
    );


    PS In oracle, use VARCHAR2, not VARCHAR. While VARCHAR will 'work', it's reserved and could mean something different in a future release.






    share|improve this answer



















    • 1





      Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

      – Littlefoot
      Nov 23 '18 at 19:29











    • @Littlefoot nice catch :)

      – thatjeffsmith
      Nov 23 '18 at 19:32






    • 2





      I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

      – Bob Jarvis
      Nov 23 '18 at 22:46











    • It doesn't hurt anything, probably

      – thatjeffsmith
      Nov 24 '18 at 0:12














    2












    2








    2







    Since you tagged SQL Developer...



    ...the tool tries to give you a heads-up there will be a problem before you even hit the Execute button



    enter image description here



    The default value for the column is confusing the parser because it's not expected at that point.



    Move it to after the data type and you'll be good



    CREATE TABLE customer (
    customer_id INT NOT NULL,
    name VARCHAR2(30) NOT NULL,
    date_of_birth DATE,
    phone_nb CHAR(8) NOT NULL,
    address VARCHAR(50),
    total_spending FLOAT DEFAULT 0.0 NOT NULL,
    PRIMARY KEY ( customer_id )
    );


    PS In oracle, use VARCHAR2, not VARCHAR. While VARCHAR will 'work', it's reserved and could mean something different in a future release.






    share|improve this answer













    Since you tagged SQL Developer...



    ...the tool tries to give you a heads-up there will be a problem before you even hit the Execute button



    enter image description here



    The default value for the column is confusing the parser because it's not expected at that point.



    Move it to after the data type and you'll be good



    CREATE TABLE customer (
    customer_id INT NOT NULL,
    name VARCHAR2(30) NOT NULL,
    date_of_birth DATE,
    phone_nb CHAR(8) NOT NULL,
    address VARCHAR(50),
    total_spending FLOAT DEFAULT 0.0 NOT NULL,
    PRIMARY KEY ( customer_id )
    );


    PS In oracle, use VARCHAR2, not VARCHAR. While VARCHAR will 'work', it's reserved and could mean something different in a future release.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 23 '18 at 19:26









    thatjeffsmiththatjeffsmith

    8,53211448




    8,53211448








    • 1





      Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

      – Littlefoot
      Nov 23 '18 at 19:29











    • @Littlefoot nice catch :)

      – thatjeffsmith
      Nov 23 '18 at 19:32






    • 2





      I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

      – Bob Jarvis
      Nov 23 '18 at 22:46











    • It doesn't hurt anything, probably

      – thatjeffsmith
      Nov 24 '18 at 0:12














    • 1





      Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

      – Littlefoot
      Nov 23 '18 at 19:29











    • @Littlefoot nice catch :)

      – thatjeffsmith
      Nov 23 '18 at 19:32






    • 2





      I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

      – Bob Jarvis
      Nov 23 '18 at 22:46











    • It doesn't hurt anything, probably

      – thatjeffsmith
      Nov 24 '18 at 0:12








    1




    1





    Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

    – Littlefoot
    Nov 23 '18 at 19:29





    Just a comment: CUSTOMER_ID doesn't have to be set to NOT NULL as it is a primary key column, and primary keys don't allow NULLs anyway.

    – Littlefoot
    Nov 23 '18 at 19:29













    @Littlefoot nice catch :)

    – thatjeffsmith
    Nov 23 '18 at 19:32





    @Littlefoot nice catch :)

    – thatjeffsmith
    Nov 23 '18 at 19:32




    2




    2





    I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

    – Bob Jarvis
    Nov 23 '18 at 22:46





    I don't know about anyone else, but I work with people who are pretty vague about the three properties of a primary key (unique, not null, unchanging). As such, I often include a NOT NULL constraint on a primary key, just to ram home the idea that NULLs are not allowed in this column.

    – Bob Jarvis
    Nov 23 '18 at 22:46













    It doesn't hurt anything, probably

    – thatjeffsmith
    Nov 24 '18 at 0:12





    It doesn't hurt anything, probably

    – thatjeffsmith
    Nov 24 '18 at 0:12













    0














    You are using wrong order of column definition clauses: the constraint (NOT NULL) should follow the default value.



    This is the right way:



    CREATE TABLE CUSTOMER
    (
    CUSTOMER_ID INT NOT NULL,
    NAME VARCHAR(30) NOT NULL,
    DATE_OF_BIRTH DATE,
    PHONE_NB CHAR(8) NOT NULL,
    ADDRESS VARCHAR(50),
    TOTAL_SPENDING FLOAT DEFAULT 0.0 NOT NULL ,

    PRIMARY KEY(CUSTOMER_ID)
    );





    share|improve this answer






























      0














      You are using wrong order of column definition clauses: the constraint (NOT NULL) should follow the default value.



      This is the right way:



      CREATE TABLE CUSTOMER
      (
      CUSTOMER_ID INT NOT NULL,
      NAME VARCHAR(30) NOT NULL,
      DATE_OF_BIRTH DATE,
      PHONE_NB CHAR(8) NOT NULL,
      ADDRESS VARCHAR(50),
      TOTAL_SPENDING FLOAT DEFAULT 0.0 NOT NULL ,

      PRIMARY KEY(CUSTOMER_ID)
      );





      share|improve this answer




























        0












        0








        0







        You are using wrong order of column definition clauses: the constraint (NOT NULL) should follow the default value.



        This is the right way:



        CREATE TABLE CUSTOMER
        (
        CUSTOMER_ID INT NOT NULL,
        NAME VARCHAR(30) NOT NULL,
        DATE_OF_BIRTH DATE,
        PHONE_NB CHAR(8) NOT NULL,
        ADDRESS VARCHAR(50),
        TOTAL_SPENDING FLOAT DEFAULT 0.0 NOT NULL ,

        PRIMARY KEY(CUSTOMER_ID)
        );





        share|improve this answer















        You are using wrong order of column definition clauses: the constraint (NOT NULL) should follow the default value.



        This is the right way:



        CREATE TABLE CUSTOMER
        (
        CUSTOMER_ID INT NOT NULL,
        NAME VARCHAR(30) NOT NULL,
        DATE_OF_BIRTH DATE,
        PHONE_NB CHAR(8) NOT NULL,
        ADDRESS VARCHAR(50),
        TOTAL_SPENDING FLOAT DEFAULT 0.0 NOT NULL ,

        PRIMARY KEY(CUSTOMER_ID)
        );






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 23 '18 at 22:37









        mustaccio

        14.7k84042




        14.7k84042










        answered Nov 23 '18 at 22:19









        Oscar Alberto Ancajima RodriguOscar Alberto Ancajima Rodrigu

        72




        72






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451840%2fwhat-does-the-error-missing-right-parenthesis-in-oracle-sql-means%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?