Oracle 10g - 数据库导入时的无效字符

发布于 2024-12-01 06:57:03 字数 582 浏览 1 评论 0原文

我有几个要导入的 SQL 文件。

示例:

CREATE TABLE BB_Department (
    idDepartment number(2)  ,
    DeptName varchar2(25) ,
    DeptDesc varchar2(100) ,
    DeptImage varchar2(25) ,
    CONSTRAINT dept_id_pk PRIMARY KEY(idDepartment) );
insert into bb_department 
   values(1,'Coffee','Many types of coffee beans','coffee.gif');

使用 http://localhost:8080/apex 导入此内容时,我不断收到“无效字符”错误。

似乎一次只能运行一条 SQL 语句。任何分号都会触发该错误。

一些在线参考文献指出这可能是字符转换 - 但事实似乎并非如此。

如何在 Web 界面中导入转储文件而不触发此操作?

I have several SQL files that I want to import.

An example:

CREATE TABLE BB_Department (
    idDepartment number(2)  ,
    DeptName varchar2(25) ,
    DeptDesc varchar2(100) ,
    DeptImage varchar2(25) ,
    CONSTRAINT dept_id_pk PRIMARY KEY(idDepartment) );
insert into bb_department 
   values(1,'Coffee','Many types of coffee beans','coffee.gif');

When importing this with http://localhost:8080/apex I continually receive the 'invalid character' error.

It seems that one can only run ONE SQL statement at a time. The error is triggered by any semi-colons.

Some online references state that it might be char conversion - but this does not seem to be the case.

How can I go about importing dump files, in the web interface, without triggering this?

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

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

发布评论

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

评论(1

瀟灑尐姊 2024-12-08 06:57:03

我仍然不太确定您使用的是哪种“Apex Web 工具”。我假设它是 Oracle 10g Express Edition (Oracle 10g XE) 的 Web 界面。

如果我将您的 SQL 语句复制到文本文件中并将其作为 SQL 脚本上传,我可以毫无错误地运行它。它创建表并插入一行。分号可以用作语句分隔符。

对于交互式 SQL 命令页面,情况并非如此。如果命令是编辑区域中唯一的命令(没有分号或斜杠),或者如果我首先选择该命令(同样没有分号或斜杠),我可以成功运行该命令。但是,此页面似乎无法运行多个命令(给出 ORA-00911、ORA-00910、ORA-00933 或 ORA-00905)。

其中一些问题可能是由于浏览器不兼容造成的。使用 Firefox 6,我无法运行或编辑 SQL 脚本。我可以看到未格式化的 SQL 文本,但它是只读的并且具有红色背景。顶部的所有按钮都失效了(或者更确切地说,在 Firefox 的 Javascript 错误控制台中抛出异常)。对于 IE 9,它似乎可以工作。

通常,您可以在单独的行上使用分号或斜杠来分隔 Oracle SQL 脚本中的命令。所以它是:

insert into bb_department 
  values(1,'Coffee','Many types of coffee beans','coffee.gif');
insert into bb_department 
  values(2,'Sugar','Sweet','sugar.gif');

或者:

insert into bb_department 
  values(1,'Coffee','Many types of coffee beans','coffee.gif')
/
insert into bb_department 
  values(2,'Sugar','Sweet','sugar.gif')
/

如果您有 BEGIN/END 块,无论是对于匿名 PL/SQL 块还是存储过程/函数/包,您必须使用斜杠。

运行 SQL 脚本的可靠工具是命令行工具 SQL*plus。它绝对支持分号和斜杠。除了 SQL 语句和 PL/SQL 块之外,它还支持一些其他有用的命令。

SQL Developer(来自 Oracle)是一个图形化、免费且有用的工具。它支持 SQL 语句、PL/SQL 块和大多数 SQL*plus 命令。

I'm still not quite sure which "Apex web tool" you're using. I'll assume it's the web interface of the Oracle 10g Express Edition (Oracle 10g XE).

If I copy your SQL statement into a text file and upload it as a SQL script, I can run it without error. It creates the table and inserts a single row. The semicolons are just fine as statement delimiters.

The same cannot be said about interactive SQL Commands page. I can successfully run a command if it's either the only command in the edit area (without a semicolon or slash) or if I first select the command (again without a semicolon or slash). However, this page seems incapable of running multiple commands (giving either ORA-00911, ORA-00910, ORA-00933 or ORA-00905).

Possibly, some of these problems are due to browser incompatibilities. With Firefox 6, I cannot run or edit SQL scripts. I can see the unformatted SQL text but it is read-only and has a red background. All buttons at the top are dead (or rather throw an exception in Firefox's Javascript error console). With IE 9, it seems to work.

In general, you can either use a semicolon or slash on a separate line to delimit commands in Oracle SQL scripts. So it's either:

insert into bb_department 
  values(1,'Coffee','Many types of coffee beans','coffee.gif');
insert into bb_department 
  values(2,'Sugar','Sweet','sugar.gif');

Or:

insert into bb_department 
  values(1,'Coffee','Many types of coffee beans','coffee.gif')
/
insert into bb_department 
  values(2,'Sugar','Sweet','sugar.gif')
/

If you have a BEGIN/END block, either for a anonymous PL/SQL block or a stored procedure / function / package, you must use the slash.

A reliable tool to run SQL scripts is the command line tool SQL*plus. It definitely supports semicolons and slashes. In addition to SQL statements and PL/SQL blocks, it also supports several additional useful commands.

A graphical, free and useful tool is SQL Developer (from Oracle). It supports SQL statements, PL/SQL blocks and most of the SQL*plus commands.

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