ora-06550 PLS-00553 PL/SQL: Compilation unit analysis terminated

在尝试改善报表查询效能的过程中,发现在Sql/plus中查询正常,但在程序中出现ora-06550 PLS-00553错误。经过排查,问题出现在将程序转移到新服务器并安装了不同版本的Oracle客户端后。通过阅读一篇ITPUB博客文章,最终在文章末尾找到解决方案,成功解决了这个PL/SQL编译问题。

在做一个比较任重道远的事情,结果在过程中总是被其他事情打断,前几天又是被打断了,说是我写的一个报表的查询效能不好,所以要求改善,在Sql/plus 里面执行我的Sql发现效能也就在1秒以内,可是到程序里面就有问题了,所以怀疑是iis server的问题,于是想将程序搬到另一台server也就是后来我碰到标题问题的这台上测试,又因为oracle9i 的odbc有问题,所以将这台server上的9i client删除装了oracle817测试完了后,发现我要做的任重道远的事情的东西不能用了,select 的时候总是提示:ora-06550 PLS-00553 PL/SQL: Compilation unit analysis terminated 困扰我好几天,在这片文章中找到了答案.....(连自己都佩服自己的耐性,因为这篇文章的最后面才会有一句话提醒了我,解决了问题,我都一个个看过来了)

