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 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。