PHP, Oracle Package and NLS parameters.
Dear all,
with this environment:
Oracle Database 11g 11.2.0.3.0 64 bit Production
PHP version: 5.3.3
Oci8 Version 2.0.7
I have a website in Php language that runs:
ALTER SESSION SET NLS_DATE_FORMAT = ''YYYY/MM/DD HH24:MI:SS"
when loading the first page;
then it executes package Oracle (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, once the parcel has been returned, the new default nls_date_format in the web pages of Php (running other queries) is the default value of database, i.e. HH24:MI:SS MON-DD-YYYY
How can I prevent the execution of (all) change of package the nls format used by Php?
It seems that the previous connection Php / session is replaced by the "Oracle Package / login»
Thank you
Igor
Finally, I found the solution: 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);
any necessary changes are made.
Thank you
Igor
Tags: Database
Similar Questions
-
NLS parameters in a connection pool environment
I have limited experience of localization/globalization and I am building an application, using Oracle APEX 4.2/Oracle 11 g db, which takes care of several users of different nationalities. I have a specific question, but first... can anyone recommend good books, blogs and websites to learn more about best practices for the many things you need to think in this area?
Second, my precise question is... Since my application will use a connection pool, how it works as far as setting the NLS parameters for a given client session? In the typical client/server architecture that I know that you would simply change the NLS parameter when the user connects, and this change would govern just the session of this user database. It's a different approach when we are in an environment of connection pool? If this is not the case, how Oracle now manages the parameters of the client session this session of customer may engage in more than one session of db in its lifetime?
You can set the runtime: http://docs.oracle.com/cd/E16655_01/appdev.121/e17961/global_primary_lang.htm#HTMDB14002
Thank you
Sergiusz
-
For the other sessions to find the NLS parameters.
Hi all
Database server Environment Details: 2 Node Oracle 10.2.0.4 RAC on Solaris Operating System
Parameter in Spfile: nls_sort = BINARY_CI nls_comp = LINGUISTIC nls_language = AMERICAN
Parameters in database: SQL> select * from nls_database_parameters; PARAMETER VALUE ------------------------------ ------------------------------------------------------------ NLS_LANGUAGE AMERICAN NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET AL32UTF8 NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE NLS_RDBMS_VERSION 10.2.0.4.0 20 rows selected.
Now, each index on columns of type of data characters in this database are created as function of the Index of base to support Case Insensitive search using nls_sort to BINARY_CI, as shown below.Parameters at client's environment variable(Its Application sever on Windows): Oracle Client 10.2.0.4 nls_sort = BINARY_CI nls_comp = LINGUISTIC
What worries me started when I created by mistake an index btree normal on a character column. After this error just by curiosity, I enabled index followed up on this clue, when I checked in v$ object_usage it got USED!CREATE UNIQUE INDEX UX_NAME_BR ON ONS (NLSSORT("NAME",'nls_sort=''BINARY_CI'''),"TYPE_ID", "UNIT_NUMBER", "DOMICILE", "IS_ACTIVE", "ID")
So I strongly suspect that there are a few sessions connected to this database with different values of NLS instead of nls_sort = BINARY and nls_comp = LINGUISTIC...
Sort of, I did a little test in production to confirm this, as shown below:
IDX_COD index is a regular btree index...PARAMETER VALUE -------------------------------------------------- ------------------------------------------------------------ NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS CHAR NLS_NCHAR_CONV_EXCP FALSE 17 rows selected. SQL> set autotrace traceonly exp SQL> select id,is_active from ons where domicile = 'US' and id = 440 and name = 'AMERICAN COMPANY'; Execution Plan ---------------------------------------------------------- Plan hash value: 1171456783 --------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | --------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 49 | 4 (0)| 00:00:01 | | | | 1 | PARTITION RANGE ALL | | 1 | 49 | 4 (0)| 00:00:01 | 1 | 3 | |* 2 | TABLE ACCESS BY LOCAL INDEX ROWID| ONS | 1 | 49 | 4 (0)| 00:00:01 | 1 | 3 | |* 3 | INDEX RANGE SCAN | IDX_COD | 1 | | 4 (0)| 00:00:01 | 1 | 3 | --------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("ID"=440) 3 - access("DOMICILE"='US' AND "NAME"='AMERICAN COMPANY') SQL> alter session set nls_sort=BINARY_CI; Session altered. SQL> alter session set nls_comp=LINGUISTIC; Session altered. SQL> select * from nls_session_parameters; PARAMETER VALUE -------------------------------------------------- ------------------------------------------------------------ NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY_CI NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP LINGUISTIC NLS_LENGTH_SEMANTICS CHAR NLS_NCHAR_CONV_EXCP FALSE 17 rows selected. SQL> select id,is_active from ons where domicile = 'US' and id = 440 and name = 'AMERICAN COMPANY'; Execution Plan ---------------------------------------------------------- Plan hash value: 270874147 ------------------------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ------------------------------------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 1 | 49 | 2 (0)| 00:00:01 | | | | 1 | TABLE ACCESS BY GLOBAL INDEX ROWID| ONS | 1 | 49 | 2 (0)| 00:00:01 | ROWID | ROWID | |* 2 | INDEX RANGE SCAN | UX_NAME_BR | 1 | | 2 (0)| 00:00:01 | | | ------------------------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 2 - access(NLSSORT("NAME",'nls_sort=''BINARY_CI''')=HEXTORAW('669696E6720636F6D70 616E7900') AND "ID"=440) filter("ID"=440 AND NLSSORT(INTERNAL_FUNCTION("DOMICILE"),'nls_sort=''BINARY_CI ''')=HEXTORAW('7588700') )
So, how can I find which sessions have access to these indexes and find the session parameters nls level connected to this database.
I know there is no way to find settings nls for the other sessions without tracing it...
Kickbacks will not work me
NLS_DATABASE_PARAMETERS
NLS_SESSION_PARAMETERS
Could someone help me please to find these sessions these sessions that are not level session as BINARY_CI and LANGUAGE settingsTrigger may fail if the storage space for the trace table is full. This trigger does not use dynamic SQL code: in this perspective, it is a bit more secure.
I don't know any other way supported to retrieve another session NLS parameters. But he can there have no documented similar to this one http://dioncho.wordpress.com/2009/07/18/spying-on-the-other-session/.
-
Packages and poorly Ref Cursor
SQL Server Developer, I fight with Oracle to say the least. I fought with the poor performance of the extraction of data from the database, but also a multitude of other things. The last number I have is a stored procedure in a package that does not work when run from my .NET code. I have many other packages and stored procedures that are working, but this one is a failure. I don't get any errors, just no data when I should be.
I would run the toad package and see if it is the stored Proc and packaging, or if there is a problem in my .NET code. My stored procedure accepts a single PARAMETER of type integer, and has two parameters SYS_RefCursor OUT. My SQL uses the parameter (ID field) to select from a table. If I run the select SQL by itself with the hardcoded value ID, it works fine. I can run too where it uses the SQL for open cursors and inserts the data but I can't determine if it worked.
So, my questions are the following:
Can I select a Ref_Cursor? I'm trying to do something like that.
If I could get the 1st issue a response, I can keep up with my next question.results_cursor SYS_REFCURSOR; OPEN results_cursor FOR SELECT * FROM Person; SELECT * FROM results_cursor;
Thanks in advance.
JeffHello
I don't see an issue of .NET at this point, so you can have the best chance to post in the forum PLSQL, as it seems that if you need help writing a procedure, rather than interacting with a procedure well known in .NET:
SQL and PL/SQLI'm not clear on your question though. Yes, you can read from a slider ref, and you do it by getting him.
SQL > set serveroutput on
SQL > declare
Ref1 2 sys_refcursor;
3 rec1 emp % rowtype;
Number 4 NTC;
5. start
6. open ref1 for select * from emp;
7 LOOP
8 FETCH INTO rec1 ref1;
9 OUTPUT WHEN ref1% NOTFOUND;
10 DBMS_OUTPUT. Put_line (' name = ' | rec1.ename);
11 END OF LOOP;
12 end;
13.
Name = SMITH
Name = ALLEN
Name = WARD
Name = JONES
Name = MARTIN
Name = BLAKE
Name = CLARK
Name = SCOTT
Name = KING
Name = TURNER
Name = ADAMS
Name = JAMES
Name = FORD
Name = MILLERPL/SQL procedure successfully completed.
SQL >
Maybe if clarify what you are trying to do or accomplish in "selecting from a ref cursor" it would be useful.
Greg
-
Hi I am new to Oracle APEX and my desires to organize me working on it... can someone help me to begin with?
Hello
Start reading the documentation
Oracle Application Express - Documentation
Check the packaged applications that comes with the APEX.
You can find a lot of info and examples of Oracle Learning Library
APEX to read related blogs
You can find many things from this forum, just use search.
Kind regards
Jari
-
Hello
I just want to understand the use of the PEI and -p parameters in the WSL command line i.e. What are the advantages/disadvantages to specify a range of ports? This range of ports is used for what purpose.
Concerning
TariqHi Tariq,
I think that for the most part, it's about keeping WSH remote ports to other ports already in use and if you use a firewall in order to minimize the number of ports that must be opened through the firewall.
The purpose of this port range is to specify which ports the process are WSH will listen on the treatment of workstation customers who are handed to them from the WSL.
Kind regards
Todd little
Chief Architect of Oracle Tuxedo -
Find out all the package and procedure names linked using an array of specifc
I have 25 packages
(DBA_SOURCE is not objective).
Each package contains 30-35 procedures
I need to find all packages and procedures
Each procedure handles the Tables from 5 to 20 according to the need of business rule.
I need the entire package and related procedure names where a specific Table name isQuick response appreciated.
Thank you and best regards,It is difficult to help you if you do not want to read what is suggested. The utldtree.sql script will do what you want. Read the first part of the script and it will tell you what it does and how it works:
>
REM $Header: utldtree.sql, v 1.2 1992/10/26 16:24:44 $ RKOOI Stab
REM
REM Copyright (c) 1991 by Oracle Corporation
REM NAME
REM deptree.sql - Show objects recursively depends on given object
REM DESCRIPTION
REM This procedure, temp and table will allow you to see all
Objects REM (recursively) depends on the given object.
REM Note: you will see the objects for which you have permission.
Examples of rem:
REM run deptree_fill ('procedure', 'scott', 'billing');
REM select * from deptree by seq #;
REM
REM Execute deptree_fill ('table', 'scott', 'emp');
REM select * from deptree by seq #;
REM
REM run deptree_fill ("package body ', 'scott', 'accts_payable'");
REM select * from deptree by seq #;
REM
Way prettier REM to display this information only
REM select * from deptree by seq #;
REM is
REM select * from ideptree;
REM This shows the relationship of dependence via indentation. View
REM that no order by clause is necessary with ideptree.
REM RETURNS>
Did you notice the part that says? :
>
REM Execute deptree_fill ('table', 'scott', 'emp');
REM select * from deptree by seq #;>
If you supply a table name, it will display the objects that depend on this table just as you said you want.
Please try this script. -
Download weekdaynum, independent of the nls parameters.
What is the best way to get Weekdaynum for a date?
The algorithm must be independent of the nls parameters.
This solution depends on nls_teritory and works differently when
nls_territory = "AMERICA."
and when it is ESTONIA:
select decode ( to_char(sysdate,'DY','nls_date_language=english'), 'MON', 1, 'TUE', 2, 'WED', 3, 'THU', 4, 'FRI', 5, 'SAT', 6, 'SUN', 7 ) WeekdayNum from dual;
Something like this should also work, it just takes mod 7 the Julian date and add the value 1.
with data as (select sysdate + rownum - 1 as dt from dual connect by rownum < 10) select dt, decode(mod(to_char(dt,'J'),7) + 1, '1', 'Monday', '2', 'Tuesday', '3', 'Wednesday', '4', 'Thursday', '5', 'Friday', '6', 'Saturday', 'Sunday') as result from data;
-
2nd try - need to know what the msaccess_utlities Oracle package for
I have a client who has moved just a data base Access on Oracle using SQL Developer.
In the generated scripts, there is a script to create a package and called bpdy package
msaccess_utilities
CREATE or REPLACE PACKAGE msaccess_utilities AS
identity NUMBER (10);
TRANCOUNT NUMBER (10): = 0;
FUNCTION left_ (p_string VARCHAR2, p_length NUMBER) RETURN VARCHAR2;
FUNCTION val(p_expr VARCHAR2) RETURN VARCHAR2;
FUNCTION sqr (p_num NUMBER) RETURN NUMBER;
............ (more code)
CREATE or REPLACE PACKAGE BODY msaccess_utilities AS
FUNCTION left_ (VARCHAR2, p_length NUMBER p_string)
RETURN VARCHAR2
IS
BEGIN
RETURN substr_from_end (p_string, p_length);
EXCEPTION
WHILE OTHERS THEN
............... (more code)
What is the functionality of msaccess_utilities and what is it?
When it is used or called?
Thank you
WalterHi Walter,
Developer SQL only not only moves data from MS Access to Oracle.
It can be used to help convert the MS Access to Oracle database, so that you can get rid of MS Access.
This is where msaccess_utilties comes.The msaccess_utilities is an Oracle package that generates a SQL Developer, which emulates the functions of MS Access SQL.
If your MS Access database queries. These queries are converted to VIEWS in Oracle's SQL Developer.
To make the conversion easier and easier to manage, VIEWS can reference the msaccess_utilities package.If you use just to move the data from MS Access to Oracle SQL Developer, then there is no need of the msaccess_utilties.
If you convert everything, including MS Access Oracle queries. Then this package is necessary.Kind regards
Dermot.
SQL development team. -
fusion of procedures in the package and calling with common proc?
Hello
I wrote similar procedures... and I'm calling each procedure separately and transmitting his values...
something like that
My question is how to merge these two procedures in one package and call them with a common procedure and pass the value (var_id) once for procedures?begin mov_tbl1(1234); end then again similarly for begin mov_tbl2(1234); end;
I m bit confused, if you want to use the parameter or parameter... .i am beginner in writing packages... :))create or replace procedure mov_tbl1 ( var_id number) is cursor tbl1_cur as select src.col1, src.col2, from abc_tbl1 tbl1, abc_tbl2 tbl2 where tbl1.no = var_id -- this is variable i m trying to make it as a paramter in common proc tbl1.id = tbl.id -- the record variable declaration is implicit in FOR LOOP begin for tbl1_cur_rec in tbl1_cur loop begin insert into tgt.tabl1(col1,col2) values (tbl1_cur_rec.col1, tbl1_cur_reccol2, ); exception when others then null; end; end loop; end; create or replace procedure mov_tbl2(var_id number) is cursor cur_tbl2 select col3,col4, col5 ...... from abc_tbl1 tbl1, abc_tbl2 tbl2, abc_tbl3 tbl3 where tbl1.no = var_id and --this is variable i m trying to make it as a paramter in common proc tbl1.id = tbl.id and tbl2.dept = tbl3.dept begin for ... loop ... insert into ... values.... .... end;
Ideas or examples is greatly appreciated! Thank you very much!!Check if all parameters have been assigned to certain values.
And call the procedure that is packaged with the following syntax.
Begin
. (parameter_value); end; i.e. Begin TEST_PACK.COMMON_PROC(1234); End; Can you post the code here so that we can have a look at what goes wrong.
Here is a test package I ran
PRAZY@11gR1> create or replace package test_pack as 2 procedure common_proc(var_id number); 3 end; 4 / Package created. Elapsed: 00:00:00.00 PRAZY@11gR1> create or replace package body test_pack as 2 procedure private_proc1(var_id number) as 3 begin 4 dbms_output.put_line('FROM PROC1 :'||var_id); 5 end; 6 7 procedure private_proc2(var_id number) as 8 begin 9 dbms_output.put_line('FROM PROC2 :'||var_id); 10 end; 11 12 procedure common_proc(var_id number) as 13 begin 14 private_proc1(var_id); 15 private_proc2(var_id); 16 end; 17 18 end; 19 / Package body created. Elapsed: 00:00:00.04 PRAZY@11gR1> begin 2 test_pack.common_proc(100); 3 end; 4 / FROM PROC1 :100 FROM PROC2 :100 PL/SQL procedure successfully completed. Elapsed: 00:00:00.01
Kind regards
Prazy -
PHP + oracle 8.0.5 database
Hello, I use PHP OCI8 version 1.3.4 5.2.4-2, moment 10.2.0.1.0 oracle client and Ubuntu 8.04. I need to access an oracle 8.0.5, database is posible my setting?
I tried to use sqlplus and I get the following error ORA-12154: TNS: could not resolve the connect identifier specified
but when I try to log in using php script I got this one:
ORA-03134: connections to this version of the server are no longer supported
but I can connect using the oracle 10 g database!.
any help?
Thanks in advance!If SQL * most environment has been configured correctly, you should see the ORA-3134 too.
You could try compiling PHP OCI8 with Oracle 9.2 libraries, if you have a license. According to the client/server version compatibility matrix http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=207303.1 OIC, this will allow connections to least 8.0.6. 9.2 customers to 8.0.5 login servers has never been supported, but the matrix does not indicate that an error is thrown. It could simply never been certified.
I'm assuming since 8.0 is not supported you just need a less worst solution out some data.
-
Hi, I have Internet data in my package and I just switch to an iPhone a 4S 5, I have to change my number to my new sim card and all is works well but when I go out I do not receive my internet, No 4 G or 3 G appears in the corner, everything is turned on?
Contact your carrier and make sure that your account is configured correctly. Then go to settings/general/to comments and press the network name; This will cause the exceptional carrier updates to install (you will see a dialog box saying if an update is needed). In addition, go to settings/general/reset - Reset network settings if none of these fix. You will lose the WiFi passwords, but nothing else.
-
At the suggestion of Firefox, I refreshed, now all my Add-ons disappeared and worst parameters associated with them are gone too. Where I could find to put the 'old'?
When updating Firefox, it creates a folder on the desktop called "old Firefox data." According to Firefox, it's when my old settings were saved. The question to the community, it is where I can move some of these old settings (and what are those FireFPT) to restore my old settings. Time Machine using nothing else that place an old version of FireFox in my app folder.
I have several clients and staff that need to be restored as soon as POSSIBLE.
Thanks for any help you can offer.
Scott
The best recommendation I can do for your plugins is to visit:
-
FPGA device configuration, package and speed grade.
Hello.
Where can I find the news of grade package and the speed of the FPGA inside of the PXI-7842R? I ask because I want to build a project XPS in the Xilinx XPS and program needs this info.
I followed the example in the "how to use designs based on Xilinx Microblaze with NI LabVIEW FPGA 2009 and the R-series modules". There, he gives the info for the specific FPGA (PXI-7852R and PXI-7953R) they use. It's a Virtex5, ff676, xc5vlx50, level-1 speed, but the authors do not mention where one can find this info.
Thank you
Bill.
Nevermind, found the info in this way:
Instruments\LabVIEW national 2010\Targets\NI\FPGA\RIO\R Series\Pxi-7842r
Bill.
-
Hi all
I use mac and I tried to package and sign with ripple and this is the error I got
"Oh Snap!" "Build request failed with the message: [ERROR] CAP exception has occurred.
Really need help heeeellllppppppp
Use the search .
You probably have a syntax somewhere error...
Maybe you are looking for
-
How unremember passwords saved in Firefox?
When I enter a user name and password to access a website, Firefox asks me if I want Firefox to remember. I say "Remember." Now I wan to change this password. How di do this? Thank you, Jerry H
-
That I can write a complaint to assume that this is a center of service authorized in Moldova and inform Apple?
-
My hP laptop model # G7-227WM WITH WINDOWS 7 Home Edition on initially turning ask an administrator or a power on password and I never set one and im the owner of it. I haven't used in 3 years and I have none of my systems how to reset or recovery di
-
Updates could not get the error 8007005
Last "check for updates" was July 13, 2011 - get 8007005, the error message windows cannot check the updates. However, when I click on the history of the update I see that some updates have been installed. Cannot search updates, tried to run as an
-
Hello Does anyone know if there is an IR-driver available for Windows 7?I have an infra-red device, but it does not work because there is no driver installed. Can someone help me with this?