dongmu9253 2015-10-23 14:17
浏览 193
已采纳

Php,Oracle包和NLS设置


with this environment:

Oracle Database 11g 11.2.0.3.0 64bit Production
PHP version: 5.3.3
OCI8 Version 2.0.7

I have a web site in Php language that executes:
ALTER SESSION SET NLS_DATE_FORMAT = ''YYYY/MM/DD HH24:MI:SS"
when it loads the first page; then it executes an Oracle package (ZZZJOB):
$ORA_DB = oci_pconnect(ORA_USER, ORA_PASSWORD, ORA_TNSCATALOG, "UTF8");
--$sql="BEGIN ZZZJOB.RUN_ZZZTEST_JOB; END";
$stid = oci_parse($ORA_DB, html_entity_decode($sql));
$r = oci_execute($stid, OCI_DEFAULT);

Then, after the package returns, the new default nls_date_format in Php web pages (executing other queries) is the database default, i.e. DD-Mon-YYYY HH24:MI:SS
How can I prevent the execution of (any) package changes the nls format used by Php?
It seems that the previous Php connection / session is replaced by the "Oracle Package Connection / Session".
Thanks,
Igor

  • 写回答

2条回答 默认 最新

  • dssk35460 2015-10-27 10:22
    关注

    Finally, I found the solutions: if I write:
    DBMS_SCHEDULER.run_job ('ZZZTEST_JOB', TRUE); --the default
    the NLS settings are changed; instead,with
    DBMS_SCHEDULER.run_job ('ZZZTEST_JOB', FALSE);
    no changes are done.
    So, I need to run the job in another session and not in the session of the procedure that was invoked from.
    See also https://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sched.htm#i1013568 Thanks,
    Igor

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题