Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: [hurry]PL/SQL ERROR ORA-06552 ORA-06553:
Hy Sohn
I tried this on my Oracle 8.0.5 for NT, and it works fine:
create table OWNER_INFO (STORE_NO number, c number);
create sequence STORE_NO_SEQ;
CREATE OR REPLACE TRIGGER TRG_I_OWNER
BEFORE INSERT ON "OWNER_INFO"
FOR EACH ROW
DECLARE
I INTEGER;
BEGIN
IF :NEW.STORE_NO IS NULL THEN
SELECT STORE_NO_SEQ.NEXTVAL INTO I FROM DUAL;
:NEW.STORE_NO := I;
END IF;
END;
/
Which version/OS are you using?
From Oracle documentation:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
Cause: In a declaration, the name of a variable or cursor is misspelled or the declaration makes a forward reference. Forward references are not allowed in PL/SQL. A variable or cursor must be declared before it is referenced it in other statements, including other declarative statements. For example, the following declaration of dept_rec raises this exception because it refers to a cursor not yet declared:
DECLARE dept_rec dept_cur%ROWTYPE;
CURSOR dept_cur IS SELECT ...
...
Action: Check the spelling of all identifiers in the declaration. If necessary, move the declaration so that it makes no forward references.
Ciao Gennaro
sohn dae ho wrote:
> When using trigger there was some error...
>
> SQL> CREATE OR REPLACE TRIGGER TRG_I_OWNER
> 2 BEFORE INSERT ON "OWNER_INFO"
> 3 FOR EACH ROW
> 4 DECLARE
> 5 I INTEGER;
> 6 BEGIN
> 7 IF :NEW.STORE_NO IS NULL THEN
> 8 SELECT STORE_NO_SEQ.NEXTVAL INTO I FROM DUAL;
> 9 :NEW.STORE_NO := I;
> 10 END IF;
> 11 END;
> 12 /
> CREATE OR REPLACE TRIGGER TRG_I_OWNER
> *
> < Error>
>
> ERROR at line 1:
> ORA-06552: PL/SQL: Compilation unit analysis terminated
> ORA-06553: PLS-320: the declaration of the type of this expression is
> incomplete or malformed
>
> Can anyone help me with this???
Received on Thu Aug 26 1999 - 02:37:29 CDT