Oracle快递包缺少右括号

发布于 2024-10-18 20:31:44 字数 1591 浏览 2 评论 0原文

我在调用此包中的函数时遇到缺少右括号错误,您能帮我吗?

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;

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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小伙你站住 2024-10-25 20:31:44

您在第一个 EXECUTE 语句中拼错了“constraint”。

You misspelled "constraint" in your first EXECUTE statement.

梦言归人 2024-10-25 20:31:44

我没有 Oracle 数据库来测试这个。首先独立执行建表语句,看是否关心建表没有错误。那么你必须放弃一切。然后从过程中删除所有语句并进行测试。然后只添加一条语句并尝试。像这样尝试一次添加一个语句。您将看到哪一个给出了错误。你可能必须解决这个问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文