ORA-00907: missing right parenthesis in sql

Kailash Sahu 141 Reputation points
2022-03-06T20:47:43.637+00:00
   SQL> create table customer(  
    2  CUST long varchar(5));  

Getting a error :- ORA-00907: missing right parenthesis

I want to 5 CHARACTER LONG of CU180455-yy.jpgST

SQL Server | Other
{count} votes

Accepted answer
  1. Naomi Nosonovsky 8,431 Reputation points
    2022-03-09T04:28:18.24+00:00

    In SQL Server (and other databases) you can have composite primary key (e.g. more than one column can be a primary key). You would use CONSTRAINT keyword, e.g. for example:

        CREATE TABLE [dbo].[Depositor]
                    (
                        cust_no int NOT NULL,
    account_no int NOT NULL,
    
                              CONSTRAINT [PK_Depositor]
                              PRIMARY KEY CLUSTERED ([cust_no], [account_no])
                              WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON
                                    , ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80
                                   ) ON [PRIMARY]
                    ) ON [PRIMARY];
    

    Foreign key constraints are normally created using the following syntax:

    ALTER TABLE [dbo].[Depositor] WITH CHECK
            ADD
                CONSTRAINT [FK_Depositor_Cust_No]
                FOREIGN KEY ([cust_no])
                REFERENCES [dbo].[Customer] ([cust_no]);
    

5 additional answers

Sort by: Most helpful
  1. Ronen Ariely 15,206 Reputation points
    2022-03-07T16:57:56.73+00:00

    Good day,

    As much as I know "LONG VARCHAR" is DB2 or SQL/DS Datatype !

    It is NOT oracle datatype which uses LONG (can store variable-length character data containing up to two gigabytes of information.) and NOT SQL Server data type which uses VARCHAR(MAX)

    https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1830

    More information of equivalent data types between oracle and DB2 or SQL/DS you can find in this link:

    https://docs.oracle.com/cd/A58617_01/server.804/a58241/ch5.htm

    In short, you cannot execute queries in a language which the server not support! If you want to use SQL Server then you should use TSQL :-)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.