NLS issue in Java/PLSQL code [ using ROWID]

I have NLS related question regarding the following scenario in Java/PLSQL code ::-
OracleResultSet ors = (OracleResultSet) stmt.executeQuery("select rowId from t where t.col = 'XX'");
// The above query could return multiple rowIds.
String strVal1 = null;
String strVal2 = null;
if(ors.next())
strVal1 = ors.getROWID(1).stringValue();
if(ors.next())
strVal2 = ors.getROWID(1).stringValue();
ArrayList strList = new ArrayList();
strList.add(strVal1);
strList.add(strVal2);
Now I need to pass a list of rowId's from Java to PLSQL function f().
oracle.sql.ARRAY rowListArr = convertArrayListToRowPointerList(strList, conn) ;
OracleCallableStatement cstmt = (OracleCallableStatement)
cstmt.prepareCall("begin f(?); end;");
cstmt.setObject(1, rowListArr);
cstmt.execute();
where:-
static oracle.sql.ARRAY convertArrayListToRowPointerList(ArrayList arr, Connection conn)
throws SQLException {
oracle.sql.ArrayDescriptor stDesc = ArrayDescriptor.createDescriptor
("DBUSER.ROWPOINTERLIST", conn);
oracle.sql.Datum[] keyVals= new oracle.sql.Datum[arr.size()];
for(int i = 0; i < arr.size(); i++) {
keyVals[i] = new oracle.sql.CHAR((String) arr.get(i),
oracle.sql.CHAR.DEFAULT_CHARSET);
oracle.sql.ARRAY keyArr = new oracle.sql.ARRAY(stDesc, conn, keyVals);
return keyArr;
and
create or replace type DBUSER.ROWPOINTERLIST as table of varchar2(4000);
Will there be NLS issues in the above code, where I pass the rowId content
that I obtain from one query, as array of string bind variables to a subsequent PLSQL procedure? --- first approach
Or
do I need to pass the rowId list , as a array of oracle.sql.ROWID via bind variables? -- second approach
The problem I have in second approach is that in the DB we cannot define a type as a table of ROWID's. So currently I have RowPointerList as a table of varchar2's (note the length of list of rowId is not predetermined in my case, so I user table instead of varray).
However I was wondering if the first approach will have any NLS issues.
Will appreciate your comments.
Thanks

ROWIDs are represented as either hex-encoded values or base64 encoded values. Both encodings use pure ASCII, so there should be no NLS issues.
I am not very familiar with the oracle.sql.ARRAY type, but unless absolutely necessary, I would avoid the oracle.sql.CHAR datatype (assuming 10g drivers). Using java.lang.String is preferred.
-- Sergiusz

Similar Messages

  • Java client code using MQ to interface to CICS commarea

    I would like to know whether any one has done a Java client code using MQ to interface with CICS commarea data on Z/OS.

    1. From IBM.
    2. Is this a cryptography question?

  • Plsql code using cursors

    Hi,
    I am a new learner and i want to know how to write a code to get the data and insert into table.
    My scenario is: I have 3 databases - for example db1,db2 and db3
    I have one table called xx_fnd_lkp (column names: lkp1,lkp2,lkp3,lkp4,lkp5,lkp6,lkp7,lkp8,lkp9 and lkp10) in db1 and db2. for lkp1,lkp2,lkp3 has unique index.
    Now i want to write the code to get all the recodrs from db1 and db2 (no duplicates) and insert into db3.
    we have to insert only one record if db1 and db2 has same record.
    please let me know how to write a procedure.
    Thanks
    shashi

    user843979 wrote:
    My scenario is: I have 3 databases - for example db1,db2 and db3
    I have one table called xx_fnd_lkp (column names: lkp1,lkp2,lkp3,lkp4,lkp5,lkp6,lkp7,lkp8,lkp9 and lkp10) in db1 and db2. for lkp1,lkp2,lkp3 has unique index.
    Now i want to write the code to get all the recodrs from db1 and db2 (no duplicates) and insert into db3.
    create or replace procedure p as
    begin
      insert into xx_fnd_lkp
        (lkp1,lkp2,lkp3,lkp4,lkp5,lkp6,lkp7,lkp8,lkp9 ,lkp10)
      select lkp1,lkp2,lkp3,lkp4,lkp5,lkp6,lkp7,lkp8,lkp9 ,lkp10 from xx_fnd_lkp@db1
      union
      select lkp1,lkp2,lkp3,lkp4,lkp5,lkp6,lkp7,lkp8,lkp9 ,lkp10 from xx_fnd_lkp@db2;
    end;@ = a database link
    Manuals for reference
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/toc.htm
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766/toc.htm
    http://www.oracle.com/pls/db112/homepage
    or for other versions
    http://tahiti.oracle.com/
    You wouldn't use a cursor unless you have a requirement to slow the procedure down as much as possible.
    Edited by: 3360 on Jul 6, 2010 4:02 PM
    Additional -
    The procedure would be created in db3
    This could still violate primary key on three columns, but you did not specify which row(s) you want the other non-PK column values from and what logic determines that.

  • HOW TO MAKE MY JAVA APPLICATION CODE INTO A EXE?

    I JUST FINISH WRITING A JAVA APPICATION code USING JCreator.
    there is no error in the program.
    Can someone provide me the steps to change it into a exe so that i can use the application in any computer. THANK YOU!

    You could use Google. I know, it means you need to do some research yourself. But an exe will only work on a Windows platform. Try looking for a tutorial on jar files instead.

  • Display a value from PLSQL code to screen

    How to display a value from PLSQL code to screen without loading or refreshing the page?
    im using ajax to call the javascript to run the PLSQL code. i desire to view some value in the screen when i run the PLSQL code
    skud.

    anything that you print from the PLSQL code(using htp.p, htp.prn etc) with will available in Javascript as the server response. You can parse that string it in javascript and display it on screen or modify page items or create dynamic items/elements using those values.
    A minimal example
    Ondemand PLSQL process : TEST_PROCESS
    begin
      htp.prn('hello world');
    end;Javascript Code
    var ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=TEST_PROCESS',0);
    ajaxResult = ajaxRequest.get();
    alert(ajaxResult);Will display an alert message "hello world"
    You can construct the string in JSON/XML format in PLSQL to pass complex data structures(or multiple values) or even HTML code, then do the required processing in Javascript, for example extract out item values from it and set items, convert the JSON array to a select list item in the page or put the HTML code with a div element in the page.

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • Why can't I use WebCT chat with my computer?  I get the 'spiral of death' every time I try to type in my chat.  I have a feeling it has to do with compatibility issues between Java and Tiger.

    Why can't I use WebCT chat with my computer?  I get the 'spiral of death' every time I try to type in my chat.  I have a feeling it has to do with compatibility issues between Java and Tiger.

    Hi Elizabeth,
    Do your Mac meet any of these requirements?
    http://www.wvnet.edu/services/webct/requirements.html
    From this it appears to be PC only!???
    http://sourceforge.net/projects/awebctcclient/files/Pancake%20%28it%20own%20proj ect%20now%29/Pancake%20Console%20V1.0.0/PancakeConsole-1.0.0-src.zip/download
    Can you provide any more info on which bersion or file you have?
    Can you tell us why you need this for your use?

  • Issue of Security about Java Source Code

    At most time Java compiler compiles the *.java source code into *.class files and then pack them in *.jar files running in the Java VM or as applet running on web pages.
    Recently I find a tool named cavaj that can decompile *.class files into *.java files. I tried it to decompile my *.class files and unvealed that the decompiled *.java files are the same of my source code!
    How to protect the source code not to be pirated? This is a big problem about the mechanism of Java. Is there any tool to compile *.java to *.exe files? Or is there any tool that can decompile *.exe to *.java in the future?

    This is a common question. If you do a search you will find many answers/solutions.
    But can it affect the performance of the program? Your program mayload slight faster, but the runtime performance is the same. It may effect your performance as it takes some time to get the obsufaction right, especially if you are using reflection.

  • To automate the SQL scripts using PLSQL Code

    Hi All,
    I have 20 database server (11.2.0.3) hosted on  unix and Windows platforms.
    Every day I have to kill inactive sessions from all the these 20 database servers. So I have made a below script::
    connect sys/&&sys_password@&&tns_database_name as sysdba
    SPOOL E:\DELETE_INACTIVE_SESSIONS.SQL
    set PAGESIZE 1000
    set LIN 5000
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SET HEADING OFF;
    select 'alter system kill session '||'`'||SID||','||SERIAL#||'`'||' immediate;'  from v$session where status='INACTIVE' and username in ('OSS_DICTIONARY','ADMINISTRATOR');
    SPOOL OFF;
    @@E:\DELETE_INACTIVE_SESSIONS.SQL
    Is there any way so that this execution of script can be automated in PLSQL code for 20 servers so and that code could be put in batch file for execution(i.e. can be execute through batch file from my windows laptop).
    Thanks

    Shrma wrote:
    Is there no way to handle the sql scripts in PLSQL code?
    Well, remember that PL/SQL is executed on a specific server by a certain user so you are already connected when executing a PL/SQL code.
    You could actually use a SQL Plus script to connect to different servers using connect and run your script.
    i.e.:
    SQL> connect sys/pwd_server1@db_server1
    SQL> @killinactive.sql
    SQL> connect sys/pwd_server2@db_server2
    SQL> @killinactive.sql
    But it does not make so much difference with my previous solution.
    Please explain exactly what you would like to do.
    Regards.
    Al

  • Publish a plsql code as webservice without using JDEVELOPER or APEX

    Hi All,
    I am looking into how can we publish a PLSQL code as web-service without using JDEV OR APEX.
    When I google for this one I can see only by using JDEV or APEX we can publish Code as a web-service.
    Is there any way in oracle, just by using simple PLSQL packages we can publish code as a webservice.
    Appreciate your response.
    Thanks,
    MK.

    Apex does not publish PL/SQL code as web services. It is a web run-time and development framework. Something totally different.
    To turn a PL/SQL function into a web service is simple. You use the orawsv servlet in XDB - without making a single code change to the function. It will not even know it is called as a web service.
    To use orawsv, two basic steps. Configure and enable the servlet (raw HTTP/HTTPS connections will be handled by the Listener). This also entails enabling shared server in the database, if not already enabled. The 2nd step is to allow the function to be executed (via a HTTP call) as a web service, via granting specific roles.
    orawsv handles the HTTP call. It provides the WSDL. It parses SOAP envelopes as input. It makes the call (as a standard PL/SQL call), to the function being used as a web service. It returns the results of the PL/SQL function call, as a SOAP envelope output.
    See Support Notes:
    How to Setup Native Oracle XML DB Web Services [Article ID 444191.1]
    Sample Framework for testing Native Oracle XML DB Web Services [Article ID 803794.1]
    How to Browse Native Oracle XML DB Web Services Example [Article ID 1324235.1]

  • Execute MSIL code using JAVA

    How can I execute MSIL code using java?

    Thanks for your reply. I did it in google and didn't find any useful think.
    I just want to know is there any technique in java or already written product that can do that.
    Any advice will be helpful. Thanks

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

  • Need a java code using swing that can do master configuration

    I need a java code using swing that can do master configuration.For example, in the 1st screen it will show all configuration checke boxes . According to those selected check box, it will show the needed panels sequentially and finnaly it will update many xml files.

    TapasB wrote:
    I need a java code .......and I wish you much luck in creating it. Please come back if you have a specific question on a specific part of your code that is not working quite right.

  • Interface using PLSQL code

    Hii...Experts
    I ve written a plsql anonymous block code in database . That code is selecting 2 columns from source and want to implement that code in ODI interface in such a way that the values of two columns should be loaded into target.
    How to do the such interface??
    Please Help..
    Thanks
    Edited by: soumya.rn on Mar 23, 2012 3:54 AM

    If yoru PLSQL code is in a "oracle package" object, you can call this object in an ODI interface
    example :
    your oracle package is called "my_PL_proc" and the parameter requires the source column "ID_PRODUCT"
    in your ODI mapping, you can call it :
    <%=odiRef.getObjectName("L", "my_PL_proc", "D") %>(source_table.ID_PRODUCT)

  • Error in linking C++ STL code  using CC 5.0 on Solaris 2.6

    Hi All,
    When building a shared dynamic library from C/C++ code using
    STL features, I get an a link error, referring to the STL objects in
    use.
    I use CC WorkShop C++ Compiler 5.0 running on Solaris 2.6.
    For example:
    using a vector<int> we get :
    Undefined Symbol
    __1cDstdGvector4Cin0AJallocator4Ci___M__insert_aux6Mpirki_v_
    In File aaa.o
    using a multimap<int,int> we get :
    Undefined Symbol
    __1cH__rwstdJ__rb_tree4CinDstdEpair4CkiCi__n0AL__select1st4n0C_Ci__n0BEless4Ci__n0BJallocator4n0C____U__deallocate_buffers6M_v_
    In File aaa.o
    etc.
    Switching (for testing) from shared lib to an exe does not seem
    to solve this issue.
    Same goes for toggling libCstd & libCrun's link mode (dyn/stat).
    Any suggestions would be appreciated!
    Thank you,
    Gilad

    Hi Gilad,
    I have a suggestion concerning the std::vector::__insert_aux error:
    http://forum.java.sun.com/thread.jspa?forumID=850&threadID=5069680
    Some recommended link options are provided in:
    http://forum.java.sun.com/thread.jspa?forumID=850&threadID=5104725
    Hope this is useful.
    Bye.

Maybe you are looking for

  • Is there a way to export still images from Quicktime or do I need Quicktime Pro (and is Quicktime Pro even still a thing?)

    I'm sure there used to be an option "export to still image" but not any more. Do I need to switch to Quicktime Pro? I used to have it back in my P.C. days but I'm not sure if Quicktime Pro is even a thing any more. I don't want to go down the "screen

  • Maxl to import datafolders

    I want to make an maxl script to import all files in a specific folder. These files are variable, but all have the same layout. The script I have created: set varPath = 'P:\\WM\\Finance & Control\\Controlling\\Business Control\\Latest Estimate\\LE 01

  • Version 2.0 developer defaults

    I've just upgraded to version 2 and although I know that there are many benifets to 2.0 in terms of ease of development, I find that for a developer the user interface has changed for the worse. Tthe lists and menus use a grey font on a grey backgrou

  • Oracle Lite DB 연결 성공하신분 없나요?

    개발환경 : Win7 x86, Visual Studio 2008, Oracle lite 10g 플랫폼 : Pocket PC 2003 SE .... 아는 개발자중에서도 Oracle Lite를 사용한분이 없네요 ㅠㅠ Pocket PC 2003 에뮬레이터 안에 Oracle Lite 설치했구요. Pocket PC 2003 에뮬레이터 안에서 인터넷도 가능하도록 셋팅하는데 성공하였습니다. 연결 문자열은 독특하게 "DSN=서비스명;uid=아이디;pwd=비밀

  • Can I download my photos from my mac iphots to my windows laptop via my iCloud?

    Can I download my photos in my iphoto on my mac to my windows laptop via my iCloud?