[@more@]
timestamp datatype [message #138929]Sun, 25 September 2005 21:16 Go to next message
lavanya_pvn
Messages: 11
Registered: September 2005
Junior Member
yahoo.gif
hi....

when we create a table with timestamp datatype ....and the column name also as timestamp its created and we can perform all the operations on the table i.e,

create table a (timestamp timestamp);

but if we use this table in a trigger it is giving 'trigger created with compilation errors' , why?
Re: timestamp datatype [message #138997 is a reply to message #138929 ]Mon, 26 September 2005 05:00 Go to previous messageGo to next message
saadatahmad
Messages: 356
Registered: March 2005
Location: Kuwait
Senior Member
yahoo.gifmsnm.gif
hi,
Please read the sticky. You should also provide the code if you'r getting the error message and the version of Oracle database.

Check this:
saadat@anba> SELECT * FROM v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE    9.2.0.1.0       Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

Elapsed: 00:00:00.02
saadat@anba> CREATE TABLE test
  2  ( a TIMESTAMP);

Table created.

Elapsed: 00:00:00.00
saadat@anba> CREATE OR REPLACE TRIGGER trg_test
  2  AFTER INSERT ON test
  3  BEGIN
  4  DBMS_OUTPUT.PUT_LINE('Trigger fired successfully');
  5  END;
  6  /

Trigger created.

Elapsed: 00:00:00.00
saadat@anba> INSERT INTO test
  2  VALUES('09-JAN-2006');
Trigger fired successfully

1 row created.

Elapsed: 00:00:00.00
saadat@anba> COMMIT;

Commit complete.

Elapsed: 00:00:00.00
saadat@anba> SELECT * FROM test;

A
---------------------------------------------------------------------------
09-JAN-20 06.00.00.000000 AM

Elapsed: 00:00:00.00
saadat@anba>

It doesn't give the error. You have to check the error you'r receiving by the command SHOW ERRORS

Regards
Re: timestamp datatype [message #139011 is a reply to message #138929 ]Mon, 26 September 2005 05:17 Go to previous messageGo to next message
sharan_it
Messages: 131
Registered: July 2005
Location: Chennai
Senior Member
C2K@FXUT> create table a (timestamp timestamp);

Table created.

C2K@FXUT> insert into a values(sysdate);

1 row created.

C2K@FXUT> select * from a;
select * from a
*
ERROR at line 1:
ORA-03115: unsupported network datatype or representation


C2K@FXUT> desc a;
Name Null? Type
------------------------------- -------- ----
TIMESTAMP UNDEFINED


see type is not supporting (This is in Oracle 9i only)
Re: timestamp datatype [message #139014 is a reply to message #138929 ]Mon, 26 September 2005 05:24 Go to previous messageGo to next message
sharan_it
Messages: 131
Registered: July 2005
Location: Chennai
Senior Member

1 CREATE OR REPLACE TRIGGER trg_test
2 AFTER INSERT ON a
3 BEGIN
4 DBMS_OUTPUT.PUT_LINE('Trigger fired successfully');
5* END;
6 /
AFTER INSERT ON a
*
ERROR at line 2:
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed


C2K@FXUT> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

C2K@FXUT> desc a;
Name Null? Type
------------------------------- -------- ----
TIMESTAMP UNDEFINED
Re: timestamp datatype [message #139027 is a reply to message #138929 ]Mon, 26 September 2005 05:54 Go to previous messageGo to next message
rajavu1
Messages: 586
Registered: May 2005
Location: Bangalore
Senior Member
Hi sharan,

See what happens...

SQL> connect
Enter user-name: scott
Enter password: ************
Connected.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE    9.2.0.1.0       Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

SQL> create table a (timestamp timestamp);

Table created.

SQL> insert into a values(sysdate);

1 row created.

SQL> select * from a;

TIMESTAMP
---------------------------------------------------------------------------
26-SEP-05 04.25.06.000000 PM

SQL> desc a;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TIMESTAMP                                          TIMESTAMP(6)

SQL> CREATE OR REPLACE TRIGGER trg_test
  2  AFTER INSERT ON a
  3  BEGIN
  4  DBMS_OUTPUT.PUT_LINE('Trigger fired successfully');
  5   END;
  6  /
AFTER INSERT ON a
                *
ERROR at line 2:
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is
incomplete or malformed


SQL> alter table a rename column timestamp to ts;

Table altered.

SQL>  CREATE OR REPLACE TRIGGER trg_test
  2   AFTER INSERT ON a
  3   BEGIN
  4   DBMS_OUTPUT.PUT_LINE('Trigger fired successfully');
  5    END;
  6  /

Trigger created.

SQL> set serverout on
SQL> insert into a values(sysdate);
Trigger fired successfully

1 row created.

SQL> 


Thumbs Up
Rajuvan
Re: timestamp datatype [message #139036 is a reply to message #138929 ]Mon, 26 September 2005 06:17 Go to previous messageGo to next message
sharan_it
Messages: 131
Registered: July 2005
Location: Chennai
Senior Member

C2K@FXUT> create table a(timestamp timestamp);

Table created.

C2K@FXUT> insert into a values(sysdate);

1 row created.


C2K@FXUT> select * from a;
select * from a
*
ERROR at line 1:
ORA-03115: unsupported network datatype or representation


C2K@FXUT> desc a;
Name Null? Type
------------------------------- -------- ----
TIMESTAMP UNDEFINED

C2K@FXUT> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

why am only getting error???? I tried to do the same u did...
Re: timestamp datatype [message #139053 is a reply to message #139036 ]Mon, 26 September 2005 07:38 Go to previous messageGo to next message
saadatahmad
Messages: 356
Registered: March 2005
Location: Kuwait
Senior Member
yahoo.gifmsnm.gif
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Sep 26 15:20:30 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Enter user-name: scott/tiger@anba

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

scott@anba> DROP TABLE test;

Table dropped.

Elapsed: 00:00:05.06
scott@anba> CREATE TABLE test
  2  (timestamp TIMESTAMP);

Table created.

Elapsed: 00:00:00.04
scott@anba> INSERT INTO test
  2  VALUES(sysdate);

1 row created.

Elapsed: 00:00:00.00
scott@anba> SELECT * FROM test;

TIMESTAMP
---------------------------------------------------------------------------
26-SEP-05 03.21.41.000000 PM

Elapsed: 00:00:00.00
scott@anba> DESC test
 Name                                                                    Null?    Type
 ----------------------------------------------------------------------- -------- -------------------
 TIMESTAMP                                                                        TIMESTAMP(6)

scott@anba> CREATE OR REPLACE TRIGGER trg_test
  2  AFTER INSERT ON test
  3  BEGIN
  4  DBMS_OUTPUT.PUT_LINE('Trigger Fired Successfully');
  5  END;
  6  /
AFTER INSERT ON test
                *
ERROR at line 2:
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed


Elapsed: 00:00:00.02
scott@anba> ALTER TABLE test
  2  RENAME COLUMN timestamp TO ts;

Table altered.

Elapsed: 00:00:00.06
scott@anba> CREATE OR REPLACE TRIGGER trg_test
  2  AFTER INSERT ON test
  3  BEGIN
  4  DBMS_OUTPUT.PUT_LINE('Trigger Fired Successfully');
  5  END;
  6  /

Trigger created.

Elapsed: 00:00:00.04
scott@anba> INSERT INTO test
  2  VALUES(sysdate);
Trigger Fired Successfully

1 row created.

Elapsed: 00:00:00.01
scott@anba> desc test
 Name                                                                    Null?    Type
 ----------------------------------------------------------------------- -------- -------------------
 TS                                                                               TIMESTAMP(6)

scott@anba> SELECT * FROM test;

TS
---------------------------------------------------------------------------
26-SEP-05 03.21.41.000000 PM
26-SEP-05 03.24.55.000000 PM

Elapsed: 00:00:00.00
scott@anba> DROP TABLE test;

Table dropped.

Elapsed: 00:00:00.02

TO be honest, I don't have an idea why you'r getting this behaviour. May be some other person can explain.

Regards
Re: timestamp datatype [message #139063 is a reply to message #139036 ]Mon, 26 September 2005 08:02 Go to previous messageGo to next message
Art Metzer
Messages: 2477
Registered: January 2003
Senior Member
Are you using database links in any way?

Did you check out what the documentation had to say about the error message?
Quote:

ORA-03115 unsupported network datatype or representation

Cause: A user bind or define, or an Oracle function, is not supported by this heterogeneous Net8 connection.

Action: Upgrade the older version of Oracle and try again.
Please also read this AskTom thread, "accessing a higher version database from lower.".
Re: timestamp datatype [message #139222 is a reply to message #138929 ]Mon, 26 September 2005 21:00 Go to previous messageGo to next message
lavanya_pvn
Messages: 11
Registered: September 2005
Junior Member
yahoo.gif
thank u guys ......
but can any one tell me why a trigger cannot support a table with same column name and same date type......more over only timestamp is the one, using which we can create such table we can't even create such table with others datatypes........

anyway thanks guys for trying ......
Re: timestamp datatype [message #139250 is a reply to message #138929 ]Tue, 27 September 2005 00:48 Go to previous messageGo to next message
sharan_it
Messages: 131
Registered: July 2005
Location: Chennai
Senior Member
Noo am not using any db links
Re: timestamp datatype [message #186361 is a reply to message #139250 ]Mon, 07 August 2006 12:52 Go to previous messageGo to next message
plsql
Messages: 1
Registered: August 2006
Junior Member
Guess:may be you are using 8i client to connect the 9i database.
Solution: To solve this problem connect the database using 9i client and works fine.
Re: timestamp datatype [message #186365 is a reply to message #138929 ]Mon, 07 August 2006 13:18 Go to previous messageGo to next message
Bill B
Messages: 426
Registered: February 2005
Senior Member
Oracle reserved words may NOT be used to name objects such as tables, views, triggers, procedures, columns, constraints...etc. Timestamp is a reserved word and you may NOT use it for a column name. Reserved words are things like timestamp, date, integer, varchar2, char....
Re: timestamp datatype [message #186391 is a reply to message #186361 ]Mon, 07 August 2006 15:16 Go to previous message
joy_division
Messages: 1322
Registered: February 2005
Location: NY
Senior Member
I hope OP didn't hold their breath for the 11 months it took between the last answer and today (07-AUG-2006).

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/202861/viewspace-917495/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/202861/viewspace-917495/

如下oracle的PROCEDURE测试时报错,[Error] (0: 0): PL/SQL: Compilation unit analysis terminated [Error] PLS-00208 (24: 76): PLS-00208: identifier 'TYPE' is not a legal cursor attribute 请协助修正 CREATE OR REPLACE PROCEDURE LPBD7.SP_INSERT_AGENCY_LOGS_ORT AS -- 类型定义保持不变 TYPE t_rec IS RECORD ( event AGENCY_LOGS_JSON.EVENT%TYPE, agent_id AGENCY_LOGS_JSON.AGENT_ID%TYPE, serials_band AGENCY_LOGS_JSON.SERIALS_BAND%TYPE, serials_sp AGENCY_LOGS_JSON.SERIALS_SP%TYPE, serials_bg AGENCY_LOGS_JSON.SERIALS_BG%TYPE, serials_fg AGENCY_LOGS_JSON.SERIALS_FG%TYPE, test_name VARCHAR2(200), created AGENCY_LOGS_JSON.CREATED%TYPE, insertd AGENCY_LOGS_JSON.INSERTD%TYPE, station_id AGENCY_LOGS_JSON.STATION_ID%TYPE, id AGENCY_LOGS_JSON.ID%TYPE, json AGENCY_LOGS_JSON.JSON%TYPE, sample_type VARCHAR2(200), clean_test VARCHAR2(500) ); TYPE t_rec_tab IS TABLE OF t_rec; v_data t_rec_tab; v_params SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); v_last_id AGENCY_LOGS_JSON.ID%TYPE; -- 使用%TYPE确保类型一致 v_new_last_id AGENCY_LOGS_JSON.ID%TYPE := CASE WHEN AGENCY_LOGS_JSON.ID%TYPE = 'NUMBER' THEN 0 ELSE '0' END; v_msg VARCHAR2(4000); V_RESULT VARCHAR2(500); v_max_datetime DATE; -- 用于安全处理日期 BEGIN -- 修复1:确保状态表查询使用正确的过程名 BEGIN SELECT last_id INTO v_last_id FROM LPBD7.PROC_SYNC_STATUS WHERE proc_name = 'SP_INSERT_AGENCY_LOGS_ORT'; -- 名称保持一致 EXCEPTION WHEN NO_DATA_FOUND THEN v_last_id := CASE WHEN AGENCY_LOGS_JSON.ID%TYPE = 'NUMBER' THEN 0 ELSE '0' END; END; -- 预加载参数值(保持不变) SELECT REGEXP_REPLACE(VALUE1, '[^[:alnum:] ]', '') BULK COLLECT INTO v_params FROM LPBD7.U_PARAMETER_FILE WHERE CONDITION1 = 'ORT_EBORD' AND ACTIVE = 'Y' GROUP BY REGEXP_REPLACE(VALUE1, '[^[:alnum:] ]', ''); -- 修复2:安全的日期处理 BEGIN SELECT MAX(LAST_DATETIME) INTO v_max_datetime FROM LP960.TC_AGENCY_JOB_LOG WHERE EXECUTETIME > SYSDATE - 0.5 AND JOBNAME = 'AgencyAPI_Lobs_Json'; EXCEPTION WHEN NO_DATA_FOUND THEN v_max_datetime := CASE WHEN SYSDATE BETWEEN TRUNC (SYSDATE) + 8.5/24 AND TRUNC (SYSDATE) + 20.5/24 THEN TRUNC (SYSDATE) + 8.5/24 WHEN SYSDATE BETWEEN TRUNC (SYSDATE) + 20.5/24 AND TRUNC (SYSDATE+1) THEN TRUNC (SYSDATE) + 20.5/24 WHEN SYSDATE BETWEEN TRUNC (SYSDATE-1) AND TRUNC (SYSDATE) + 8.5/24 THEN TRUNC (SYSDATE - 1) + 20.5 / 24 END; END; -- 批量获取待处理数据(使用安全的日期变量) SELECT h.EVENT, h.AGENT_ID, h.SERIALS_BAND, h.SERIALS_SP, h.SERIALS_BG, h.SERIALS_FG, JSON_VALUE(h.JSON, '$.insight.results.test'), h.CREATED, h.INSERTD, h.STATION_ID, h.ID, h.JSON, JSON_VALUE(h.JSON, '$.insight.uut_attributes.sample_type'), UPPER(REGEXP_REPLACE(JSON_VALUE(h.JSON, '$.insight.results.test'), '[^[:alnum:] ]', '')) BULK COLLECT INTO v_data FROM LPBD7.AGENCY_LOGS_JSON h JOIN MESNEX.AGENCY_JOBS j ON h.AGENT_ID = j.AGENT JOIN MESNEX.AGENCY_PROCESS p ON j.PROCESS = p.ID WHERE UPPER(p.NAME) = 'ORT-RAW' AND j.DISABLED = 'False' AND h.CREATED BETWEEN j.STARTED AND j.ENDED AND h.ID > v_last_id AND h.CREATED >= NVL(v_max_datetime, SYSDATE - 30) - INTERVAL '20' MINUTE -- 安全日期运算 ORDER BY h.ID; IF v_data.COUNT > 0 THEN v_new_last_id := v_data(v_data.LAST).id; -- 批量插入处理(保持不变) FOR i IN 1..v_data.COUNT LOOP FOR j IN 1..v_params.COUNT LOOP CONTINUE WHEN v_params(j) IS NULL; IF INSTR(v_data(i).clean_test, UPPER(v_params(j))) > 0 THEN -- 查重后插入 INSERT INTO LPBD7.AGENCY_LOGS_ORT ( EVENT, AGENT_ID, SERIALS_BAND, SERIALS_SP, SERIALS_BG, SERIALS_FG, TEST_NAME, CREATED, INSERTD, STATION_ID, ID ) SELECT v_data(i).event, v_data(i).agent_id, v_data(i).serials_band, v_data(i).serials_sp, v_data(i).serials_bg, v_data(i).serials_fg, v_data(i).test_name, v_data(i).created, v_data(i).insertd, v_data(i).station_id, v_data(i).id FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM LPBD7.AGENCY_LOGS_ORT o WHERE o.ID = v_data(i).id AND o.TEST_NAME = v_data(i).test_name ); -- 调用存储过程 LPBD7.SP_LOG_ORT_INSERT_EVENT( v_data(i).serials_band, v_data(i).serials_sp, v_data(i).serials_bg, v_data(i).serials_fg, v_data(i).id, v_data(i).created, v_data(i).test_name, v_data(i).event, v_data(i).json, v_data(i).sample_type ); EXIT; -- 匹配后跳出参数循环 END IF; END LOOP; END LOOP; -- 修复3:更新状态时使用正确过程名 MERGE INTO LPBD7.PROC_SYNC_STATUS dst USING (SELECT 'SP_INSERT_AGENCY_LOGS_ORT' proc_name FROM DUAL) src -- 名称一致 ON (dst.proc_name = src.proc_name) WHEN MATCHED THEN UPDATE SET last_id = v_new_last_id WHEN NOT MATCHED THEN INSERT (proc_name, last_id) VALUES (src.proc_name, v_new_last_id); COMMIT; END IF; EXCEPTION WHEN OTHERS THEN ROLLBACK; v_msg := SQLERRM; SELECT SAJET.SF_MES_Send_Mail( 'mes.it@tzlens.com,yujia.liu@tzlens.com', 'SP_INSERT_AGENCY_LOGS_ORT ERROR: ' || SUBSTR(v_msg, 1, 4000), 'STORED PROCEDURE ERROR', '', '', '' ) INTO V_RESULT FROM DUAL; RAISE; END;
最新发布
09-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值