ORA-00927: 尝试更新 object-relational 数据库中的 table 时缺少等号

ORA-00927: missing equal sign when trying to update table in object-relational DB

我正在尝试了解 object-relational 技术并创建了 parent 类型:

CREATE OR REPLACE TYPE STUDENT
AS OBJECT(
    FIO VARCHAR2(200),
    Bday DATE,
    Pas_Id NUMBER(20),
    Address VARCHAR2(50))
NOT INSTANTIABLE
NOT FINAL;

child 类型:

CREATE OR REPLACE TYPE BACH
UNDER STUDENT(
    fieldOfStud varchar2(200),
    Group_N number(4),
    ege number(4),
    GPA number(4),
    MEMBER FUNCTION year_N RETURN NUMBER);

--тело типа бакалавр
CREATE OR REPLACE TYPE BODY BACH IS
MEMBER FUNCTION year_N RETURN NUMBER IS
    BEGIN
        IF SUBSTR(Group_N, 1, 1) BETWEEN 1 and 4 THEN
            RETURN SUBSTR(Group_N, 1, 1);
        END IF;
        RETURN 0;
    END;
END;

已创建 table:

CREATE TABLE Students_Table(
SID  NUMBER CONSTRAINT id_pk PRIMARY KEY,
stdt STUDENT
);

并插入数据。我 100% 确定它存在。 我想更新 table 并更改组,例如,从 5231 到 6231:

update Students_Table st 
set    TREAT(stdt as maga).Group_N = TREAT(stdt as maga).Group_N+1000 
where  TREAT(stdt AS MAGA).Pas_Id = 241122

但是报错

ORA-00927: missing equal sign

您需要在语句的前面应用转换,以便更新只看到子类型:

update ( select s.sid, treat(stdt as bach) as stdt from students_table s ) st 
set    st.stdt.group_n = st.stdt.group_n + 1000 
where  st.stdt.pas_id = 241122;

DB Fiddle