遇到了一些问题,也许你有解决方案..
我在PHP中有一个脚本,我从一个公式上传了一些数据+图像。第一个表的图像和数据正常,但是当我想使用第一个查询中的rowid进行第二个查询时,会出现以下错误:
Warning: oci_execute(): ORA-06550: line 25, column 44: PL/SQL: ORA-00904: "ROWID": invalid identifier ORA-06550: line 24, column 5: PL/SQL: SQL Statement ignored in C:\xampp\htdocs\workspace\mmdb\test\includes\dbfuncs.inc on line 67
查询部分如下所示:
DECLARE
obj ORDSYS.$type;
iblob BLOB;
BEGIN
INSERT INTO $table (w_id, form, beschreibung, bildsignatur, symbol, muster, teilungen, z_id, i_id, bildpfad, $column, titel)
VALUES ({$table}_seq.nextval, '" . $inputData['shape'] . "', '" . $inputData['description'] . "', ORDSYS.ORDImageSignature.init(), '" . $inputData['symbol'] . "', '" . $inputData['pattern'] . "', '" . $inputData['divide'] . "', '" . $inputData['designer'] . "', '" . $inputData['institution'] . "', '" . $targetFile . "', ordsys.$type.init(), '" . $inputData['title'] . "')
RETURNING ROWID INTO :rid;
SELECT $column INTO obj FROM $table
WHERE ROWID = :rid FOR UPDATE;
iblob := obj.source.localData;
:extblob := iblob;
UPDATE $table SET $column = obj WHERE ROWID = :rid;
FOR I IN 1.." . count($inputData['tags']) . " LOOP
INSERT INTO W_HAT_S (w_s_id, w_id, s_name)
VALUES (I, :rid, '" . $inputData['tags'][0] . "');
END LOOP;
END;";
$blob = OCINewDescriptor ($db, OCI_D_LOB);
$rowid = OCINewDescriptor($db, OCI_D_ROWID);
$sql = strtr ($sql, chr(13).chr(10), " ");
$stmt = OCIParse($db, $sql);
OCIBindByName($stmt, ':extblob', $blob, -1, OCI_B_BLOB);
OCIBindByName($stmt, ':rid', $rowid, -1, OCI_B_ROWID);
oci_execute ($stmt, OCI_NO_AUTO_COMMIT);
$blob->savefile($file);
oci_commit($db);
OCIFreeStatement ($stmt);
$blob->free();
return $rowid;
错误是由行VALUES (I, :rid, '" . $inputData['tags'][0] . "');
引起的,错误消息来自上方。当我用Integer替换此行中的:rid
时,整个脚本正在运行,但我需要动态...
希望有人可以帮助我!