问题标签 [oci8]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
362 浏览

ruby - Ruby OCI8 DBI,如何检查参数绑定后生成的查询?需要检查“in”查询

在使用 Ruby-DBI 时,我面临“in”查询的参数绑定问题。两个问题:

  1. 如何获取参数绑定后生成的sql?
  2. in如果使用 DBI 和 OCI8,sql 的参数是否可以正常工作?

我的代码如下所示:

查询如下所示:

请帮忙。

0 投票
1 回答
293 浏览

ruby - 红宝石鞋oci8连接问题

对不起我的英语不好。

我对 ruby​​ shoes gui 开发很感兴趣,但是在我的实验中我没有连接到 oracle 数据库,我创建了一个包含如下代码的文件:

所以,当我从控制台执行时:

一切都好,但是当我运行时:

我明白了uninitialized constant Object::OCI8 error

一些帮助?

0 投票
1 回答
976 浏览

php - 为什么 OCI-Lob->close 对 IN OUT 参数不起作用?

从我读过的有关 LOB 和 OCI8 PHP 扩展的文档中,我似乎应该调用$lob->close()下面的代码,因为我使用了$lob->writeTemporary(). $lob->close()当我将 LOB 传递给接受 IN 参数的存储过程时工作正常,但如果我将 LOB 传递给接受 IN OUT 参数的存储过程则不起作用。

显然我可以省略$lob->close()对 IN OUT 参数的调用,但我很想知道为什么我需要这样做。有人可以解释一下下面的代码中发生了什么导致它产生以下错误吗?非常感谢任何见解。

OCI-Lob::close() [oci-lob.close]: ORA-22289: 无法对未打开的文件或 LOB 执行 %s 操作

p_clob_in_out过程如下所示:


感谢Vincent Malgrat 的回答,在进一步阅读后,我认为这就是正在发生的事情......在我的 PHP 代码中,该$lob变量是传入的临时 LOB。该临时 LOB 由过程修改,从而创建它的副本. 然后将副本传递出去并替换$lob变量。该writeTemporary方法从未在 LOB 的副本上调用过,因此当我调用$lob->close()它时会失败。$lob->close()PHP 脚本不再可以访问最初创建的原始 LOB(我可以调用它)。

我认为 NOCOPY 提示可能不适用于此处,因为在此页面上的“对 NOCOPY 的限制”下,它指出如果“通过数据库链接或作为外部过程调用子程序”,则 NOCOPY 将被忽略。根据this page,听起来我的PHP脚本中调用存储过程的匿名块将被视为外部过程。

0 投票
1 回答
2431 浏览

php - 将多维数组传递给 Oracle 存储过程

我有自定义类型的 SP:

如何从 PHP (oci8) 使用这个过程(传递多维数组)?

谢谢,

更新:

这是在 Ruby 中执行此操作的代码:

0 投票
1 回答
144 浏览

php - distinct records based on the most recent version

I list comments for an entry and I allow for user's to edit existing comments and it keeps track of those revisions.

Table structure:

comments: id, summary

revisions: comment_id, revision_id, timestamp

revisions.comment_id = comments.id

revisions.revision_id = the id of the new comment, further explanation: when they select the existing comment, it will display an edit form and they may enter a new comment and submit it. It will insert it into the comments table as a new comment, grab the last id from that table and set it as revision_id in the revisions table.

I want to do a select distinct on the revisions table (to retrieve multiple comment_id, revision_id into an array to be used within the application):

for example:

But is it possible to select the appropriate record based on the most recent comment (revisions.timestamp)?

in theory:

select distinct comment_id from revisions WHERE timestamp IS THE LARGEST

revisions table example:

In this example of 4 rows, I'd want the query to return two rows,

that being:

comment_id = 2, revision_id = 12 timestamp = 20120222180000

and

comment_id = 5, revision_id = 19 timestamp = 20120222200000

UPDATE: this seems to do the trick, but please let me know if there is a better way

UPDATE: I also need to include revision_id, the above query only includes comment_id and timestamp

This did it:

0 投票
1 回答
3941 浏览

php - 使用 pecl 编译 OCI8 时出错

当我想用 pecl 安装 ico8 时,出现以下错误。

我正在使用 Mac OS X lion 运行 MAMP (PHP5.3.6)。PEAR & pecl 似乎安装正确。

我一直在寻找几个小时,似乎无法修复它,似乎无法找到任何关于它的信息。有人有想法吗?

0 投票
1 回答
6324 浏览

ruby-on-rails - ActiveRecord oracle_enhanced 适配器无法加载 ruby​​-oci8 库

rails g scaffold失败,但 oci 脚本和 irb 数据查询工作。无法弄清楚出了什么问题。

gem list

返回0.86E2

宝石文件:

通过 IRB:

0 投票
0 回答
440 浏览

php - Redhat Linux 上的 Mysqli 和 OCI8 激活

我是 web 的新手开发人员,我有以下情况:

我的一位客户想要在 Redhat Linux 服务器上“激活”mysqli 和 oracle (oci8) 的 php 扩展。实际目标是能够与位于远程 Unix 服务器上的远程 Oracle 数据库进行通信(连接)。

为了实现这些要求,我必须做什么?

另请注意,任何操作都必须可用于命令行,因为我只能远程访问 Redhat 服务器。

先感谢您。

ps:Redhat服务器已经安装了:Oracle 10g.2 php 5.1.6 Apache 2.2.3

0 投票
1 回答
414 浏览

php - sql 的 php oci_execute 模式

我在 oracle 的 php 中有一个简单的查询:

这通过 oci_parse 就好了....

但是为了让 oci_execute 不会因条件的“无效标识符”而窒息,需要进行翻译。如果我从语句中删除“and u.username!="foo" and c.event > '2012-01-01'”,上面的查询就可以正常工作,如下所示:

构造语句以将用户和日期条件传递给 oci_execute 的正确方法是什么?

0 投票
1 回答
655 浏览

ruby-on-rails - Rails OCI8 防止注入

我正在构建一个网络表单,我想用来自外部 oracle 数据库的数据预填充它。我们正在使用 rails OCI8 插件。

我想通过直接在查询中使用 URL 参数来确保我不会让自己被注入。

例如在控制器中:

如您所见, params[:provider] 直接传递给 OCI8 查询:

Cursor_exec 函数

OCI8 会通过绑定正确清理参数,还是有一种方法可以让我更安全?