Hi,
I'm getting well confused about this -
This statement
$sth = $dbh->prepare("drop table ADDRESS");
$sth->execute();
works, while this one
$sth = $dbh->prepare("drop table ADDRESS;");
$sth->execute();
gives DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement
(DBD ERROR: OCIStmtExecute)
I have a script for ddl stuff, with various statements ended by semi
colons. These give me invalid sql statements in dbi, even though they
work with sql plus. So I had my perl script strip out the semi colons,
and each time it does that, execute the current block. That all works
fine through dbi, until I come to create a trigger:
$sth = $dbh->prepare("CREATE OR REPLACE TRIGGER ADDRESS_ID_TRIG
BEFORE INSERT
ON ADDRESS
FOR EACH ROW
BEGIN
SELECT ADDRESS_SEQ.NEXTVAL
INTO :NEW.ADDRESS_ID
FROM DUAL");
$sth->execute();
$sth = $dbh->prepare("END");
$sth->execute();
This also gives DBD::Oracle::st execute failed: ORA-00900: invalid SQL
statement (DBD ERROR: OCIStmtExecute) for the second execute. the
original sql, with DUAL; END; works fine through sqlplus.
I must be doing this all wrong. Can anyone help?
many thanks in advance
Dave