简体   繁体   English

在 Apex Oracle 上制作 SQL 表时遇到问题

[英]Have problem making SQL table on Apex Oracle

I'm making two tables, STUDENT and STUDENTREPORT .我正在制作两张桌子, STUDENTSTUDENTREPORT I made STUDENT , but not the other.我做了STUDENT ,但不是另一个。 I ran the code, but it says missing or invalid option.我运行了代码,但它说缺少或无效的选项。

My STUDENTREPORT command:我的STUDENTREPORT命令:

Both commands are correctly written, they execute OK in eg SQL*Plus or SQL Developer:两个命令都正确编写,它们在例如 SQL*Plus 或 SQL 开发人员中执行正常:

SQL> CREATE TABLE studentreport (
  2      sr_number      VARCHAR2(5),
  3      sr_rade        VARCHAR2(5),
  4      sr_semester    VARCHAR2(5),
  5      class_attended NUMBER,
  6      s_id           VARCHAR2(5),
  7      PRIMARY KEY ( sr_number )
  8          USING INDEX enable
  9  );

Table created.

SQL> ALTER TABLE studentreport
  2      ADD FOREIGN KEY ( s_id )
  3          REFERENCES student ( s_id )
  4      ENABLE;

Table altered.

SQL>

But, in Oracle Apex' SQL Workshop , you can execute only one command at a time.但是,在 Oracle Apex 的SQL Workshop中,您一次只能执行一个命令。 Therefore:所以:

  • remove alter table (delete it from the editor) so that you'd first execute create table ;删除alter table (从编辑器中删除),以便您首先执行create table then delete that statement and execute alter table , or然后删除该语句并执行alter table ,或者
  • select (with a mouse, so that text turns blue ) create table and hit RUN to execute it; select(用鼠标,使文本变为蓝色create table并点击RUN执行它; then select alter table and execute it with RUN然后 select alter table并使用 RUN 执行它

That's just how SQL Workshop behaves, there's nothing you can do about it (at least, I don't know what you could/should do, apart from what I already said).这就是 SQL Workshop 的行为方式,您对此无能为力(至少,除了我已经说过的,我不知道您可以/应该做什么)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM