开发者

Oracle express package missing right parenthesis

I'm getting missing right parenthesis error while calling the function in this package , could you please help me ?

create or replace package body "GESTIONRH" is

procedure CREATETABLES
as
begin

  EXECUTE IMMEDIATE 'CREATE TABLE jobs
  ( job_id         VARCHAR2(10)
  , job_title      VARCHAR2(35)
  , min_salary     NUMBER(6)
  , max_salary     NUMBER(6)
  , constrataint pk_jobs primary key (job_id) )  '; 

  EXECUTE IMMEDIATE 'Create table departments
  ( department_id    NUMBER(4)
  , department_name  VARCHAR2(30)
  , manager_id       NUMBER(6)
  , 开发者_如何转开发location_id      NUMBER(4)
  , constraint pk_dep primary key(department_id)  ) '; 

  EXECUTE IMMEDIATE 'CREATE TABLE employees
  ( employee_id    NUMBER(6)
  , first_name     VARCHAR2(20)
  , last_name      VARCHAR2(25)
  , email          VARCHAR2(25)
  , phone_number   VARCHAR2(20)
  , hire_date      DATE
  , job_id         VARCHAR2(10)
  , salary         NUMBER(8,2)
  , commission_pct NUMBER(2,2)
  , manager_id     NUMBER(6)
  , department_id  NUMBER(4)
  , CONSTRAINT pk_employee primary key (employee_id)      )';

  EXECUTE IMMEDIATE 'CREATE TABLE job_history
  ( employee_id   NUMBER(6)
  , start_date    DATE
  , end_date      DATE
  , job_id        VARCHAR2(10)
  , department_id NUMBER(4)
  , CONSTRAINT pk_job_history primary key (employee_id, start_date) )'; 

  EXECUTE IMMEDIATE 'CREATE TABLE dependents
  ( Id    NUMBER(6)
  , FirstName     VARCHAR2(20)
  , LastName      VARCHAR2(25)
  , Birthdate Date
  , Relation VARCHAR2(20)
  , Gender VARCHAR2(2)
  , RelativeId Number(6) 
  , CONSTRAINT pk_dependent primary key (Id))';         

end CREATETABLES;

end GESTIONRH;


You misspelled "constraint" in your first EXECUTE statement.


I dont have Oracle db to test this. First execute create table statement independently to see if they care create tables without error. Then you have to drop all. Then remove all of the statements from the procedure and test. Then add only one statement and try. Like that try to add one statement at a time. You will see which one is giving error. You may have to fix that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