我在跟踪pl / sql匿名时遇到问题。这是我的pl / sql块的缩小版本。我的代码出了什么问题?
WHENEVER SQLERROR EXIT sql.sqlcode ROLLBACK
WHENEVER oserror EXIT FAILURE ROLLBACK
SET SERVEROUTPUT ON
SET ECHO OFF
SET DEFINE OFF
SET LINESIZE 120
SET AUTOCOMMIT OFF
BEGIN
update MYTABLE set GID = '12345' where MYTABLE.COLUMN1=456456 and MYTABLE.PARTY<>0 and MYTABLE.EXPIRY = to_date('17/05/2013','DD/MM/YYYY')
AND EXISTS (SELECT PARTIES.LABEL
FROM PARTIES
WHERE PARTIES.m_id = MYTABLE.PARTY_ID and PARTIES.LABEL = 'PARTY_NAME');
dbms_output.put_line( 'Rows Updated : ' || to_char(sql%rowcount));
END;
/
WHENEVER oserror EXIT FAILURE ROLLBACK
SET SERVEROUTPUT ON
SET ECHO OFF
SET DEFINE OFF
SET LINESIZE 120
SET AUTOCOMMIT OFF
BEGIN
update MYTABLE set GID = '12345' where MYTABLE.COLUMN1=456456 and MYTABLE.PARTY<>0 and MYTABLE.EXPIRY = to_date('17/05/2013','DD/MM/YYYY')
AND EXISTS (SELECT PARTIES.LABEL
FROM PARTIES
WHERE PARTIES.m_id = MYTABLE.PARTY_ID and PARTIES.LABEL = 'PARTY_NAME');
dbms_output.put_line( 'Rows Updated : ' || to_char(sql%rowcount));
END;
/
这是我得到的输出
update MYTABLE set GID = '12345' where MYTABLE.COLUMN1=456456 and MYTABLE.PARTY0 and MYTABLE.EXPIRY = to_date('17/05/2013','DD/MM/YYYY') * ERROR at line 2: ORA-06550: line 2, column 8: PL/SQL: ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-488: invalid variable declaration: object 'TIMESTAMP' must be a type or subtype ORA-06550: line 2, column 1: PL/SQL: SQL Statement ignored
答案 0 :(得分:0)
根据您报告的错误,我猜您PL / SQL块中的某个位置(您的问题中没有),您指的是名为TIMESTAMP
的表列。不幸的是,这是Oracle中的保留字,因为它是列数据类型。我建议您将列重命名为DATE_CREATED
,并查看代码是否已编译。