ORA-00906 missing left parenthesis

Hello

I get "ORA-00906 missing opening parenthesis" error during the creation of the foreign key on the short-term in the table t_friends column.

(1) parent table:

create the table t_city
(
city_name varchar2 primary key (60)
)

(2) child table:

create the table t_friends
(
friend_name varchar2 (30) not null,
city_name varchar2 (60)
)

ALTER table t_friends add constraint city_cons foreign key short-term reference t_city (short-term);

Please can you tell me what is the error that I do in the syntex above.

Thank you
Michel K

Try this:

alter table t_friends add constraint city_cons foreign key (city_name) references t_city(city_name);

You forgot to put the column in parentheses.

Tags: Database

Similar Questions

  • ORA-00907 MISSING RIGHT PARENTHESIS

    Hi all

    The query

    FLASHBACK TABLE schema.table_name to TIMESTAMP (January 18, 2008 18:55:58 ',' MON-DD-YYYY HH24:MI:SS');


    gives me error

    ORA-00907 MISSING RIGHT PARENTHESIS

    WHAT AM I MISSING HERE?


    kAI

    WHAT AM I MISSING HERE?

    Try

    flashback table schema.table_name to timestamp( to_timestamp('18-JAN-2008 18:55:58','DD-MON-YYYY HH24:MI:SS'));
    
  • MISSING LEFT PARENTHESIS

    Hello

    I DON'T KNOW IF I'M MAKING A MISTAKE HERE.
    NVL (patient. Registration_No, ") RegistrationNo,.
    NVL (fn_PatientFullName (Visit.PatientID), cm) PatientName,
    Numbers Billing_Mst.BillNo,
    Billing_Mst.BillDate RDate,
    Billing_Mst.GrossAmount,
    Billing_Mst.DiscountAmount,
    CAST (billingMst.NetAmount AS VARCHAR2) Amount, _ * +.
    Billing_Mst.DueAmount,
    Visit.VisitNo,
    Visit.VisitDate,


    THE ERROR IS HIS IGIVING

    Error (21,52): PL/SQL: ORA-00906: lack of left parenthesis

    include the 'length' of the varchar2

    CAST(Billing_Mst.NetAmount AS VARCHAR2(15)) Amount,
    
  • ORA-01937 missing or invalid role name

    Hi there, I had a little problem with a small piece of code am familiar with Oracle database, scripts I have been done by another person for the version 6/7 is currently using version 8i for reasons of compatibley with the server software, I am currently setting up.

    use the script generates the following error message

    Enter the value of old 1: 1: CREATE ROLE & 1._role

    new 1:

    CREATE ROLE GRANT CONNECT to & 1._role; _role CREATE ROLE GRANT CONNECT to & 1._role; _role

    *

    ERROR on line 1:

    ORA-01937: missing or not a valid role name

    Enter the value of old 1: 1: GRANT RESOURCE TO & 1._role

    new 1: GRANT RESOURCE to GRANT permission TO & 1._role; _role

    RESOURCE of GRANT OF GRANT permission to & 1._role; _role

    *

    ERROR on line 1:

    ORA-00911: invalid character

    Enter the value of old 1: 1: GRANT IMP_FULL_DATABASE TO & 1._role

    new 1: GIVE the IMP_FULL_DATABASE TO GRANT CREATE ANY SYNONYM OF & 1._role;  _role

    GRANT IMP_FULL_DATABASE to GRANT CREATE ANY SYNONYM OF & 1._role;  _role

    *

    ERROR on line 1:

    ORA-00911: invalid character

    Enter the value of old 1: 1: GRANT DROP ANY SYNONYM to & 1._role

    new 1: GRANT DROP ALL SYNONYM of _role

    GRANT DELETE ANY SYNONYM OF _role

    *

    ERROR on line 1:

    ORA-00911: invalid character

    Enter the value 1: enter the value of 2: 1 old: CREATE USER, IDENTIFIED BY 1 & 2

    new 1: CREATE a USER IDENTIFIED BY GRANT & 1._role to & 1.

    CREATE the USER IDENTIFIED BY GRANT & 1._role to & 1.

    *

    ERROR on line 1:

    ORA-01935: lack of user name or role

    Here is the code used

    USE of REM: @ous < username > < PASSWORD >

    REM create a < username > identified by < PASSWORD >

    CREATE a ROLE & 1._role;

    GRANT CONNECT to & 1._role;

    GRANT RESOURCE to & 1._role;

    GRANT permission to & 1._role;

    GRANT IMP_FULL_DATABASE to & 1._role;

    GRANT CREATE ANY SYNONYM OF & 1._role;

    GRANT DROP ANY SYNONYM OF & 1._role;

    CREATE a USER & 1 IDENTIFIED BY & 2

    QUOTA UNLIMITED ON gam_lgtab

    QUOTA UNLIMITED ON gam_bintab

    QUOTA UNLIMITED ON gam_tab

    QUOTA UNLIMITED ON gam_ind

    TEMPORARY TABLESPACE temp;

    GRANT & 1._role to & 1.

    can someone help me to solve this thanks, that a working example would be due to my lack of knowledge with this database system.

    Thank you very much

    Hello

    How do you call this script?

    According to the commentary at the beginning of the script, this is:

    USE of REM: @ous

    you're supposed to give 2 arguments after the name of the script (which, apparently, is UO).  The first argument is a user name; so it should follow the rules for user names (for example it must start with a letter and only contain letters, numbers, or a couple of other characters, such as the features of underscore allowed).  The second argument is the password.  So if you want to create a user called FOO and give him the password to BAR987, then we could say

    @ous FOO BAR987

    SQL * more ' SQL > "command prompt, or to the equivalent point in another front-end tools.»

    This assumes that the ous.sql script is the default location.  If you don't know what it is, you can always give the name of full path, like this:

    @d:\my_directory\sql_stuff\creation_scripts\ous FOO BAR987

    The script creates a different role for each user, it creates.  This isn't a very common practice.  Out of context, I can't say for sure if it's a very bad idea, but we can't if abstain I was wondering if based on such an unusual with these old tools is best for your needs.

  • Missing right parenthesis

    Hi all

    Im trying to insert these results to my table of facts (fact_apartments) with the following:

    INSERT INTO fact_apartments (avg_price, segmentid, projectid)

    SELECT (AVG (Price), segmentid, projectid)

    OF projetou

    WHERE projectid = '1';

    but the return with the missing closing parenthesis, it could not know what the problem

    I don't know why you get this error, probably because you have other errors.

    you will need a group on your query. FOR EXAMPLE

    INSERT INTO fact_apartments (avg_price, segmentid, projectid)

    SELECT AVG (Price), segmentid, projectid

    OF projetou

    WHERE projectid = '1'

    GROUP BY segmentid, projectid;

    Concerning

    André

  • ORA-01506: missing or illegal database name

    I can't start the database instead, I get the above error. Help, please

    [oracle@localhost /] $ pwd
    /
    [oracle@localhost /] $ cd/u01/app/oracle
    [oracle@localhost oracle] $ export ORACLE_BASE = / u01/app/oracle
    [oracle@localhost oracle] $ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
    [oracle@localhost oracle] $ export ORACLE_SID = orcl
    [oracle@localhost oracle] $ export PATH = $ORACLE_HOME/bin: $PATH
    [oracle@localhost oracle] $ export TNS_ADMIN=/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
    [oracle@localhost oracle] $ sqlplus / as sysdba

    SQL * more: Production of release 11.2.0.1.0 Thu Feb 14 17:33:11 2013

    Copyright (c) 1982, 2009, Oracle. All rights reserved.

    Connect to an instance is idle.

    SQL > startup
    ORA-01506: missing or illegal database name
    SQL >

    >
    ...
    [oracle@localhost oracle] $ export ORACLE_SID = orcl
    ...
    -rw - r - r - 1 root root 69 14 Feb 12:02 initorcl.ora
    ...
    >

    Why the initorcl.ora file is owned by root? As mentioned, do not perform any oracle about actions or commands as root.

    HTH
    Srini

  • Please help me with the missing right parenthesis

    The code below gives me error of missing right parenthesis. can someone help me understand the error code. Thank you.

    SELECT * FROM CIRC.DRAW_TYPE A
    WHERE A.CITY_CODE IN CASE WHEN :Rnzip='WithZip' THEN   ('46301', '46302') ELSE  A.CITY_CODE END

    You can try this.

    SELECT *
      FROM CIRC.DRAW_TYPE A
     WHERE (A.CITY_CODE = decode(:Rnzip,'WithZip','46301',A.CITY_CODE))
        Or (A.CITY_CODE = decode(:Rnzip,'WithZip','46302',A.CITY_CODE))
    

    Note: not tested

  • ORA-02421: missing or not valid schema authorization identifier

    Hello Evryone,

    I'm having a problem with the session of the user schema. I'm not able to change the schema that it even exists.
    SQL>ALTER session SET CURRENT_SCHEMA='QA'
    Error report:
    SQL Error: ORA-02421: missing or invalid schema authorization identifier
    02421. 00000 -  "missing or invalid schema authorization identifier"
    *Cause:    the schema name is missing or is incorrect in an authorization
               clause of a create schema statement.
    *Action:   If the name is present, it must be the same as the current
               schema.
    
    
    SQL>select username, account_status from DBA_USERS where username='QA';
    
    USERNAME                       ACCOUNT_STATUS                   
    ------------------------------ -------------------------------- 
    QA                                        OPEN                             
    
    SQL>SHOW user
    
    USER is SYSTEM
    
    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for HPUX: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    Try it without the single quotes.

    Best regards

    mseberg

    Test on mine:

    Release 11.2.0.1.0 - 64 bit production

    I get the same error with quotes

    ERROR on line 1:
    ORA-02421: missing or not valid schema authorization identifier

    Published by: mseberg on August 15, 2011 14:50

    So, this and then check

    ALTER SESSION SET CURRENT_SCHEMA=QA
    

    You can check it using this:

    select sys_context('USERENV','SESSION_SCHEMA') from dual;
    

    Published by: mseberg on August 15, 2011 15:08

  • ORA-00922: missing or not valid option?

    Can someone tell me what is the problem with this statement:
    SQL > CREATE TABLE CUSTOMER2
    2 2 (employe_id NUMBER (10),)
    3 3 FIRST NAME VARCHAR2 (40),
    4 4 LASTNAME VARCHAR2 (40),
    5 5 VARCHAR2 (40) OF COMPANYNAME,.
    6 6 PHONE VARCHAR2 (40),
    7 7 E-MAIL VARCHAR2 (40),
    8 8 CITY VARCHAR2 (40),
    9 9 VARCHAR2 (40) STATE.
    10 10 ZIP VARCHAR2 (40)
    11 (11);
    2 (employe_id NUMBER (10),)
    *
    ERROR on line 2:
    ORA-00922: missing or not valid option

    Instead of your code with below

    CREATE TABLE CUSTOMER2
     ( employee_id NUMBER(10),
      FIRSTNAME VARCHAR2(40),
     LASTNAME VARCHAR2(40),
     COMPANYNAME VARCHAR2(40),
     PHONE VARCHAR2(40),
      EMAIL VARCHAR2(40),
      CITY VARCHAR2(40),
      STATE VARCHAR2(40),
      ZIP VARCHAR2(40)
      );
    
  • Missing right parenthesis when you use the CONTAINS function

    Hello

    The following sql causes the error "missing right parenthesis. Its a search engine simple execution of PHP that dynamically adds each keyword to a connection variable. This works fine if I use only 1 keyword, but as soon as others are added, I get the error.

    Here's the SQL echo:
    SELECT SCORE(1), TITLE FROM MYTABLE WHERE CONTAINS(TITLE, :1 AND :2, 1) > 0 ORDER BY SCORE(1), TITLE ASC
    My 1st thought was contains it seeks single quote so I tried the following combinations:
     CONTAINS(TITLE, ':1' AND ':2', 1) > 0
     CONTAINS(TITLE, ':1 AND :2', 1) > 0
    Both through the crossover so maybe its nothing to do with citations. I also tried to use single quotes when concatinating the sql in PHP. No joy :(

    CONTAINS the second parameter is a string, so you should concatenate your variables of two link with the chain AND:

    CONTAINS (TITLE,: 1 |) ' AND ' | (: 2, 1) > 0

  • Error: PL / SQL: ORA-00922: missing or invalid option

    I'm sorry, I'm new to Oracle and am in a crazy time. I'm having all kinds of problems with the conversion of SQL to Oracle... and get the PL/SQL: ORA-00922: missing or not valid error option with the following function. Any help appreciated.

    FUNCTION IEXGADQReceived)
    v_BDateTime IN DATE
    v_EDateTime IN DATE
    v_Queuename IN VARCHAR2
    v_Username IN VARCHAR2
    )
    RETURN int IS
    INT v_retval;
    BEGIN
    SET v_retval: = (select count (distinct iid)
    Of agentinteractionsview
    WHERE the ibegintime between v_BDateTime and v_EDateTime
    and fromqueue = v_Queuename
    and fromroutereasonid = 11
    and username = v_Username);

    RETURN v_retval;
    END IEXGADQReceived;

    No problem, we've all been there before: D)

    FUNCTION IEXGADQReceived (v_BDateTime IN DATE,v_EDateTime IN DATE,v_Queuename IN VARCHAR2,v_Username IN VARCHAR2)RETURN int ISv_retval INT;BEGINselect count(distinct iid) INTO v_retval FROM agentinteractionsviewWHERE ibegintime between v_BDateTime and v_EDateTimeand fromqueue = v_Queuenameand fromroutereasonid = 11and username = v_Username;
    
    RETURN v_retval;END IEXGADQReceived;
    
  • ORA-00906: lack of left parenthesis

    Here's my query

    I'm getting above error

    Please help me.

    ALTER TABLE Dept10 CHANGE Dname VARCHAR2 NOT NULL

    /

    The General form is alter table owner.table_name change (column_name data_type (length))

    - -

    Note that the varchar2 variables must have a specified length as (dname varchar2 (20))

    - -

    HTH - Mark D Powell.

  • Disqualification - Error exporting to DB: ORA-00928 missing SELECT


    Hello

    I use v12.1.3.0.0 of the Disqualification and have created evidence very basic process of concept that takes as input a comma-demilited of files through the process of the player and then with a writing processor to write data staged entry.

    I then try to export the data showcased in the corresponding table in the database, but get the following error message:

    "xxxxxx failed: writing problem Insert batch of database: ORA-00928: lack of SELECT key word."

    A single CSV file with 3 fields and across the database contains the input staging file data, all I have in the schema is a single table that I write for. I can connect to my DB store data target in Disqualification without any problem.

    Does anyone have any ideas as to what could be the cause? Reading upward on this error gives to think it is to SELECT key missing with the word in a CREATE VIEW statement, but I don't know where or why she strives to create a view.

    Any help would be appreciated.

    Hello

    -Your export write in an existing table or create a new table (as configured in the export task definition)?

    -If the former, that export option do you use (as configured in the work using export)? The three options assuming a DB target are 'Erase existing data and insert","add to current data' and 'Replace records with the help of the primary key'.

    Note If just run the export as a stand-alone task rather than in a work (for example, right-click, executed in the tree) it will run in mode Delete and Insert.

    It looks a bit like the export may be trying to replace the records by primary key, but can not detect the PK in the target table to select the records to be deleted before insertion (Disqualification does not 'Update' statements currently - this is why the table must be an intermediate table autonomous or similar without FK constraints or the permission issues that would prevent the Disqualification deleting records in this mode).

    Kind regards

    Mike

  • missing closing parenthesis when creating foreign key

    Schema1.Table1 ALTER TABLE ADD (CONSTRAINT test_FK

    FOREIGN KEY (test)

    REFERENCES schema1.table2 (test)

    USING INDEX TABLESPACE indextb);

    With the HELP of INDEX TABLESPACE indextb)

    *

    ERROR on line 4:

    ORA-00907: lack of right parenthesis

    Please help, I tried several times. But I still get the same error

    Delete the TABLESPACE of INDEX clause to HELP.  It is not valid here.

    Create a foreign key does not implicitly create an index.  Since there is no index, there is no tablespace to worry.  As a general rule, you don't want to create an index to support the how foreign key constraint there a sense perhaps specify a tablespace.

    Justin

  • Missing right parenthesis error

    I have all brackets correctly syntxed, however, I still get the missing parenthesis error. Someone please help!

    create the table w_agree_d
    (
    DATASOURCE_NUM_ID NUMERIC (10,0) NOT NULL,
    ETL_PROC_WID NUMERIC (10,0) NOT NULL,
    INTEGRATION_ID VARCHAR2 (30) NOTNUL,.
    MINI_WID NUMERIC (10,0) NOT NULL DEFAULT 0,
    ROW_WID NUMERIC (10,0) NOT NULL,
    STAMP OF APPR_DT,
    STAMP OF EFF_DT,
    END_DT TIMESTAMP,
    RENEWABLE_FLG VARCHAR2 (1).
    SERVICE_FLG VARCHAR2 (1).
    STAMP OF START_DT,
    VALID_FLG VARCHAR2 (1).
    AGREE_CD VARCHAR2 (30),
    AGREE_CD_I VARCHAR2 (50).
    AGREE_NUM VARCHAR2 (30),
    APPR_BY_EMP VARCHAR2 (50).
    NAME VARCHAR2 (50).
    PAR_INTEGRATION_ID VARCHAR2 (30),
    PAR_NAME VARCHAR2 (50).
    PRI_LST_NAME VARCHAR2 (50).
    PR_SALES_EMP VARCHAR2 (50).
    RATE_LST_NAME VARCHAR2 (50).
    STATUS_CD VARCHAR2 (30),
    STATUS_CD_I VARCHAR2 (50));

    Welcome to the forum!

    NOT NULL

    should be

    NOT NULL
    

    You are missing the SPACE between NO and NULL

    Please read the FAQ on {message identifier: = 9360002} to ask the question in a better way.

Maybe you are looking for

  • Select the feature for tables

    Hello, I am looking for a function similar to a function of SELECTION, but for arrays. I'm doing the following: Say, 3 functions of random numbers are compared to a value (0.5). If the condition (is greater than) is TRUE, I need to switch a button an

  • Outlook Express - mail stuck in Outbox

    I use Outlook express 6.  I try to send a very large E-mail (pic heavy).  The email is stuck in the Outbox.  How do I remove, or he can achieve sending. I just got this error message: The message cannot be sent because its size exceeds the limit of t

  • SSD drive update

    I just installed a crucial 256 GB ssd in my HP Pavilion laptop dv7 I bought at hp 2010-11. My problem is how can I change the ide to ahci mode mode?

  • When I try to sign a document, the screen turns off and I do not see the document.

    When I try to sign a document, the screen turns off and I do not see the document.

  • The beta program just stopped?

    The beta program just stopped? I have connected to my account only to discover that they considered not allowed. Anyone with the same problem today?