【问题标题】:Need help on Oracle 10g express edition需要有关 Oracle 10g 速成版的帮助
【发布时间】:2011-05-21 17:37:20
【问题描述】:

当我尝试在下表中插入记录时出现错误“ora-03001:未实现的功能”。我已经搜索了一夜,仍然没有运气。我用的是Oracle10g express版。

create or replace type MajorsType As varray(20) of varchar2(10);

create or replace type studenttype as object (
stuID varchar2(5),
lastName varchar2(15),
firstName varchar2(12),
majors MajorsType)
INSTANTIABLE
NOT FINAL;

create table Student of StudentType (
constraint student_stuID_pk PRIMARY KEY(stuID));

INSERT INTO student values StudentType ('S999', 'Smith', 'John', MajorsType('Math', 'Accounting'));

【问题讨论】:

  • 既然可以轻松下载完整版,为什么还要使用表达式版?
  • 我是新手,我认为速成版是免费的。
  • 完整版可免费用于自学。适用于商业用途的许可证。
  • 并不是说在这种情况下使用XE与错误有关。

标签: database oracle oracle-xe oracle-type


【解决方案1】:

这是一个简单的语法错误:VALUES 子句要求所有内容都用括号括起来:

SQL> INSERT INTO student
  2  values ( StudentType ('S999', 'Smith', 'John', MajorsType('Math', 'Accounting')))
  3  /

1 row created.

SQL>

无论我们传入多个标量值还是单个类型,这都适用。


不适用的一种情况是使用 RECORD 类型在 PL/SQL 中插入。这与您的情况无关,但为了完整起见,我提一下。

插入 RECORD 变量看起来像这样

declare
    r23 t23%rowtype;  -- record declaration
begin
    r23.id := 1;
    r23.created := sysdate;
    -- insert using record variable
    insert into t23
    values r23; 
end;

【讨论】:

  • 感谢您的回答。我是 Oracle 数据库的新手。我通常将 phpMyAdmin 与 mySQL 一起使用。
  • +1 获取有关插入记录的信息。总是很难找到这方面的信息,因为它的记录不够好
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-23
  • 2014-12-26
  • 2013-08-12
  • 2014-06-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多