从PHP调用Oracle存储过程(Call Oracle stored procedure from PHP)
我正在尝试执行并从我的过程中获取数据:
这是我的程序定义的方式:
create or replace PROCEDURE SP_GET_MY_DATA( IN_POP VARCHAR2, IN_SEG VARCHAR2, IN_DUR VARCHAR2, IN_VIEW INTEGER, IN_PAGE INTEGER, VIEW_DATA_CUR OUT SYS_REFCURSOR) AS ...
这里是我的PHP代码来执行并从程序中获取数据:
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = JXYX.com)(PORT = 1521)))(CONNECT_DATA=(SID=DHSJKS)))"; $conn = ocilogon("XXXXXX","XXXXXXXX",$db); $sql = 'BEGIN SP_GET_MY_DATA(:POP, :SEG, :DUR, :VIEW, :PAGE, :OUTPUT_CUR); END;'; $stmt = oci_parse($conn,$sql); oci_bind_by_name($stmt,':POP',$pop); oci_bind_by_name($stmt,':SEG',$seg); oci_bind_by_name($stmt,':DUR',$dur); oci_bind_by_name($stmt,':VIEW',$view); oci_bind_by_name($stmt,':PAGE',$page); $OUTPUT_CUR = oci_new_cursor($conn); oci_bind_by_name($stmt,":OUTPUT_CUR", $OUTPUT_CUR, -1, OCI_B_CURSOR); oci_execute($stmt, OCI_DEFAULT); while ($data = oci_fetch_assoc($OUTPUT_CUR)) { print_r($data); }
但是这样做我收到了这个错误:
oci_fetch_assoc():ORA-24374:在获取或执行并获取之前定义未完成。
我无法弄清楚我错过了什么。 你能帮我吗?
I am trying to execute and get data from my procedure:
Here is the way my procedure is defined:
create or replace PROCEDURE SP_GET_MY_DATA( IN_POP VARCHAR2, IN_SEG VARCHAR2, IN_DUR VARCHAR2, IN_VIEW INTEGER, IN_PAGE INTEGER, VIEW_DATA_CUR OUT SYS_REFCURSOR) AS ...
Here is my PHP code to execute and get data from procedure:
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = JXYX.com)(PORT = 1521)))(CONNECT_DATA=(SID=DHSJKS)))"; $conn = ocilogon("XXXXXX","XXXXXXXX",$db); $sql = 'BEGIN SP_GET_MY_DATA(:POP, :SEG, :DUR, :VIEW, :PAGE, :OUTPUT_CUR); END;'; $stmt = oci_parse($conn,$sql); oci_bind_by_name($stmt,':POP',$pop); oci_bind_by_name($stmt,':SEG',$seg); oci_bind_by_name($stmt,':DUR',$dur); oci_bind_by_name($stmt,':VIEW',$view); oci_bind_by_name($stmt,':PAGE',$page); $OUTPUT_CUR = oci_new_cursor($conn); oci_bind_by_name($stmt,":OUTPUT_CUR", $OUTPUT_CUR, -1, OCI_B_CURSOR); oci_execute($stmt, OCI_DEFAULT); while ($data = oci_fetch_assoc($OUTPUT_CUR)) { print_r($data); }
But in doing so I am getting this error:
oci_fetch_assoc(): ORA-24374: define not done before fetch or execute and fetch".
I am not able to figure out what I'm missing. Can you help?
原文:https://stackoverflow.com/questions/41506335
最满意答案
我看到的一个问题是:
parentsSeq +: Seq(parent)
。 这不会改变序列,它会返回一个新的序列。One problem I see is here:
parentsSeq +: Seq(parent)
. This doesn't mutate the sequence, it returns a new sequence instead.
相关问答
更多-
您根本不需要特殊的f函数,只需生成executor.submit返回的Future: from concurrent.futures import ThreadPoolExecutor executor = ThreadPoolExecutor(10) @gen.coroutine def my_coroutine(...) ... future = executor.submit(func, *args, **kwargs) result = yield future You ...
-
飞镖 - 玩一个期货循环(Dart - Play a loop of Futures)[2022-11-22]
.then()的参数类型错误。 尝试: .then((_) => play2(pickRandomSoundFrequency())) 您需要传递一个要调用的函数,而不是在构造参数时调用该函数。 You have the wrong type for the argument of .then(). Try: .then((_) => play2(pickRandomSoundFrequency())) You need to pass a function to be called, not call ... -
你所追求的是像这样的allMatch()方法: boolean result = futures.stream().allMatch(booleanFuture -> { try { return booleanFuture.get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }); 如果 ...
-
在我的高并发应用程序中使用ThreadPoolExecutor与gevent ,我可以确认这是正常的。 但是,如果数据库驱动程序已经gevent “友好”那样不必要了: psycogreen After using ThreadPoolExecutor with gevent in my high-concurrent app I can confirm that this works fine. But unnecessary if the DB Driver is already gevent "fri ...
-
循环处理期货(Deal with futures in a loop)[2022-05-10]
我看到的一个问题是: parentsSeq +: Seq(parent) 。 这不会改变序列,它会返回一个新的序列。 One problem I see is here: parentsSeq +: Seq(parent). This doesn't mutate the sequence, it returns a new sequence instead. -
我如何在dart中执行此jquery模式的代码? 看起来和你的很相似 对于_db.keys()的每个条目, _db.keys()一个未来添加到数组中,然后等待所有这些都由Future.wait()完成 不确定此代码是否有效(请参阅关于链接问题的答案的评论) void fnA() { fnB().then((_) { // Here, all keys should have been loaded }); } Future fnB() { return _db.open ...
-
期货太多了(Too many Futures)[2021-04-27]
这一切都取决于执行者 。 假设您使用Executors.newFixedThreadPool(n)创建了一个Executor并向其提交了n * 100个任务,那么运行的线程不会超过n个 。 如果您正在使用Clojure的未来功能,它会将您的任务提交给clojure.lang.Agent.soloExecutor 。 soloExecutor是使用Executors.newCachedThreadPool(threadFactory)创建的,因此它将重用线程并尽可能多地运行。 It all depends o ... -
看起来你可以简单地维护一个Map
, Callable >而不是List >并以这种方式检索原始的Callable。 如果你想变得非常聪明,你可以做OO风格并扩展ThreadPoolExecutor并创建一个Future装饰器类。 我认为这可能是矫枉过正,但你可以这样做: import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException ... -
创建涉及异步计算的Flow的最简单方法是使用mapAsync 。 所以......假设你想要创建一个使用异步计算mapper: Int => Future[String]消耗Int并生成String的Flow mapper: Int => Future[String] ,并行度为5。 val mapper: Int => Future[String] = (i: Int) => Future(i.toString) val yourFlow = Flow[Int].mapAsync[String](5)( ...
-
你的代码中有一个拼写错误。 Posts.allow({ update: ownsDocument, remote: ownsDocument }); 应改为 Posts.allow({ update: ownsDocument, remove: ownsDocument }); there is a typo in your code. Posts.allow({ update: ownsDocument, remote: ownsDocument }); ...