Returning Varrays to Client Technologies

A lot of functions in my PL/SQL API return varrays.
I've been getting some grief from programmer/users who call the APIs from various client technologies (PERL, Java). Their argument is that they are unable to work with the varray return type. When I point out that we frequently do so within the PL/SQL API's, they note that it is not possible outside PL/SQL.
Do the complainers have a point? What's the best practice?

I think (but am not positive) that if you use the thick JDBC driver you can use some of the Oracle-specific parameter types in Java. I know that you can access PL/SQL tables this way and I think I have seen references to varrays as well. You cannot access varrays using perl, ODBC, etc.
The answer depends on how database-independant your client app needs to be and which client side code you are using. If it is perl you have no choice - either change the procedure calls or create a small wrapper procedure that will convert the varrays to/from something the perl code can use.
If your are using JDBC you will need to determine if the thick driver is an option. If so (and you verify that you really CAN use varrays) it would probably be better to use them in cases where a result set is overkill or as a way to send batches of data to the server. This is where I have been PL/SQL tables; I pass in one table for each column and do a FOR EACH to insert them all at once.
The JDBC Developer's Guide would tell you if varrays will work with Java.

Similar Messages

  • CRM Mobile Client Technology Documentation

    Hello All,
    Watch this space for information on Mobile Client Technology documentation.

    <b>Mobile Client Technology documentation</b>
    Mobile Client Technology (mySAP CRM), a part of SAP NetWeaver Mobile, is client technology designed for Microsoft Windows-based, occasionally server-connected CRM field applications. These applications offer a rich function set, such as SAP CRM Mobile Sales and SAP CRM Mobile Service.
    With every support package release of Mobile Client Technology, we provide the following supporting documentation:
    •     Release Note
    •     Upgrade and Installation Guides
    •     Help Portal/ SAP Library content
    •     Limitations Note
    •     Collective Note
    •     API Documentation – integrated with the application
    Mobile Client Technology (mySAP CRM), a part of SAP NetWeaver Mobile, is a client technology designed for Microsoft Windows-based, occasionally server-connected CRM field applications. These applications offer a rich function set, such as SAP CRM Mobile Sales and SAP CRM Mobile Service.
    With every support package release of Mobile Client Technology, we provide the following supporting documentation:
    •     Release Note
    •     Upgrade and Installation Guides
    •     Help Portal/ SAP Library content
    •     Limitations Note
    •     Collective Note
    •     API Documentation – integrated with the application
    <i><b>First Point of Access</b></i>
    The following quick link under the Service Marketplace is the first point of access to the customers: http://service.sap.com/nw-mobile.
    <b>Path:</b>
    Click on SAP NetWeaver &#8594; SAP NetWeaver in Detail &#8594; People Integration &#8594; Multichannel Access &#8594; SAP NetWeaver Mobile &#8594; Mobile Client Technology (mySAP CRM) &#8594; Media Library.
    Mobile Client Technology (mySAP CRM) > Medial Library contains:
    1. Link to access the TICM guides (installation and upgrade guides)
    2. Presentations on the Mobile Client Technology.
    3. Other Technical Documentation and Guides (Performance Modelling Guide, User      Management Usage Guide, Transport Component Guide etc...)
    4. Link to access the Documentation catalog.
    <i><b>Documentation Catalog</b></i>
    The doc catalog lists and provides a description of all the types of documents that are provided for Mobile Client Technology and also points to the locations from where they can be downloaded.
    The link to access the doc catalog PDF is provided in the nw-mobile area - http://service.sap.com/nw-mobile
    <i><b>Locating online help on the Help Portal:</b></i>
    1)  Access http://help.sap.com
    2)  Click on Documentation &#8594; mySAP Business Suite &#8594; SAP Customer Relation Mgmt &#8594; English
    3)  Expand Data Exchange and Mobile Technologies  &#8594; CRM Mobile Technology
    4)  Click on the online help that you need to access.
    *<i><b>Locating TICM Guides on Service Marketplace:</b></i>
    1)  Access http://service.sap.com/instguides
    2)  Click on SAP Business Suite Applications &#8594; SAP CRM &#8594; SAP CRM 2005 &#8594; CRM Mobile (Laptop)

  • Returning XML. Client.jar not properly created

    Hi. I'm trying to deploy a web service that has some methods that receive Document
    as parameter and return Document as result type.
    Weblogic generates a client.jar that don't have all the needed classes, like,
    LiteralCodec, and many others.
    Anybody knows what classes I need?
    Thanks

    Thanks Manoj.
    "SBC" <[email protected]> wrote:
    >
    I created a RPC web service & it ran fine. After I made changes I downloaded
    the
    client.jar file. But when I ant on client classes I am getting error
    saying that
    javac can not find the EJB classes. I looked into client.jar file & it
    seems that
    my EJB interface class is not there. My wsdl file shows my changes. When
    I restarted
    the server I did not get any errors so it means my ejb got deployed fine.
    When
    is the client.jar created?
    Any words of advice....
    Thanks in advance.

  • Returning XML to client from web service

    Hi,
    I am new to developing web services using JAX_RPC. I am trying to return a xml document to the client from the web service.
    My Server implementation is as follows:
    Interface:
    public interface OntoIF extends Remote
    public DataHandler ontoCompare (String targetUrl,String sourceUrl ) throws RemoteException;
    Implementaion:
    public class OntoImpl implements OntoIF
    public DataHandler ontoCompare (String targetUrl,String sourceUrl ) throws RemoteException
    DataHandler dataHandler = new DataHandler( new StreamSource( new File ("status.xml")), "text/xml");
    return dataHandler;
    Client Implementation:
    Stub stb = (Stub) (new OntoService_Impl().getOntoIFPort());
    stb._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
         "http://localhost:8080/onto-service/onto");
    OntoIF onto = (OntoIF) stb;
    DataHandler retDHandler = onto.ontoCompare(targetOntoUrl, sourceOntoUrl);
    When I compile and run my client, it throws the following error -
    java.rmi.ServerException: JAXRPCSERVLET28: Missing port information
    at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.ja
    va:497)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:294
    at sstub.OntoIF_Stub.echoDataHandler(OntoIF_Stub.java:122)
    at sstub.OntoClient.main(OntoClient.java:63)
    Can you please let me know what I am doing wrong? I have no problems in sending a DataHandler but receiving the DataHandler from the web service throws errors.
    Thanks!

    Hi I'm having the same problem. I try to set up a Web Service using JAX_RPC. My WS should invoke a native Method implemented in C++. Did you got a solution for this issue? My Error Message is as follows:
    java.rmi.ServerException: JAXRPCSERVLET28: Missing port information
         at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:497)
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:294)
         at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:80)
         at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:489)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:122)
         at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:86)
    at $Proxy0.getHello(Unknown Source)
         at com.neuhaus.test.ws.client.NativeInvokeClient.main(NativeInvokeClient.java:44)
    Exception in thread "main"
    greetings, JAN

  • OCIStmtExecute does not return immediately when client is busy.

    Hi.
    I'm testing a very busy multi-threaded client server that consistently generates
    a large number of simple queries through oci. The problem is that, when the
    server(client) is busy, OCIStmtExecute does not return immediately in
    non-blocking mode.
    Of course I have set non-blocking mode and OCIStmtExecute does return
    OCI_STILL_EXECUTING immediately when the server is not busy. But
    when log rotation occurs which concatenates a large text file (~500MB)
    onto an even larger text file (up to several giga bytes), or when I simply copies
    or concatenates large text files manually, OCIStmtExecute returns very slowly.
    (roughly about after 100~200ms)
    However, while log rotation takes place, everything else including other oci
    calls that come before OCIStmtExecute (prepare, define) return fast. So
    for me it really seems that only OCIStmtExecute becomes extremely slower
    when local server (especially the disk) is busy.
    Is there any way to let OCIStmtExecute immediately return all the time?
    Thanks in advance.

    Yes, I knew that OCIStmtExecute would be the only function that causes such
    delay and that was why I traced that call. And so far, I checked several times
    what happens at the exact moment on the server but everything was ok.
    Actually OCIStmtExecute becomes slower exactly when crontab-ed log rotate
    occurs so I think this delay must be a client-side problem for now.
    This server is quite busy and has to respond fast, so it is important to
    guarantee fast response time while a small number of timeout losses are tolerable.
    But as OCIStmtExecutes' first OCI_STILL_EXECUTING return takes hundreds of
    ms it has become more like a blocking call and currently I cannot find any way to do what I want.
    So now everytime such thing happens, the thread waits
    quite long, after the first OCI_STILL_EXECUTING return
    the time difference exceeds timeout limit, and the thread
    calls OCIBreak() and OCIReset() and returns.

  • Problems returning VARRAY (or  TABLE) / method  on _IOraDatabase failure

    I am trying to return a VARRAY through OO4O (currently using VB6) but am getting an error back that I don't seem to be able to resolve.
    The SQL procedure is declared as:
    PROCEDURE "RD_GET_TOPOAREAS2_SIZED" (
    minX IN NUMBER, minY IN NUMBER, maxX IN NUMBER, maxY IN NUMBER,
    maxArea IN NUMBER, dt IN DATE, timing OUT NUMBER,
    IDLIST OUT v_numArray, RETDATA OUT NOCOPY t_cursor
    types are defined in the package spec as:
    TYPE t_cursor IS REF CURSOR ;
    TYPE v_numArray IS VARRAY(20000) OF NUMBER;
    TYPE nt_numArray IS TABLE OF NUMBER;
    The calling code is:
    Dim odb As OraDatabase
    Dim oparams As OraParameters
    Dim odyn As OraDynaset
    Set oparams = odb.Parameters
    oparams.Add "minx", 406000, ORAPARM_INPUT, ORATYPE_NUMBER
    oparams.Add "miny", 259000, ORAPARM_INPUT, ORATYPE_NUMBER
    oparams.Add "maxx", 410000, ORAPARM_INPUT, ORATYPE_NUMBER
    oparams.Add "maxy", 261000, ORAPARM_INPUT, ORATYPE_NUMBER
    oparams.Add "maxarea", 100, ORAPARM_INPUT, ORATYPE_NUMBER
    oparams.Add "dt", Null, ORAPARM_INPUT, ORATYPE_DATE
    oparams.Add "time", 0, ORAPARM_OUTPUT, ORATYPE_NUMBER
    oparams.Add "IDLIST", Null, ORAPARM_OUTPUT,
    ORATYPE_VARRAY, "V_NUMARRAY"
    oparams.Add "RETDATA", Null, ORAPARM_OUTPUT, ORATYPE_CURSOR
    Set odyn = odb.CreatePlsqlDynaset(sql, "RETDATA", 8)
    Calling the sql gives me the following error message:
    Run-time error: '-2147417848 (80010108)':
    Method 'CreatePlsqlDynaset' of object '_IOraDatabase' failed
    I have also tried passing the parameter as:
    oparams.AddTable "IDLIST", ORAPARM_OUTPUT, ORATYPE_NUMBER, 20000
    but this gives me a parameter type mismatch.
    Ideally, I would prefer to return the data in a nested table (type nt_numArray),
    but I can't get the call to work with that either (same error).
    I've seen the other couple of posts on this subject, and the fact that a bug giving the same error message was supposed to have been fixed in v 4.3.
    I am currently using the version that came with 11.1.0.6.20 which is v 5.0 I think.
    What's going wrong, and how can I fix it?
    Richard

    Forgot to add the calling sql:
    sql = "begin rd_get_topoareas2_sized " + _
    (:minx,:miny,:maxx,:maxy,:maxarea,:dt,:time,:IDLIST,:R
    ETDATA); end;"
    RichardThat is, I forgot to add that line to the problem, NOT that that was what was causing it!

  • Creating an LOV from function returning Varray

    I have a select statement which runs in PLSQL and runs in the SQL Commands of SQL Workshop, but when I try to use the select statement as an LOV, I keep getting "LOV query invalid, a display and a return value are needed, the columns names need to be different. if your query contains an in-line query, the first FROM clause.....must not belong to the in-line query." My select statement is as follows:
    select a.obj, a.ename from THE (select cast(getxmlnodes('filename.xml') as NodeTableType2 from dual) a;
    The function getxmlnodes reads an xml file and returns the nodes from my xml file. It works fine from SQLPlus etc. but the LOV balks. Can anyone out there help? Thanks

    For anyone who sees this. My select statement didn't work because I had put a
    ';' at the end of the statement. I accidentally left off the ; in one of my tests and the select statement worked like a charm. Everyone likes to have a person answer their own question.

  • Bug? EJB method Return Value and Client Catch the Exception?

    oc4j 9.0.3 on the windows 2000
    I write a Stateless Session Bean named SB1 ,
    and define application exception.
    The Code as follow:
    public class AppErrorException extends Exception
    public interface SB1 extends EJBObject
    public String getMemono(String sysID, String rptKind, String parentMemono)
    throws RemoteException, AppErrorException;
    public class SB1Bean implements SessionBean
    public String getMemono(String sysID, String rptKind, String parentMemono)
    throws RemoteException, AppErrorException
    throw new AppErrorException("Error in getMemono");
    public class SB1TestClient
    try
    memomo= sb1.getMemono(.....);
    catch(AppErrorException ae)
    ae.printStackTrace();
    I found a bug.
    If SB1.getMemono() throws the AppErrorException, but SB1TestClient will not catch any Exception.
    It is not normal!!!!
    [cf]
    But If I convert "public String getMemono(...)" into "public void getMemono(...)",
    When SB1.getMemono() throws the AppErrorException, but SB1TestClient will catch any Exception.
    It is normal.

    getMemono(.......)'s code as follow:
    public String getMemono(String sysID, String rptKind, String parentMemono)
    throws AppErrorException
    log("getMemono("+sysID+", "+rptKind+", "+parentMemono+")");
    Connection connection= null;
    CallableStatement statement = null;
    String memono= "";
    short retCode= -1;
    String retMsg= "";
    try
    String sql= this.CALL_SPGETMEMONO;
    connection = ResourceAssistant.getDBConnectionLocal("awmsDS");
    statement= connection.prepareCall(sql);
    statement.setString(1, sysID.trim());
    statement.setString(2, rptKind.trim());
    statement.setString(3, parentMemono.trim());
    statement.registerOutParameter(4, java.sql.Types.VARCHAR);
    statement.registerOutParameter(5, java.sql.Types.SMALLINT);
    statement.registerOutParameter(6, java.sql.Types.VARCHAR);
    statement.executeQuery();
    retCode= statement.getShort(5);
    retMsg= statement.getString(6);
    log("retCode="+retCode);
    log("retMsg="+retMsg);
    if (retCode==AppConfig.SHORT_SP_RETCODE_FAILED)
    log("retCode==AppConfig.SHORT_SP_RETCODE_FAILED");
    this.sessionContext.setRollbackOnly();
    throw new AppErrorException(retMsg);
    memono= statement.getString(4);
    log("memono="+memono);
    if (rptKind.trim().length()<6)
    log("rptKind.trim().length()<6");
    this.sessionContext.setRollbackOnly();
    throw new AppErrorException("rptKind.trim().length()<6");
    memono= "SS";
    catch (AppErrorException ae)
    log("catch(AppErrorException ae)");
    throw ae;
    //throw new EJBException(ae.getErrMsg());
    catch (Exception e)
    log("catch (Exception e)");
    this.sessionContext.setRollbackOnly();
    throw new AppErrorException(IExceptionConst.ERR_MSG_SYSMEMONO_00000, e.toString());
    //throw new EJBException(IExceptionConst.ERR_MSG_SYSMEMONO_00000+", "+e.toString());
    finally
    log("this.sessionContext.getRollbackOnly()="+this.sessionContext.getRollbackOnly());
    ResourceAssistant.cleanup(connection,statement);
    return memono;

  • How to init sequence on server to return to client?

    How do I initialize a sequence to be returned to a
    client from a java server?
    sample idl :
    module someModule {
    typedef sequence<octet> Data;
    struct SomeStructure {
    Data file;
    string info;
    typedef sequence<SomeStructure> results;
    interface someObject {
    get(in string infotoget, out results results_out, out unsigned long
    numberOfItems);
    on client :
    String info = "filename";
    someModule.resultsHolder rh = new someModule.resultsHolder();
    org.omg.CORBA.IntHolder ih = new org.omg.CORBA.IntHolder();
    someObject.get(info,rh,ih);
    on server :
    ???

    I implemented a server, but I get the following error :
    org.omg.CORBA.UNKNOWN: vmcid: SUN minor code: 202 completed: Maybe
    Test2 Client Error:
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at java.lang.Class.newInstance0(Class.java:308)
         at java.lang.Class.newInstance(Class.java:261)
         at com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:90)
         at com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(ClientResponseImpl.java:105)
         at com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.java:314)
         at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
         at someModule._someObjectStub.get(_someObjectStub.java:20)
         at Test2Client.main(Test2Client.java:54)
    I think the error is caused by incorrect implementation of the sequence on the server.

  • Calling report from forms while running the application from thin clients

    I am using thin client technology with 64MB RAM for running developer 6i application.
    The server has windows 2000 advanced server with 256 MB RAM.
    When I run the apllication from a single client, it works fine even for multiple windows.
    But the moment I switch on more thin clients, the client which fired the printing job first works fine, while the others allow data entry using forms but any call to report for direct printing throws an illegal condition error. I have tried both run_product and host option for running reports. The error returned is the same.
    Howver if the report is run from command prompt simultaneously from both the clients it works fine.
    Immediate help required in this case
    chandandeep

    Hi,
    you better off using Run_Report_Object() instead of Run_Product(). There is a Whitepaper available on otn.oracle.com/products/forms that details this. The problem that you run into is that Forms Services(thin clients) are multi user environments while Reports called via Run_Product() is a single user environment. This means that the Reports Runtime does not handle Reports requests in parallel but sequential one at a time. The first user blocks the runtime engines and all other hang for this time.
    Fran

  • Handling 2 Clients

    hello everybody,
    i have a simple question.
    i have an application where a clients sends a string and server accepts it,finds the string length and return it to client.
    as far as this is concerned , all is fine.
    but i want to send this string length to second client on the same server.
    i am using RMI.
    server returns the length but it is by default sent to the client invoking that function.i want it to be sent to second client.
    can anybody tell me how to go about it.
    i know it may be simple but i am new to distributed technology.
    thanks in advance,
    sachin

    Hi,
    How do you get the reference of second client?
    If it is a very simple application like two clients call two methods on
    the same remote object, then you can make the second thread(client) wait until first one sends that string. And as soon as the server computes string length, then notify the waiting the thread and make it return with the length.
    But, a better way of doing this thing is through RMI callbacks. Your second client registers with the server (through your own register method) passing its own reference. And whenever the server wants to send the length, then call back the second client with the reference that it stored at time of registration.
    regds,
    CA

  • Zip data posted from client does not show up correctely at Server

    The java client post GZip'd data to the Webserver. The webserver for some reason shows the first 10 bytes correctly. Not sure what I am overlooking
    Also get java.io.EOFException: Unexpected end of ZLIB input stream
    public class GetPost {
         public String line;
         public String inputLine;
    public static void main(String[] args) throws Exception {
              GetPost r = new GetPost();
                   r.postURL("User","pass");
    // public Reverse { }
    public static byte [] zip(String data)
    throws IOException
    byte[] incomingBytes = data.getBytes();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    GZIPOutputStream zip = new GZIPOutputStream(baos);
    for (int i = 0; i < incomingBytes.length; i++)
    zip.write(incomingBytes[i] & 0xFF);
    zip.close();
    byte[] uncompressedBytes = baos.toByteArray();
    return uncompressedBytes;
    public static String unzip(byte [] dataBytes)
    throws IOException
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ByteArrayInputStream bios = new ByteArrayInputStream(dataBytes);
    GZIPInputStream unzip = new GZIPInputStream(bios);
    int in = unzip.read();
    while (in != -1)
    baos.write(in);
    in = unzip.read();
    unzip.close();
    return new String(baos.toByteArray());
    public String postURL( String t1 , String t2 ){
    try {
              String data1="h";
    URL urlpost = new URL("http://192.168.15.4:8080/result.html");
         URLConnection conn = urlpost.openConnection();
         conn.setDoOutput(true);
         GZIPOutputStream gz = new GZIPOutputStream(conn.getOutputStream());
         byte [] kkkk=zip(data1);
         String uuu=unzip(kkkk);
         System.out.println("XXXXX" + uuu );
         for (int i=0; i< kkkk.length ; i++){
              Byte jj= new Byte(kkkk);
              System.out.println("LLLL " + " " + i + " " + jj );
         int t= kkkk.length;
         System.out.println("IIII" + t);
         int x= data1.getBytes().length;
         gz.write(kkkk);
         gz.finish();
         gz.close();
         // Get the response
         BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
         while ((line = rd.readLine()) != null) {
         // Process line...
         System.out.println ("The line is " + line );
         } catch (Exception e) {
              return line;
    The client output is
    LLLL 0 31
    LLLL 1 -117
    LLLL 2 8
    LLLL 3 0
    LLLL 4 0
    LLLL 5 0
    LLLL 6 0
    LLLL 7 0
    LLLL 8 0
    LLLL 9 0
    LLLL 10 -53
    LLLL 11 0
    LLLL 12 0
    LLLL 13 -25
    LLLL 14 6
    LLLL 15 107
    LLLL 16 -111
    LLLL 17 1
    LLLL 18 0
    LLLL 19 0
    LLLL 20 0
    Server output is correct only for the first 10 bytes
    LLLL 0 31
    LLLL 1 -117
    LLLL 2 8
    LLLL 3 0
    LLLL 4 0
    LLLL 5 0
    LLLL 6 0
    LLLL 7 0
    LLLL 8 0
    LLLL 9 0
    LLLL 10 -53
    LLLL 11 0
    LLLL 12 0
    LLLL 13 -25
    LLLL 14 6
    LLLL 15 107
    LLLL 16 -111
    LLLL 17 1
    LLLL 18 0
    LLLL 19 0
    LLLL 20 0

    FYI - I got it to work ... I was gzip it twice... here is what worked
    import java.io.BufferedReader;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.URLEncoder;
    import java.util.zip.*;
    import java.io.OutputStreamWriter;
    public class WorkingCopyOfGetPost {
         public String line;
         public String inputLine;
    public static void main(String[] args) throws Exception {
              WorkingCopyOfGetPost r = new WorkingCopyOfGetPost();
                   r.postURL("User","pass");
    // public Reverse { }
    public static byte [] zip(String data) throws IOException {
         byte[] incomingBytes = data.getBytes();
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         GZIPOutputStream zip = new GZIPOutputStream(baos);
         for (int i = 0; i < incomingBytes.length; i++){
              zip.write(incomingBytes[i] & 0xFF);
         zip.close();
         byte[] uncompressedBytes = baos.toByteArray();
         return uncompressedBytes;
    public static String unzip(byte [] dataBytes) throws IOException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ByteArrayInputStream bios = new ByteArrayInputStream(dataBytes);
         GZIPInputStream unzip = new GZIPInputStream(bios);
         int in = unzip.read();
         while (in != -1){
              baos.write(in);
              in = unzip.read();
         unzip.close();
         return new String(baos.toByteArray());
    public static ByteArrayOutputStream zip1(String data) throws IOException {
              byte[] incomingBytes = data.getBytes();
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              GZIPOutputStream zip = new GZIPOutputStream(baos);
              for (int i = 0; i < incomingBytes.length; i++){
                   zip.write(incomingBytes[i] & 0xFF);
              zip.close();
              //byte[] uncompressedBytes = baos.toByteArray();
              return baos;
    public String postURL( String t1 , String t2 ){
         String data1="t";
         try {
              /* byte [] kkkk=zip(data1);
              for (int x=0;x<20;x++){
                   System.out.println("Byte Array Values " + x + kkkk[x] );
              ByteArrayOutputStream bo= zip1(data1);
              byte [] AAA=bo.toByteArray();
              for (int x=0;x<21;x++){
                   System.out.println("Byte Array Values " + x + " "+ AAA[x] );
              URL urlpost = new URL("http://192.168.15.4:8080/result.html");
         URLConnection conn = urlpost.openConnection();
         conn.setDoOutput(true);
         System.out.println( "The size of the byteArrayOutputstream " + bo.size() );
         bo.writeTo(conn.getOutputStream());
         // GZIPOutputStream gz = new GZIPOutputStream(conn.getOutputStream());
         // System.out.println("rrrr " + kkkk.length);
         // gz.write(kkkk);
         //gz.finish();
         //gz.flush();
         bo.flush();
         // String s=unzip(kkkk) ;
         //System.out.println("s " + s);
         // Get the response
         BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
         while ((line = rd.readLine()) != null) {
         // Process line...
         System.out.println ("The line is " + line );
         rd.close();
         bo.close();
         } catch (Exception e) {
              return line;
    }

  • Need to return data from a query in different ways - Please help

    We are using 10g R2
    I have a proc as follows that has a query with over 100 values in the select clause:
    proc one( input param1, input_param2,.... output_cursor )
    as
    begin
    open cursor for
    select ...about 100 values with most of them being calculated
    from table1, view 1, table2, table 3, view 2 ...
    where ....
    and table1.col1 = input param1
    and table1.col2 = input param 2
    and view1.col5 = input param5...
    end;
    I need to return the data that comes from the above query in different formats, columns for a report would be different from columns for screen A and different for screen B. I need only certain columns for a report and different set of columns for another screen. I have wrapper procs that get different input params. From the wrapper procs I intend to call the above proc but would like only selected values.
    How can I accomplish this? Since my main goal is to select different columns for each wrapper I was thinking of insert the data from the above proc into global temp table and selecting whatever columns and order I want from the wrappers.
    What do you think? Any other solutions?
    Thanks
    Edited by: user565033 on Jan 21, 2013 7:50 PM

    You need to clearly separate roles and responsibilities. The PL/SQL code that creates and supplies a cursor handle is server code tasked to supply data. The code that makes the call for server data, is responsible for formatting and rendering that data.
    Thus moving data formatting into the server code needs to be question. Simple example. Cursor does not return invoice date as a date - but formats it into a string using TO_CHAR().
    This works for client1 - as that is the date format expected. However, client2 has different International settings and specifies a different date format. Invoice date, formatted into a string by the server, now renders in the wrong format on client2.
    Server code should not be concerned with rendering and formatting of data send to a client.
    As for the idea to use a global temp table is ..., well to put it nicely, it smells. Badly.
    The single most expensive operation on a database platform is I/O. And now you want to read server data and write it to temporary storage, and the read data from temporary storage to return to the client? What on earth for!? Why purposefully increase the size of the I/O workload? Why decrease performance and undermine scalability?
    Provide a proper abstraction interface to the client. Enable it to specify (as simplistically as possible) what it wants ito data. There are a number of ways to design and implement this in PL/SQL. Simplistic example:
    SQL> create or replace package Employees as
      2 
      3          EMP_FULL_DETAILS        constant integer := 1;
      4          EMP_BASIC_DETAILS       constant integer := 2;
      5 
      6          procedure GetEmpByID(
      7                  cur out sys_refcursor,
      8                  empID in emp.empno%type,
      9                  template in integer default EMP_BASIC_DETAILS
    10          );
    11 
    12          procedure GetEmpByName(
    13                  cur out sys_refcursor,
    14                  empName in emp.ename%type,
    15                  template in integer default EMP_BASIC_DETAILS
    16          );
    17  end;
    18  /
    Package created.
    SQL>
    SQL> create or replace package body Employees as
      2 
      3  type TArray is table of varchar2(32767);
      4 
      5  TemplateList       constant TArray :=
      6          new TArray(
      7                  'EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO ',
      8                  'EMPNO, ENAME, JOB '
      9          );
    10 
    11  procedure GetEmpByID(
    12          cur out sys_refcursor,
    13          empID in emp.empno%type,
    14          template in integer default EMP_BASIC_DETAILS
    15  ) is
    16          sqlSelect       varchar2(32767);
    17  begin
    18          sqlSelect :=
    19                  'select '||TemplateList(template)||
    20                  'from emp where empno = :empID';
    21 
    22          open cur for sqlSelect using empID;
    23  end;
    24 
    25  procedure GetEmpByName(
    26          cur out sys_refcursor,
    27          empName in emp.ename%type,
    28          template in integer default EMP_BASIC_DETAILS
    29  ) is
    30          sqlSelect       varchar2(32767);
    31  begin
    32          sqlSelect :=
    33                  'select '||TemplateList(template)||
    34                  'from emp where ename like :empName';
    35          open cur for sqlSelect using empName;
    36  end;
    37 
    38 
    39  end;
    40  /
    Package body created.
    SQL>
    SQL> var c refcursor
    SQL>
    SQL> exec Employees.GetEmpByID( :c, 7499 );
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB
          7499 ALLEN      SALESMAN
    SQL>
    SQL> exec Employees.GetEmpByName( :c, 'A%', Employees.EMP_FULL_DETAILS );
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB               MGR HIREDATE                   SAL       COMM     DEPTNO
          7499 ALLEN      SALESMAN         7698 1981/02/20 00:00:00       1600        300         30
          7876 ADAMS      CLERK            7788 1987/05/23 00:00:00       1100                    20
    SQL>

  • Process of replacement in case of vehicle returns

    scenario:
    the vehicle came returned;so now client wants to replace this to other;
    how can v do it?
    plz help regarding the above.
    thanks in advance

    sameer...create a seperate process for these kind of replacements..where you are not giving the customer return but actually swapping one material with another...create a new movement type through OMJJ...where accounting entries should be suppressed...with this..while taking the return customer credit limit should not updated..and then you can sell/swap the old material with new with reference to the old.
    I hope you got the flavour of the idea.
    Reward points if it helps,
    Regards,
    N

  • Inconsistent date formats between Rich Client and HTML client

    Hey All,
    Just wondering if anyone has come across an issue with inconsistent date formats from a universe based on an MS SSAS 2012 database connection in 4.x?
    The value of the date is returned as a string from the query but the object data type has been changed to a Date object meaning BusinessObjects should convert the string into a date if the format is correct.
    The problem in this is that the date being returned in Rich Client is in dd/MM/yyyy format whereas on the Web Client is in MM/dd/yyyy.
    From the Web Client business objects will return a date, however, it is a mix of MDY and DMY format.
    i.e. 15th of March will be displayed as 15/03/2014
    whereas 12th of March will be displayed as 03/12/2014
    All our application servers are configured for English (Australian) regional settings meaning all dates should be in DMY format.
    The date in the database is stored as a non-ambiguous yyyy-mm-dd format so it appears the variation is occurring somewhere between the database and BusinessObjects for the Web Client based reports only.
    I have also checked the sqlsrv.prm file based format and changed this to DMY but this has also not made a difference.
    The same universe in 3.1 and MS SSAS 2008 works correctly but not this one.

    Hi
    The date in the database is stored as yyyy-mm-dd format.
    As per user request.... Set the date format @ the Business layer level. so it will refelct same as in the WebI.
    Please find the below link. how to use custom Display option.
    BI4.1 Business Layer Enhancements - Create Display Format

Maybe you are looking for