读取和使用保存在 DB (LOB) 中的 XML

Reading and making use of XML saved in DB (LOB)

    connection.execute(
      `select SSG_RESP_XML from SSG_SR_RESP_DTLS where SERV_PROV_REQ_ID='141220181657' and SSG_RESP_TYPE='NOTIFICATION'`,
      (err, result) => {
        if (err) {
          console.error(err.message);
          doRelease(connection);
          return;
        }
        var lob = result.rows[0][0];
        console.log(lob);
        fs.writeFile('xd.xml',lob, {encoding: 'utf8'}, function (err) {
          return doRelease(connection);
        });

      });

我需要将 xml 保存到一个文件中,并在程序的后续行中解析和使用它。

在 xd.xml 文件中看到 [object Object]

`console.log(lob)` I receive the following

如何从对象中获取 xml?

提前致谢。

我会探索两种方式。

  1. 使用 oracledb package 1.12.1

  2. 中的 fetchAsString 方法
  3. 将 LOB 转换为 varchar2

    select TO_CHAR(SSG_RESP_XML) 来自 SSG_SR_RESP_DTLS 其中 SERV_PROV_REQ_ID='141220181657' 和 SSG_RESP_TYPE='NOTIFICATION'